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_profile_helper.h" | 13 #include "chrome/browser/google/google_profile_helper.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/search/search.h" | 15 #include "chrome/browser/search/search.h" |
16 #include "chrome/browser/sync/glue/device_info.h" | 16 #include "chrome/browser/sync/glue/device_info.h" |
17 #include "chrome/browser/themes/theme_service.h" | 17 #include "chrome/browser/themes/theme_service.h" |
18 #include "chrome/browser/themes/theme_service_factory.h" | 18 #include "chrome/browser/themes/theme_service_factory.h" |
19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
| 20 #include "chrome/common/chrome_version_info.h" |
20 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
21 #include "components/google/core/browser/google_util.h" | 22 #include "components/google/core/browser/google_util.h" |
22 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
23 #include "sync/protocol/sync.pb.h" | 24 #include "sync/protocol/sync.pb.h" |
24 #include "url/gurl.h" | 25 #include "url/gurl.h" |
25 | 26 |
26 #if defined(ENABLE_RLZ) | 27 #if defined(ENABLE_RLZ) |
27 #include "chrome/browser/rlz/rlz.h" | 28 #include "chrome/browser/rlz/rlz.h" |
28 #endif | 29 #endif |
29 | 30 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile_); | 140 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile_); |
140 // NTP is considered themed if the theme is not default and not native (GTK+). | 141 // NTP is considered themed if the theme is not default and not native (GTK+). |
141 if (theme_service && !theme_service->UsingDefaultTheme() && | 142 if (theme_service && !theme_service->UsingDefaultTheme() && |
142 !theme_service->UsingSystemTheme()) | 143 !theme_service->UsingSystemTheme()) |
143 return "es_th=1&"; | 144 return "es_th=1&"; |
144 #endif // defined(ENABLE_THEMES) | 145 #endif // defined(ENABLE_THEMES) |
145 | 146 |
146 return std::string(); | 147 return std::string(); |
147 } | 148 } |
148 | 149 |
| 150 // It's acutally OK to call this method on any thread, but it's currently placed |
| 151 // in UIThreadSearchTermsData since SearchTermsData cannot depend on |
| 152 // VersionInfo. |
| 153 std::string UIThreadSearchTermsData::GoogleImageSearchSource() const { |
| 154 chrome::VersionInfo version_info; |
| 155 if (version_info.is_valid()) { |
| 156 std::string version(version_info.Name() + " " + version_info.Version()); |
| 157 if (version_info.IsOfficialBuild()) |
| 158 version += " (Official)"; |
| 159 version += " " + version_info.OSType(); |
| 160 std::string modifier(version_info.GetVersionStringModifier()); |
| 161 if (!modifier.empty()) |
| 162 version += " " + modifier; |
| 163 return version; |
| 164 } |
| 165 return "unknown"; |
| 166 } |
| 167 |
149 // static | 168 // static |
150 void UIThreadSearchTermsData::SetGoogleBaseURL(const std::string& base_url) { | 169 void UIThreadSearchTermsData::SetGoogleBaseURL(const std::string& base_url) { |
151 delete google_base_url_; | 170 delete google_base_url_; |
152 google_base_url_ = base_url.empty() ? NULL : new std::string(base_url); | 171 google_base_url_ = base_url.empty() ? NULL : new std::string(base_url); |
153 } | 172 } |
OLD | NEW |