| 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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 136 |
| 137 std::string UIThreadSearchTermsData::InstantEnabledParam() const { | 137 std::string UIThreadSearchTermsData::InstantEnabledParam() const { |
| 138 DCHECK(!BrowserThread::IsWellKnownThread(BrowserThread::UI) || | 138 DCHECK(!BrowserThread::IsWellKnownThread(BrowserThread::UI) || |
| 139 BrowserThread::CurrentlyOn(BrowserThread::UI)); | 139 BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 140 return chrome::IsInstantExtendedAPIEnabled() ? std::string() : "ion=1&"; | 140 return chrome::IsInstantExtendedAPIEnabled() ? std::string() : "ion=1&"; |
| 141 } | 141 } |
| 142 | 142 |
| 143 std::string UIThreadSearchTermsData::InstantExtendedEnabledParam() const { | 143 std::string UIThreadSearchTermsData::InstantExtendedEnabledParam() const { |
| 144 DCHECK(!BrowserThread::IsWellKnownThread(BrowserThread::UI) || | 144 DCHECK(!BrowserThread::IsWellKnownThread(BrowserThread::UI) || |
| 145 BrowserThread::CurrentlyOn(BrowserThread::UI)); | 145 BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 146 uint64 instant_extended_api_version = chrome::EmbeddedSearchPageVersion(); | 146 uint64 instant_extended_api_version = |
| 147 chrome::EmbeddedSearchPageVersion(profile_); |
| 147 if (instant_extended_api_version) { | 148 if (instant_extended_api_version) { |
| 148 return std::string(google_util::kInstantExtendedAPIParam) + "=" + | 149 return std::string(google_util::kInstantExtendedAPIParam) + "=" + |
| 149 base::Uint64ToString(instant_extended_api_version) + "&"; | 150 base::Uint64ToString(instant_extended_api_version) + "&"; |
| 150 } | 151 } |
| 151 return std::string(); | 152 return std::string(); |
| 152 } | 153 } |
| 153 | 154 |
| 154 std::string UIThreadSearchTermsData::NTPIsThemedParam() const { | 155 std::string UIThreadSearchTermsData::NTPIsThemedParam() const { |
| 155 DCHECK(!BrowserThread::IsWellKnownThread(BrowserThread::UI) || | 156 DCHECK(!BrowserThread::IsWellKnownThread(BrowserThread::UI) || |
| 156 BrowserThread::CurrentlyOn(BrowserThread::UI)); | 157 BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 157 #if defined(ENABLE_THEMES) | 158 #if defined(ENABLE_THEMES) |
| 158 if (!chrome::IsInstantExtendedAPIEnabled()) | 159 if (!chrome::IsInstantExtendedAPIEnabled()) |
| 159 return std::string(); | 160 return std::string(); |
| 160 | 161 |
| 161 // TODO(dhollowa): Determine fraction of custom themes that don't affect the | 162 // TODO(dhollowa): Determine fraction of custom themes that don't affect the |
| 162 // NTP background and/or color. | 163 // NTP background and/or color. |
| 163 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile_); | 164 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile_); |
| 164 if (theme_service && !theme_service->UsingDefaultTheme()) | 165 if (theme_service && !theme_service->UsingDefaultTheme()) |
| 165 return "es_th=1&"; | 166 return "es_th=1&"; |
| 166 #endif // defined(ENABLE_THEMES) | 167 #endif // defined(ENABLE_THEMES) |
| 167 | 168 |
| 168 return std::string(); | 169 return std::string(); |
| 169 } | 170 } |
| 170 | 171 |
| 171 // static | 172 // static |
| 172 void UIThreadSearchTermsData::SetGoogleBaseURL(const std::string& base_url) { | 173 void UIThreadSearchTermsData::SetGoogleBaseURL(const std::string& base_url) { |
| 173 delete google_base_url_; | 174 delete google_base_url_; |
| 174 google_base_url_ = base_url.empty() ? NULL : new std::string(base_url); | 175 google_base_url_ = base_url.empty() ? NULL : new std::string(base_url); |
| 175 } | 176 } |
| OLD | NEW |