Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/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_profile_helper.h" | |
| 12 #include "chrome/browser/google/google_url_tracker.h" | 13 #include "chrome/browser/google/google_url_tracker.h" |
| 13 #include "chrome/browser/google/google_util.h" | 14 #include "chrome/browser/google/google_util.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/search/search.h" | 16 #include "chrome/browser/search/search.h" |
| 16 #include "chrome/browser/sync/glue/device_info.h" | 17 #include "chrome/browser/sync/glue/device_info.h" |
| 17 #include "chrome/browser/themes/theme_service.h" | 18 #include "chrome/browser/themes/theme_service.h" |
| 18 #include "chrome/browser/themes/theme_service_factory.h" | 19 #include "chrome/browser/themes/theme_service_factory.h" |
| 19 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
| 20 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
| 21 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 } | 93 } |
| 93 | 94 |
| 94 std::string UIThreadSearchTermsData::GoogleBaseURLValue() const { | 95 std::string UIThreadSearchTermsData::GoogleBaseURLValue() const { |
| 95 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) || | 96 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) || |
| 96 BrowserThread::CurrentlyOn(BrowserThread::UI)); | 97 BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 97 if (google_base_url_) | 98 if (google_base_url_) |
| 98 return *google_base_url_; | 99 return *google_base_url_; |
| 99 GURL base_url(google_util::CommandLineGoogleBaseURL()); | 100 GURL base_url(google_util::CommandLineGoogleBaseURL()); |
| 100 if (base_url.is_valid()) | 101 if (base_url.is_valid()) |
| 101 return base_url.spec(); | 102 return base_url.spec(); |
| 102 return profile_ ? GoogleURLTracker::GoogleURL(profile_).spec() : | 103 return profile_ ? google_profile_helper::GetGoogleHomePageURL(profile_).spec() |
| 103 SearchTermsData::GoogleBaseURLValue(); | 104 : SearchTermsData::GoogleBaseURLValue(); |
|
Peter Kasting
2014/05/30 20:50:39
Nit: Wrap like:
return profile_ ?
google_
blundell
2014/06/02 15:42:26
Done.
| |
| 104 } | 105 } |
| 105 | 106 |
| 106 std::string UIThreadSearchTermsData::GetApplicationLocale() const { | 107 std::string UIThreadSearchTermsData::GetApplicationLocale() const { |
| 107 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) || | 108 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) || |
| 108 BrowserThread::CurrentlyOn(BrowserThread::UI)); | 109 BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 109 return g_browser_process->GetApplicationLocale(); | 110 return g_browser_process->GetApplicationLocale(); |
| 110 } | 111 } |
| 111 | 112 |
| 112 // Android implementations are located in search_terms_data_android.cc. | 113 // Android implementations are located in search_terms_data_android.cc. |
| 113 #if !defined(OS_ANDROID) | 114 #if !defined(OS_ANDROID) |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 196 #endif // defined(ENABLE_THEMES) | 197 #endif // defined(ENABLE_THEMES) |
| 197 | 198 |
| 198 return std::string(); | 199 return std::string(); |
| 199 } | 200 } |
| 200 | 201 |
| 201 // static | 202 // static |
| 202 void UIThreadSearchTermsData::SetGoogleBaseURL(const std::string& base_url) { | 203 void UIThreadSearchTermsData::SetGoogleBaseURL(const std::string& base_url) { |
| 203 delete google_base_url_; | 204 delete google_base_url_; |
| 204 google_base_url_ = base_url.empty() ? NULL : new std::string(base_url); | 205 google_base_url_ = base_url.empty() ? NULL : new std::string(base_url); |
| 205 } | 206 } |
| OLD | NEW |