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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 } | 71 } |
72 | 72 |
73 std::string SearchTermsData::GetSuggestClient() const { | 73 std::string SearchTermsData::GetSuggestClient() const { |
74 return std::string(); | 74 return std::string(); |
75 } | 75 } |
76 | 76 |
77 std::string SearchTermsData::GetSuggestRequestIdentifier() const { | 77 std::string SearchTermsData::GetSuggestRequestIdentifier() const { |
78 return std::string(); | 78 return std::string(); |
79 } | 79 } |
80 | 80 |
81 std::string SearchTermsData::ForceInstantResultsParam( | |
82 bool for_prerender) const { | |
83 return std::string(); | |
84 } | |
85 | |
86 std::string SearchTermsData::NTPIsThemedParam() const { | 81 std::string SearchTermsData::NTPIsThemedParam() const { |
87 return std::string(); | 82 return std::string(); |
88 } | 83 } |
89 | 84 |
90 // static | 85 // static |
91 std::string* UIThreadSearchTermsData::google_base_url_ = NULL; | 86 std::string* UIThreadSearchTermsData::google_base_url_ = NULL; |
92 | 87 |
93 UIThreadSearchTermsData::UIThreadSearchTermsData(Profile* profile) | 88 UIThreadSearchTermsData::UIThreadSearchTermsData(Profile* profile) |
94 : profile_(profile) { | 89 : profile_(profile) { |
95 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) || | 90 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) || |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 #if defined(OS_ANDROID) | 160 #if defined(OS_ANDROID) |
166 sync_pb::SyncEnums::DeviceType device_type = | 161 sync_pb::SyncEnums::DeviceType device_type = |
167 browser_sync::DeviceInfo::GetLocalDeviceType(); | 162 browser_sync::DeviceInfo::GetLocalDeviceType(); |
168 return device_type == sync_pb::SyncEnums_DeviceType_TYPE_PHONE ? | 163 return device_type == sync_pb::SyncEnums_DeviceType_TYPE_PHONE ? |
169 "chrome-mobile-ext" : "chrome-ext"; | 164 "chrome-mobile-ext" : "chrome-ext"; |
170 #else | 165 #else |
171 return "chrome-ext"; | 166 return "chrome-ext"; |
172 #endif | 167 #endif |
173 } | 168 } |
174 | 169 |
175 std::string UIThreadSearchTermsData::ForceInstantResultsParam( | |
176 bool for_prerender) const { | |
177 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) || | |
178 BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
179 return (for_prerender || !chrome::IsInstantExtendedAPIEnabled()) ? "ion=1&" : | |
180 std::string(); | |
181 } | |
182 | |
183 std::string UIThreadSearchTermsData::NTPIsThemedParam() const { | 170 std::string UIThreadSearchTermsData::NTPIsThemedParam() const { |
184 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) || | 171 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) || |
185 BrowserThread::CurrentlyOn(BrowserThread::UI)); | 172 BrowserThread::CurrentlyOn(BrowserThread::UI)); |
186 #if defined(ENABLE_THEMES) | 173 #if defined(ENABLE_THEMES) |
187 if (!chrome::IsInstantExtendedAPIEnabled()) | 174 if (!chrome::IsInstantExtendedAPIEnabled()) |
188 return std::string(); | 175 return std::string(); |
189 | 176 |
190 // TODO(dhollowa): Determine fraction of custom themes that don't affect the | 177 // TODO(dhollowa): Determine fraction of custom themes that don't affect the |
191 // NTP background and/or color. | 178 // NTP background and/or color. |
192 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile_); | 179 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile_); |
193 // NTP is considered themed if the theme is not default and not native (GTK+). | 180 // NTP is considered themed if the theme is not default and not native (GTK+). |
194 if (theme_service && !theme_service->UsingDefaultTheme() && | 181 if (theme_service && !theme_service->UsingDefaultTheme() && |
195 !theme_service->UsingNativeTheme()) | 182 !theme_service->UsingNativeTheme()) |
196 return "es_th=1&"; | 183 return "es_th=1&"; |
197 #endif // defined(ENABLE_THEMES) | 184 #endif // defined(ENABLE_THEMES) |
198 | 185 |
199 return std::string(); | 186 return std::string(); |
200 } | 187 } |
201 | 188 |
202 // static | 189 // static |
203 void UIThreadSearchTermsData::SetGoogleBaseURL(const std::string& base_url) { | 190 void UIThreadSearchTermsData::SetGoogleBaseURL(const std::string& base_url) { |
204 delete google_base_url_; | 191 delete google_base_url_; |
205 google_base_url_ = base_url.empty() ? NULL : new std::string(base_url); | 192 google_base_url_ = base_url.empty() ? NULL : new std::string(base_url); |
206 } | 193 } |
OLD | NEW |