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

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

Issue 345803002: Move GoogleImageSearchSource() from template_url.cc to UIThreadSearchTermsData (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 6 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_unittest.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 f54b5ecbea5804ebaf7c0c9e270440fc4faa57e7..70524e2ccdf11ad84f7b15fabd434a76517bff78 100644
--- a/chrome/browser/search_engines/template_url.cc
+++ b/chrome/browser/search_engines/template_url.cc
@@ -23,7 +23,6 @@
#include "chrome/browser/search/search.h"
#include "chrome/browser/search_engines/template_url_service.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/chrome_version_info.h"
#include "components/google/core/browser/google_util.h"
#include "components/metrics/proto/omnibox_input_type.pb.h"
#include "components/search_engines/search_terms_data.h"
@@ -168,23 +167,6 @@ std::string FindSearchTermsKey(const std::string& params) {
return std::string();
}
-// Returns the string to use for replacements of type
-// GOOGLE_IMAGE_SEARCH_SOURCE.
-std::string GetGoogleImageSearchSource() {
- chrome::VersionInfo version_info;
- if (version_info.is_valid()) {
- std::string version(version_info.Name() + " " + version_info.Version());
- if (version_info.IsOfficialBuild())
- version += " (Official)";
- version += " " + version_info.OSType();
- std::string modifier(version_info.GetVersionStringModifier());
- if (!modifier.empty())
- version += " " + modifier;
- return version;
- }
- return "unknown";
-}
-
bool IsTemplateParameterString(const std::string& param) {
return (param.length() > 2) && (*(param.begin()) == kStartParameter) &&
(*(param.rbegin()) == kEndParameter);
@@ -592,7 +574,8 @@ bool TemplateURLRef::ParseParameter(size_t start,
replacements->push_back(
Replacement(TemplateURLRef::GOOGLE_IMAGE_ORIGINAL_WIDTH, start));
} else if (parameter == kGoogleImageSearchSource) {
- url->insert(start, GetGoogleImageSearchSource());
+ replacements->push_back(
+ Replacement(TemplateURLRef::GOOGLE_IMAGE_SEARCH_SOURCE, start));
} else if (parameter == kGoogleImageThumbnailParameter) {
replacements->push_back(
Replacement(TemplateURLRef::GOOGLE_IMAGE_THUMBNAIL, start));
@@ -1113,6 +1096,12 @@ std::string TemplateURLRef::HandleReplacements(
}
break;
+ case GOOGLE_IMAGE_SEARCH_SOURCE:
+ HandleReplacement(
+ std::string(), search_terms_data.GoogleImageSearchSource(), *i,
+ &url);
+ break;
+
default:
NOTREACHED();
break;
« no previous file with comments | « no previous file | chrome/browser/search_engines/template_url_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698