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