Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3209)

Unified Diff: chrome/browser/search_engines/template_url.cc

Issue 10905292: Add API key to omnibox's suggest requests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 42 -> 43 Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/search_engines/template_url_prepopulate_data.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/search_engines/template_url.cc
diff --git a/chrome/browser/search_engines/template_url.cc b/chrome/browser/search_engines/template_url.cc
index ad96e0e24ed19d7c099a93a3ff2513adce567214..1612f5a408da560bf1d264b4a67941daae9efa9f 100644
--- a/chrome/browser/search_engines/template_url.cc
+++ b/chrome/browser/search_engines/template_url.cc
@@ -19,6 +19,7 @@
#include "chrome/browser/search_engines/search_terms_data.h"
#include "chrome/browser/search_engines/template_url_service.h"
#include "chrome/common/url_constants.h"
+#include "google_apis/google_api_keys.h"
#include "net/base/escape.h"
#include "ui/base/l10n/l10n_util.h"
@@ -57,6 +58,7 @@ const char kGoogleRLZParameter[] = "google:RLZ";
// Same as kSearchTermsParameter, with no escaping.
const char kGoogleSearchFieldtrialParameter[] =
"google:searchFieldtrialParameter";
+const char kGoogleSuggestAPIKeyParameter[] = "google:suggestAPIKeyParameter";
const char kGoogleUnescapedSearchTermsParameter[] =
"google:unescapedSearchTerms";
const char kGoogleUnescapedSearchTermsParameterFull[] =
@@ -136,7 +138,7 @@ std::string TemplateURLRef::GetURL() const {
case SEARCH: return owner_->url();
case SUGGEST: return owner_->suggestions_url();
case INSTANT: return owner_->instant_url();
- default: NOTREACHED(); return std::string();
+ default: NOTREACHED(); return std::string(); // NOLINT
}
}
@@ -462,6 +464,9 @@ bool TemplateURLRef::ParseParameter(size_t start,
replacements->push_back(Replacement(GOOGLE_RLZ, start));
} else if (parameter == kGoogleSearchFieldtrialParameter) {
replacements->push_back(Replacement(GOOGLE_SEARCH_FIELDTRIAL_GROUP, start));
+ } else if (parameter == kGoogleSuggestAPIKeyParameter) {
+ url->insert(start,
+ net::EscapeQueryParamValue(google_apis::GetAPIKey(), false));
} else if (parameter == kGoogleUnescapedSearchTermsParameter) {
replacements->push_back(Replacement(GOOGLE_UNESCAPED_SEARCH_TERMS, start));
} else if (!prepopulated_) {
« no previous file with comments | « no previous file | chrome/browser/search_engines/template_url_prepopulate_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698