[go: up one dir, main page]

Merge to branch 2272 - Add an alternate contextual search url to extract the search terms from window.location.hash.

BUG=456353
TBR=pkasting@chromium.org

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

Cr-Commit-Position: refs/branch-heads/2272@{#308}
Cr-Branched-From: 827a380cfdb31aa54c8d56e63ce2c3fd8c3ba4d4-refs/heads/master@{#310958}
diff --git a/chrome/common/instant_types.cc b/chrome/common/instant_types.cc
index 4dca3a5..b2149859 100644
--- a/chrome/common/instant_types.cc
+++ b/chrome/common/instant_types.cc
@@ -92,7 +92,7 @@
 }
 
 EmbeddedSearchRequestParams::EmbeddedSearchRequestParams(const GURL& url) {
-  const std::string& url_params(url.query());
+  const std::string& url_params(url.ref().empty()? url.query() : url.ref());
   url::Component query, key, value;
   query.len = static_cast<int>(url_params.size());
 
diff --git a/chrome/common/instant_types_unittest.cc b/chrome/common/instant_types_unittest.cc
index 47ebebd..6efa0af 100644
--- a/chrome/common/instant_types_unittest.cc
+++ b/chrome/common/instant_types_unittest.cc
@@ -49,6 +49,13 @@
      "utf-8",
      "chrome.2.65.j04"
     },
+    {"https://foo/search?q=google#q=fun&oq=f&ie=utf-8&aqs=chrome.0.1",
+     "fun",
+     "f",
+     "",
+     "utf-8",
+     "chrome.0.1"
+    },
   };
 
   for (size_t i = 0; i < arraysize(cases); ++i) {
diff --git a/components/search_engines/prepopulated_engines.json b/components/search_engines/prepopulated_engines.json
index bb99ad398..7e7dfc2 100644
--- a/components/search_engines/prepopulated_engines.json
+++ b/components/search_engines/prepopulated_engines.json
@@ -30,7 +30,7 @@
 
     // Increment this if you change the data in ways that mean users with
     // existing data should get a new version.
-    "kCurrentDataVersion": 79
+    "kCurrentDataVersion": 81
   },
 
   // The following engines are included in country lists and are added to the
@@ -539,6 +539,7 @@
         "{google:baseURL}#q={searchTerms}",
         "{google:baseURL}search#q={searchTerms}",
         "{google:baseURL}webhp#q={searchTerms}",
+        "{google:baseURL}s#q={searchTerms}",
         "{google:baseURL}s?q={searchTerms}"
       ],
       "search_terms_replacement_key": "{google:instantExtendedEnabledKey}",