Chromium Code Reviews| 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" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 "chrome" : "chrome-omni"; | 111 "chrome" : "chrome-omni"; |
| 112 #else | 112 #else |
| 113 return chrome::IsInstantExtendedAPIEnabled() ? "chrome-omni" : "chrome"; | 113 return chrome::IsInstantExtendedAPIEnabled() ? "chrome-omni" : "chrome"; |
| 114 #endif | 114 #endif |
| 115 } | 115 } |
| 116 | 116 |
| 117 std::string UIThreadSearchTermsData::GetSuggestRequestIdentifier() const { | 117 std::string UIThreadSearchTermsData::GetSuggestRequestIdentifier() const { |
| 118 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) || | 118 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) || |
| 119 BrowserThread::CurrentlyOn(BrowserThread::UI)); | 119 BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 120 #if defined(OS_ANDROID) | 120 #if defined(OS_ANDROID) |
| 121 if (ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_PHONE) { | 121 if (ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_PHONE) { |
|
Peter Kasting
2015/07/10 18:33:22
Nit: Remove {}
Justin Donnelly
2015/07/10 19:15:03
Done.
| |
| 122 return OmniboxFieldTrial::EnableAnswersInSuggest() ? | 122 return "chrome-mobile-ext-ansg"; |
| 123 "chrome-mobile-ext-ansg" : "chrome-mobile-ext"; | |
| 124 } | 123 } |
| 125 #endif | 124 #endif |
| 126 return OmniboxFieldTrial::EnableAnswersInSuggest() ? | 125 return "chrome-ext-ansg"; |
| 127 "chrome-ext-ansg" : "chrome-ext"; | |
| 128 } | |
| 129 | |
| 130 bool UIThreadSearchTermsData::EnableAnswersInSuggest() const { | |
| 131 return OmniboxFieldTrial::EnableAnswersInSuggest(); | |
| 132 } | 126 } |
| 133 | 127 |
| 134 bool UIThreadSearchTermsData::IsShowingSearchTermsOnSearchResultsPages() const { | 128 bool UIThreadSearchTermsData::IsShowingSearchTermsOnSearchResultsPages() const { |
| 135 return chrome::IsInstantExtendedAPIEnabled() && | 129 return chrome::IsInstantExtendedAPIEnabled() && |
| 136 chrome::IsQueryExtractionEnabled(); | 130 chrome::IsQueryExtractionEnabled(); |
| 137 } | 131 } |
| 138 | 132 |
| 139 std::string UIThreadSearchTermsData::InstantExtendedEnabledParam( | 133 std::string UIThreadSearchTermsData::InstantExtendedEnabledParam( |
| 140 bool for_search) const { | 134 bool for_search) const { |
| 141 return chrome::InstantExtendedEnabledParam(for_search); | 135 return chrome::InstantExtendedEnabledParam(for_search); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 186 if (!modifier.empty()) | 180 if (!modifier.empty()) |
| 187 version += " " + modifier; | 181 version += " " + modifier; |
| 188 return version; | 182 return version; |
| 189 } | 183 } |
| 190 | 184 |
| 191 // static | 185 // static |
| 192 void UIThreadSearchTermsData::SetGoogleBaseURL(const std::string& base_url) { | 186 void UIThreadSearchTermsData::SetGoogleBaseURL(const std::string& base_url) { |
| 193 delete google_base_url_; | 187 delete google_base_url_; |
| 194 google_base_url_ = base_url.empty() ? NULL : new std::string(base_url); | 188 google_base_url_ = base_url.empty() ? NULL : new std::string(base_url); |
| 195 } | 189 } |
| OLD | NEW |