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

Side by Side Diff: chrome/browser/search_engines/search_terms_data.cc

Issue 228013002: Use whether a query is from the app list to determine the RLZ parameter. (Closed) Base URL: http://git.chromium.org/chromium/src.git@rlz-access-ids
Patch Set: Created 6 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/search_engines/search_terms_data.h" 5 #include "chrome/browser/search_engines/search_terms_data.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 // Clear the query and ref. 53 // Clear the query and ref.
54 repl.ClearQuery(); 54 repl.ClearQuery();
55 repl.ClearRef(); 55 repl.ClearRef();
56 return base_url.ReplaceComponents(repl).spec(); 56 return base_url.ReplaceComponents(repl).spec();
57 } 57 }
58 58
59 std::string SearchTermsData::GetApplicationLocale() const { 59 std::string SearchTermsData::GetApplicationLocale() const {
60 return "en"; 60 return "en";
61 } 61 }
62 62
63 base::string16 SearchTermsData::GetRlzParameterValue() const { 63 base::string16 SearchTermsData::GetRlzParameterValue(bool from_app_list) const {
64 return base::string16(); 64 return base::string16();
65 } 65 }
66 66
67 std::string SearchTermsData::GetSearchClient() const { 67 std::string SearchTermsData::GetSearchClient() const {
68 return std::string(); 68 return std::string();
69 } 69 }
70 70
71 std::string SearchTermsData::GetSuggestClient() const { 71 std::string SearchTermsData::GetSuggestClient() const {
72 return std::string(); 72 return std::string();
73 } 73 }
(...skipping 28 matching lines...) Expand all
102 } 102 }
103 103
104 std::string UIThreadSearchTermsData::GetApplicationLocale() const { 104 std::string UIThreadSearchTermsData::GetApplicationLocale() const {
105 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) || 105 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) ||
106 BrowserThread::CurrentlyOn(BrowserThread::UI)); 106 BrowserThread::CurrentlyOn(BrowserThread::UI));
107 return g_browser_process->GetApplicationLocale(); 107 return g_browser_process->GetApplicationLocale();
108 } 108 }
109 109
110 // Android implementations are located in search_terms_data_android.cc. 110 // Android implementations are located in search_terms_data_android.cc.
111 #if !defined(OS_ANDROID) 111 #if !defined(OS_ANDROID)
112 base::string16 UIThreadSearchTermsData::GetRlzParameterValue() const { 112 base::string16 UIThreadSearchTermsData::GetRlzParameterValue(
113 bool from_app_list) const {
113 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) || 114 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) ||
114 BrowserThread::CurrentlyOn(BrowserThread::UI)); 115 BrowserThread::CurrentlyOn(BrowserThread::UI));
115 base::string16 rlz_string; 116 base::string16 rlz_string;
116 #if defined(ENABLE_RLZ) 117 #if defined(ENABLE_RLZ)
117 // For organic brandcodes do not use rlz at all. Empty brandcode usually 118 // For organic brandcodes do not use rlz at all. Empty brandcode usually
118 // means a chromium install. This is ok. 119 // means a chromium install. This is ok.
119 std::string brand; 120 std::string brand;
120 if (google_util::GetBrand(&brand) && !brand.empty() && 121 if (google_util::GetBrand(&brand) && !brand.empty() &&
121 !google_util::IsOrganic(brand)) { 122 !google_util::IsOrganic(brand)) {
122 // This call will return false the first time(s) it is called until the 123 // This call will return false the first time(s) it is called until the
123 // value has been cached. This normally would mean that at most one omnibox 124 // value has been cached. This normally would mean that at most one omnibox
124 // search might not send the RLZ data but this is not really a problem. 125 // search might not send the RLZ data but this is not really a problem.
125 RLZTracker::GetAccessPointRlz(RLZTracker::CHROME_OMNIBOX, &rlz_string); 126 rlz_lib::AccessPoint access_point = RLZTracker::CHROME_OMNIBOX;
127 #if !defined(OS_IOS)
128 if (from_app_list)
129 access_point = RLZTracker::CHROME_APP_LIST;
130 #endif
131 RLZTracker::GetAccessPointRlz(access_point, &rlz_string);
126 } 132 }
127 #endif 133 #endif
128 return rlz_string; 134 return rlz_string;
129 } 135 }
130 136
131 // We can enable this on non-Android if other platforms ever want a non-empty 137 // We can enable this on non-Android if other platforms ever want a non-empty
132 // search client string. There is already a unit test in place for Android 138 // search client string. There is already a unit test in place for Android
133 // called TemplateURLTest::SearchClient. 139 // called TemplateURLTest::SearchClient.
134 std::string UIThreadSearchTermsData::GetSearchClient() const { 140 std::string UIThreadSearchTermsData::GetSearchClient() const {
135 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) || 141 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) ||
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 #endif // defined(ENABLE_THEMES) 187 #endif // defined(ENABLE_THEMES)
182 188
183 return std::string(); 189 return std::string();
184 } 190 }
185 191
186 // static 192 // static
187 void UIThreadSearchTermsData::SetGoogleBaseURL(const std::string& base_url) { 193 void UIThreadSearchTermsData::SetGoogleBaseURL(const std::string& base_url) {
188 delete google_base_url_; 194 delete google_base_url_;
189 google_base_url_ = base_url.empty() ? NULL : new std::string(base_url); 195 google_base_url_ = base_url.empty() ? NULL : new std::string(base_url);
190 } 196 }
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/search_terms_data.h ('k') | chrome/browser/search_engines/search_terms_data_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698