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

Side by Side Diff: ios/chrome/browser/search_engines/ui_thread_search_terms_data.cc

Issue 2570573002: Convert RLZ to a buildflag header (Closed)
Patch Set: iOS Created 4 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ios/chrome/browser/search_engines/ui_thread_search_terms_data.h" 5 #include "ios/chrome/browser/search_engines/ui_thread_search_terms_data.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "components/google/core/browser/google_url_tracker.h" 9 #include "components/google/core/browser/google_url_tracker.h"
10 #include "components/google/core/browser/google_util.h" 10 #include "components/google/core/browser/google_util.h"
11 #include "components/omnibox/browser/omnibox_field_trial.h" 11 #include "components/omnibox/browser/omnibox_field_trial.h"
12 #include "components/search/search.h" 12 #include "components/search/search.h"
13 #include "components/version_info/version_info.h" 13 #include "components/version_info/version_info.h"
14 #include "ios/chrome/browser/application_context.h" 14 #include "ios/chrome/browser/application_context.h"
15 #include "ios/chrome/browser/experimental_flags.h" 15 #include "ios/chrome/browser/experimental_flags.h"
16 #include "ios/chrome/browser/google/google_brand.h" 16 #include "ios/chrome/browser/google/google_brand.h"
17 #include "ios/chrome/browser/google/google_url_tracker_factory.h" 17 #include "ios/chrome/browser/google/google_url_tracker_factory.h"
18 #include "ios/chrome/common/channel_info.h" 18 #include "ios/chrome/common/channel_info.h"
19 #include "ios/web/public/web_thread.h" 19 #include "ios/web/public/web_thread.h"
20 #include "net/base/escape.h" 20 #include "net/base/escape.h"
21 #include "rlz/features/features.h"
21 #include "url/gurl.h" 22 #include "url/gurl.h"
22 23
23 #if defined(ENABLE_RLZ) 24 #if BUILDFLAG(ENABLE_RLZ)
24 #include "components/rlz/rlz_tracker.h" // nogncheck 25 #include "components/rlz/rlz_tracker.h" // nogncheck
25 #endif 26 #endif
26 27
27 namespace ios { 28 namespace ios {
28 29
29 UIThreadSearchTermsData::UIThreadSearchTermsData( 30 UIThreadSearchTermsData::UIThreadSearchTermsData(
30 ios::ChromeBrowserState* browser_state) 31 ios::ChromeBrowserState* browser_state)
31 : browser_state_(browser_state) { 32 : browser_state_(browser_state) {
32 DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) || 33 DCHECK(!web::WebThread::IsThreadInitialized(web::WebThread::UI) ||
33 web::WebThread::CurrentlyOn(web::WebThread::UI)); 34 web::WebThread::CurrentlyOn(web::WebThread::UI));
(...skipping 19 matching lines...) Expand all
53 std::string UIThreadSearchTermsData::GetApplicationLocale() const { 54 std::string UIThreadSearchTermsData::GetApplicationLocale() const {
54 DCHECK(thread_checker_.CalledOnValidThread()); 55 DCHECK(thread_checker_.CalledOnValidThread());
55 return GetApplicationContext()->GetApplicationLocale(); 56 return GetApplicationContext()->GetApplicationLocale();
56 } 57 }
57 58
58 base::string16 UIThreadSearchTermsData::GetRlzParameterValue( 59 base::string16 UIThreadSearchTermsData::GetRlzParameterValue(
59 bool from_app_list) const { 60 bool from_app_list) const {
60 DCHECK(!from_app_list); 61 DCHECK(!from_app_list);
61 DCHECK(thread_checker_.CalledOnValidThread()); 62 DCHECK(thread_checker_.CalledOnValidThread());
62 base::string16 rlz_string; 63 base::string16 rlz_string;
63 #if defined(ENABLE_RLZ) 64 #if BUILDFLAG(ENABLE_RLZ)
64 // For organic brandcode do not use rlz at all. 65 // For organic brandcode do not use rlz at all.
65 std::string brand; 66 std::string brand;
66 if (ios::google_brand::GetBrand(&brand) && 67 if (ios::google_brand::GetBrand(&brand) &&
67 !ios::google_brand::IsOrganic(brand)) { 68 !ios::google_brand::IsOrganic(brand)) {
68 // This call will may return false until the value has been cached. This 69 // This call will may return false until the value has been cached. This
69 // normally would mean that a few omnibox searches might not send the RLZ 70 // normally would mean that a few omnibox searches might not send the RLZ
70 // data but this is not really a problem (as the value will eventually be 71 // data but this is not really a problem (as the value will eventually be
71 // set and cached). 72 // set and cached).
72 rlz::RLZTracker::GetAccessPointRlz(rlz::RLZTracker::ChromeOmnibox(), 73 rlz::RLZTracker::GetAccessPointRlz(rlz::RLZTracker::ChromeOmnibox(),
73 &rlz_string); 74 &rlz_string);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 if (version_info::IsOfficialBuild()) 110 if (version_info::IsOfficialBuild())
110 version += " (Official)"; 111 version += " (Official)";
111 version += " " + version_info::GetOSType(); 112 version += " " + version_info::GetOSType();
112 std::string modifier(GetChannelString()); 113 std::string modifier(GetChannelString());
113 if (!modifier.empty()) 114 if (!modifier.empty())
114 version += " " + modifier; 115 version += " " + modifier;
115 return version; 116 return version;
116 } 117 }
117 118
118 } // namespace ios 119 } // namespace ios
OLDNEW
« no previous file with comments | « ios/chrome/browser/search_engines/template_url_service_factory.cc ('k') | rlz/features/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698