OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui_thread_search_terms_data.h" | 5 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/google/google_brand.h" | 12 #include "chrome/browser/google/google_brand.h" |
13 #include "chrome/browser/google/google_url_tracker_factory.h" | 13 #include "chrome/browser/google/google_url_tracker_factory.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/search/instant_service.h" | 15 #include "chrome/browser/search/instant_service.h" |
16 #include "chrome/browser/search/instant_service_factory.h" | 16 #include "chrome/browser/search/instant_service_factory.h" |
17 #include "chrome/browser/search/search.h" | 17 #include "chrome/browser/search/search.h" |
18 #include "chrome/browser/themes/theme_service.h" | 18 #include "chrome/browser/themes/theme_service.h" |
19 #include "chrome/browser/themes/theme_service_factory.h" | 19 #include "chrome/browser/themes/theme_service_factory.h" |
| 20 #include "chrome/common/channel_info.h" |
20 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
21 #include "chrome/common/chrome_version_info.h" | |
22 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
23 #include "components/google/core/browser/google_url_tracker.h" | 23 #include "components/google/core/browser/google_url_tracker.h" |
24 #include "components/google/core/browser/google_util.h" | 24 #include "components/google/core/browser/google_util.h" |
25 #include "components/omnibox/browser/omnibox_field_trial.h" | 25 #include "components/omnibox/browser/omnibox_field_trial.h" |
26 #include "components/search/search.h" | 26 #include "components/search/search.h" |
| 27 #include "components/version_info/version_info.h" |
27 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
28 #include "ui/base/device_form_factor.h" | 29 #include "ui/base/device_form_factor.h" |
29 #include "url/gurl.h" | 30 #include "url/gurl.h" |
30 | 31 |
31 #if defined(ENABLE_RLZ) | 32 #if defined(ENABLE_RLZ) |
32 #include "components/rlz/rlz_tracker.h" | 33 #include "components/rlz/rlz_tracker.h" |
33 #endif | 34 #endif |
34 | 35 |
35 using content::BrowserThread; | 36 using content::BrowserThread; |
36 | 37 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // NTP is considered themed if the theme is not default and not native (GTK+). | 162 // NTP is considered themed if the theme is not default and not native (GTK+). |
162 if (theme_service && !theme_service->UsingDefaultTheme() && | 163 if (theme_service && !theme_service->UsingDefaultTheme() && |
163 !theme_service->UsingSystemTheme()) | 164 !theme_service->UsingSystemTheme()) |
164 return "es_th=1&"; | 165 return "es_th=1&"; |
165 #endif // defined(ENABLE_THEMES) | 166 #endif // defined(ENABLE_THEMES) |
166 | 167 |
167 return std::string(); | 168 return std::string(); |
168 } | 169 } |
169 | 170 |
170 // It's acutally OK to call this method on any thread, but it's currently placed | 171 // It's acutally OK to call this method on any thread, but it's currently placed |
171 // in UIThreadSearchTermsData since SearchTermsData cannot depend on | 172 // in UIThreadSearchTermsData since SearchTermsData cannot depend on src/chrome |
172 // VersionInfo. | 173 // as it is shared with iOS. |
173 std::string UIThreadSearchTermsData::GoogleImageSearchSource() const { | 174 std::string UIThreadSearchTermsData::GoogleImageSearchSource() const { |
174 chrome::VersionInfo version_info; | 175 std::string version(version_info::GetProductName() + " " + |
175 std::string version(version_info.Name() + " " + version_info.Version()); | 176 version_info::GetVersionNumber()); |
176 if (version_info.IsOfficialBuild()) | 177 if (version_info::IsOfficialBuild()) |
177 version += " (Official)"; | 178 version += " (Official)"; |
178 version += " " + version_info.OSType(); | 179 version += " " + version_info::GetOSType(); |
179 std::string modifier(version_info.GetVersionStringModifier()); | 180 std::string modifier(chrome::GetChannelString()); |
180 if (!modifier.empty()) | 181 if (!modifier.empty()) |
181 version += " " + modifier; | 182 version += " " + modifier; |
182 return version; | 183 return version; |
183 } | 184 } |
184 | 185 |
185 std::string UIThreadSearchTermsData::GetAcceptLanguages() const { | 186 std::string UIThreadSearchTermsData::GetAcceptLanguages() const { |
186 return profile_ ? profile_->GetPrefs()->GetString(prefs::kAcceptLanguages) | 187 return profile_ ? profile_->GetPrefs()->GetString(prefs::kAcceptLanguages) |
187 : std::string(); | 188 : std::string(); |
188 } | 189 } |
189 | 190 |
190 // static | 191 // static |
191 void UIThreadSearchTermsData::SetGoogleBaseURL(const std::string& base_url) { | 192 void UIThreadSearchTermsData::SetGoogleBaseURL(const std::string& base_url) { |
192 delete google_base_url_; | 193 delete google_base_url_; |
193 google_base_url_ = base_url.empty() ? NULL : new std::string(base_url); | 194 google_base_url_ = base_url.empty() ? NULL : new std::string(base_url); |
194 } | 195 } |
OLD | NEW |