| 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 "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 std::string UIThreadSearchTermsData::GetSuggestRequestIdentifier() const { | 116 std::string UIThreadSearchTermsData::GetSuggestRequestIdentifier() const { |
| 117 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) || | 117 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) || |
| 118 BrowserThread::CurrentlyOn(BrowserThread::UI)); | 118 BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 119 #if defined(OS_ANDROID) | 119 #if defined(OS_ANDROID) |
| 120 if (ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_PHONE) | 120 if (ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_PHONE) |
| 121 return "chrome-mobile-ext-ansg"; | 121 return "chrome-mobile-ext-ansg"; |
| 122 #endif | 122 #endif |
| 123 return "chrome-ext-ansg"; | 123 return "chrome-ext-ansg"; |
| 124 } | 124 } |
| 125 | 125 |
| 126 std::string UIThreadSearchTermsData::InstantExtendedEnabledParam( | 126 std::string UIThreadSearchTermsData::InstantExtendedEnabledParam() const { |
| 127 bool for_search) const { | 127 return search::InstantExtendedEnabledParam(); |
| 128 return search::InstantExtendedEnabledParam(for_search); | |
| 129 } | 128 } |
| 130 | 129 |
| 131 std::string UIThreadSearchTermsData::ForceInstantResultsParam( | 130 std::string UIThreadSearchTermsData::ForceInstantResultsParam( |
| 132 bool for_prerender) const { | 131 bool for_prerender) const { |
| 133 return search::ForceInstantResultsParam(for_prerender); | 132 return search::ForceInstantResultsParam(for_prerender); |
| 134 } | 133 } |
| 135 | 134 |
| 136 // It's acutally OK to call this method on any thread, but it's currently placed | 135 // It's acutally OK to call this method on any thread, but it's currently placed |
| 137 // in UIThreadSearchTermsData since SearchTermsData cannot depend on src/chrome | 136 // in UIThreadSearchTermsData since SearchTermsData cannot depend on src/chrome |
| 138 // as it is shared with iOS. | 137 // as it is shared with iOS. |
| 139 std::string UIThreadSearchTermsData::GoogleImageSearchSource() const { | 138 std::string UIThreadSearchTermsData::GoogleImageSearchSource() const { |
| 140 std::string version(version_info::GetProductName() + " " + | 139 std::string version(version_info::GetProductName() + " " + |
| 141 version_info::GetVersionNumber()); | 140 version_info::GetVersionNumber()); |
| 142 if (version_info::IsOfficialBuild()) | 141 if (version_info::IsOfficialBuild()) |
| 143 version += " (Official)"; | 142 version += " (Official)"; |
| 144 version += " " + version_info::GetOSType(); | 143 version += " " + version_info::GetOSType(); |
| 145 std::string modifier(chrome::GetChannelString()); | 144 std::string modifier(chrome::GetChannelString()); |
| 146 if (!modifier.empty()) | 145 if (!modifier.empty()) |
| 147 version += " " + modifier; | 146 version += " " + modifier; |
| 148 return version; | 147 return version; |
| 149 } | 148 } |
| 150 | 149 |
| 151 // static | 150 // static |
| 152 void UIThreadSearchTermsData::SetGoogleBaseURL(const std::string& base_url) { | 151 void UIThreadSearchTermsData::SetGoogleBaseURL(const std::string& base_url) { |
| 153 delete google_base_url_; | 152 delete google_base_url_; |
| 154 google_base_url_ = base_url.empty() ? NULL : new std::string(base_url); | 153 google_base_url_ = base_url.empty() ? NULL : new std::string(base_url); |
| 155 } | 154 } |
| OLD | NEW |