OLD | NEW |
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/google/google_brand.h" | 16 #include "ios/chrome/browser/google/google_brand.h" |
16 #include "ios/chrome/browser/google/google_url_tracker_factory.h" | 17 #include "ios/chrome/browser/google/google_url_tracker_factory.h" |
17 #include "ios/chrome/common/channel_info.h" | 18 #include "ios/chrome/common/channel_info.h" |
18 #include "ios/web/public/web_thread.h" | 19 #include "ios/web/public/web_thread.h" |
| 20 #include "net/base/escape.h" |
19 #include "url/gurl.h" | 21 #include "url/gurl.h" |
20 | 22 |
21 #if defined(ENABLE_RLZ) | 23 #if defined(ENABLE_RLZ) |
22 #include "components/rlz/rlz_tracker.h" | 24 #include "components/rlz/rlz_tracker.h" |
23 #endif | 25 #endif |
24 | 26 |
25 namespace ios { | 27 namespace ios { |
26 | 28 |
27 UIThreadSearchTermsData::UIThreadSearchTermsData( | 29 UIThreadSearchTermsData::UIThreadSearchTermsData( |
28 ios::ChromeBrowserState* browser_state) | 30 ios::ChromeBrowserState* browser_state) |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // iOS has not InstantService. | 114 // iOS has not InstantService. |
113 return search::kDisableStartMargin; | 115 return search::kDisableStartMargin; |
114 } | 116 } |
115 | 117 |
116 std::string UIThreadSearchTermsData::NTPIsThemedParam() const { | 118 std::string UIThreadSearchTermsData::NTPIsThemedParam() const { |
117 DCHECK(thread_checker_.CalledOnValidThread()); | 119 DCHECK(thread_checker_.CalledOnValidThread()); |
118 // iOS does not supports themed NTP. | 120 // iOS does not supports themed NTP. |
119 return std::string(); | 121 return std::string(); |
120 } | 122 } |
121 | 123 |
| 124 std::string UIThreadSearchTermsData::IOSWebViewTypeParam() const { |
| 125 DCHECK(thread_checker_.CalledOnValidThread()); |
| 126 std::string param = experimental_flags::GetWKWebViewSearchParams(); |
| 127 if (param.empty()) { |
| 128 return std::string(); |
| 129 } |
| 130 |
| 131 return "&esrch=" + net::EscapeQueryParamValue(param, true); |
| 132 } |
| 133 |
122 std::string UIThreadSearchTermsData::GoogleImageSearchSource() const { | 134 std::string UIThreadSearchTermsData::GoogleImageSearchSource() const { |
123 DCHECK(thread_checker_.CalledOnValidThread()); | 135 DCHECK(thread_checker_.CalledOnValidThread()); |
124 std::string version(version_info::GetProductName() + " " + | 136 std::string version(version_info::GetProductName() + " " + |
125 version_info::GetVersionNumber()); | 137 version_info::GetVersionNumber()); |
126 if (version_info::IsOfficialBuild()) | 138 if (version_info::IsOfficialBuild()) |
127 version += " (Official)"; | 139 version += " (Official)"; |
128 version += " " + version_info::GetOSType(); | 140 version += " " + version_info::GetOSType(); |
129 std::string modifier(GetChannelString()); | 141 std::string modifier(GetChannelString()); |
130 if (!modifier.empty()) | 142 if (!modifier.empty()) |
131 version += " " + modifier; | 143 version += " " + modifier; |
132 return version; | 144 return version; |
133 } | 145 } |
134 | 146 |
135 } // namespace ios | 147 } // namespace ios |
OLD | NEW |