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

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

Issue 10332156: Add ability to set RLZ statically for OS_ANDROID (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 7 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/search_terms_data.cc
diff --git a/chrome/browser/search_engines/search_terms_data.cc b/chrome/browser/search_engines/search_terms_data.cc
index e74b29a842de714a98142a50b603865bae815707..375753035f66d0f310d8127021786e5ce57f57fa 100644
--- a/chrome/browser/search_engines/search_terms_data.cc
+++ b/chrome/browser/search_engines/search_terms_data.cc
@@ -54,11 +54,9 @@ std::string SearchTermsData::GetApplicationLocale() const {
return "en";
}
-#if defined(ENABLE_RLZ)
string16 SearchTermsData::GetRlzParameterValue() const {
return string16();
}
-#endif
std::string SearchTermsData::InstantEnabledParam() const {
return std::string();
@@ -66,6 +64,8 @@ std::string SearchTermsData::InstantEnabledParam() const {
// static
std::string* UIThreadSearchTermsData::google_base_url_ = NULL;
+base::LazyInstance<string16>::Leaky UIThreadSearchTermsData::g_static_rlz =
+ LAZY_INSTANCE_INITIALIZER;
UIThreadSearchTermsData::UIThreadSearchTermsData(Profile* profile)
: profile_(profile) {
@@ -88,11 +88,17 @@ std::string UIThreadSearchTermsData::GetApplicationLocale() const {
return g_browser_process->GetApplicationLocale();
}
-#if defined(ENABLE_RLZ)
+void UIThreadSearchTermsData::SetStaticRlz(const string16& rlz) {
+ g_static_rlz.Get() = rlz;
+}
+
string16 UIThreadSearchTermsData::GetRlzParameterValue() const {
DCHECK(!BrowserThread::IsWellKnownThread(BrowserThread::UI) ||
BrowserThread::CurrentlyOn(BrowserThread::UI));
+ if (!(g_static_rlz == NULL))
Peter Kasting 2012/05/19 02:00:55 Nit: Use !=
Isaac (away) 2012/05/19 02:09:01 I would love to but they haven't defined the != op
Peter Kasting 2012/05/19 02:13:08 Actually this makes me realize there's a problem h
Isaac (away) 2012/05/19 02:39:31 OK -- will make this and the other changes in a fo
+ return g_static_rlz.Get();
string16 rlz_string;
+#if defined(ENABLE_RLZ)
// For organic brandcodes do not use rlz at all. Empty brandcode usually
// means a chromium install. This is ok.
std::string brand;
@@ -103,9 +109,9 @@ string16 UIThreadSearchTermsData::GetRlzParameterValue() const {
// search might not send the RLZ data but this is not really a problem.
RLZTracker::GetAccessPointRlz(rlz_lib::CHROME_OMNIBOX, &rlz_string);
}
+#endif
return rlz_string;
}
-#endif
std::string UIThreadSearchTermsData::InstantEnabledParam() const {
DCHECK(!BrowserThread::IsWellKnownThread(BrowserThread::UI) ||

Powered by Google App Engine
This is Rietveld 408576698