| 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) |
| 122 return OmniboxFieldTrial::EnableAnswersInSuggest() ? | 122 return "chrome-mobile-ext-ansg"; |
| 123 "chrome-mobile-ext-ansg" : "chrome-mobile-ext"; | |
| 124 } | |
| 125 #endif | 123 #endif |
| 126 return OmniboxFieldTrial::EnableAnswersInSuggest() ? | 124 return "chrome-ext-ansg"; |
| 127 "chrome-ext-ansg" : "chrome-ext"; | |
| 128 } | |
| 129 | |
| 130 bool UIThreadSearchTermsData::EnableAnswersInSuggest() const { | |
| 131 return OmniboxFieldTrial::EnableAnswersInSuggest(); | |
| 132 } | 125 } |
| 133 | 126 |
| 134 bool UIThreadSearchTermsData::IsShowingSearchTermsOnSearchResultsPages() const { | 127 bool UIThreadSearchTermsData::IsShowingSearchTermsOnSearchResultsPages() const { |
| 135 return chrome::IsInstantExtendedAPIEnabled() && | 128 return chrome::IsInstantExtendedAPIEnabled() && |
| 136 chrome::IsQueryExtractionEnabled(); | 129 chrome::IsQueryExtractionEnabled(); |
| 137 } | 130 } |
| 138 | 131 |
| 139 std::string UIThreadSearchTermsData::InstantExtendedEnabledParam( | 132 std::string UIThreadSearchTermsData::InstantExtendedEnabledParam( |
| 140 bool for_search) const { | 133 bool for_search) const { |
| 141 return chrome::InstantExtendedEnabledParam(for_search); | 134 return chrome::InstantExtendedEnabledParam(for_search); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 if (!modifier.empty()) | 179 if (!modifier.empty()) |
| 187 version += " " + modifier; | 180 version += " " + modifier; |
| 188 return version; | 181 return version; |
| 189 } | 182 } |
| 190 | 183 |
| 191 // static | 184 // static |
| 192 void UIThreadSearchTermsData::SetGoogleBaseURL(const std::string& base_url) { | 185 void UIThreadSearchTermsData::SetGoogleBaseURL(const std::string& base_url) { |
| 193 delete google_base_url_; | 186 delete google_base_url_; |
| 194 google_base_url_ = base_url.empty() ? NULL : new std::string(base_url); | 187 google_base_url_ = base_url.empty() ? NULL : new std::string(base_url); |
| 195 } | 188 } |
| OLD | NEW |