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

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: Formatting. 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
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..d6a4dea51a4268d53f9e4c6983f19686dd44a5ac 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[] =
@@ -284,6 +286,11 @@ std::string TemplateURLRef::ReplaceSearchTermsUsingTermsData(
}
break;
+ case GOOGLE_SUGGEST_API_KEY:
+ url.insert(i->index, "sugkey=" +
David Black 2012/09/14 19:05:05 It looks like you're confusing the approaches take
Mark P 2012/09/14 19:20:34 Good idea. Did the latter.
+ net::EscapeQueryParamValue(google_apis::GetAPIKey(), false) + "&");
+ break;
+
case GOOGLE_UNESCAPED_SEARCH_TERMS: {
std::string unescaped_terms;
base::UTF16ToCodepage(search_terms_args.search_terms,
@@ -462,6 +469,8 @@ 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) {
+ replacements->push_back(Replacement(GOOGLE_SUGGEST_API_KEY, start));
} else if (parameter == kGoogleUnescapedSearchTermsParameter) {
replacements->push_back(Replacement(GOOGLE_UNESCAPED_SEARCH_TERMS, start));
} else if (!prepopulated_) {
« no previous file with comments | « chrome/browser/search_engines/template_url.h ('k') | chrome/browser/search_engines/template_url_prepopulate_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698