Partially componentize //chrome/browser/search/search.{h,cc}

Move functions from //chrome/browser/search/search.{h,cc} to the search
component //components/search/search.{h,cc} so that they can be shared
with iOS.

Move all the code in those two files (and supporting unittests) from
the "chrome" to the "search" namespace.

Move unittests that do not depends on non-componentized functions into
the search component.

Implements GetSearchTerms() on iOS that uses a web::WebState* instead
of content::WebContents and simplify the code to remove unsupported
features.

Directly use //components/search on iOS instead of the SearchProvider
when possible.

BUG=514239
TBR=sky,droger,benwells

Review URL: https://codereview.chromium.org/1260033003

Cr-Commit-Position: refs/heads/master@{#341525}
diff --git a/chrome/browser/ui/browser_instant_controller.cc b/chrome/browser/ui/browser_instant_controller.cc
index c4871ef1..8344448 100644
--- a/chrome/browser/ui/browser_instant_controller.cc
+++ b/chrome/browser/ui/browser_instant_controller.cc
@@ -75,7 +75,7 @@
   DCHECK(disposition == CURRENT_TAB) << disposition;
 
   const base::string16& search_terms =
-      chrome::ExtractSearchTermsFromURL(profile(), url);
+      search::ExtractSearchTermsFromURL(profile(), url);
   EmbeddedSearchRequestParams request_params(url);
   if (search_terms.empty())
     return false;
@@ -95,7 +95,7 @@
 
   // If we will not be replacing search terms from this URL, don't send to
   // InstantController.
-  if (!chrome::IsQueryExtractionAllowedForURL(profile(), url))
+  if (!search::IsQueryExtractionAllowedForURL(profile(), url))
     return false;
   return instant_.SubmitQuery(search_terms, request_params);
 }
@@ -166,8 +166,8 @@
     if (google_base_url_domain_changed &&
         SearchTabHelper::FromWebContents(contents)->model()->mode().is_ntp()) {
       // Replace the server NTP with the local NTP.
-      content::NavigationController::LoadURLParams
-          params(chrome::GetLocalInstantURL(profile()));
+      content::NavigationController::LoadURLParams params(
+          search::GetLocalInstantURL(profile()));
       params.should_replace_current_entry = true;
       params.referrer = content::Referrer();
       params.transition_type = ui::PAGE_TRANSITION_RELOAD;