| 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" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/google/google_brand.h" | 12 #include "chrome/browser/google/google_brand.h" |
| 13 #include "chrome/browser/google/google_profile_helper.h" | 13 #include "chrome/browser/google/google_profile_helper.h" |
| 14 #include "chrome/browser/omnibox/omnibox_field_trial.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/search/search.h" | 16 #include "chrome/browser/search/search.h" |
| 16 #include "chrome/browser/sync/glue/device_info.h" | 17 #include "chrome/browser/sync/glue/device_info.h" |
| 17 #include "chrome/browser/themes/theme_service.h" | 18 #include "chrome/browser/themes/theme_service.h" |
| 18 #include "chrome/browser/themes/theme_service_factory.h" | 19 #include "chrome/browser/themes/theme_service_factory.h" |
| 19 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
| 20 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
| 21 #include "components/google/core/browser/google_util.h" | 22 #include "components/google/core/browser/google_util.h" |
| 22 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 23 #include "sync/protocol/sync.pb.h" | 24 #include "sync/protocol/sync.pb.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 #endif | 108 #endif |
| 108 } | 109 } |
| 109 | 110 |
| 110 std::string UIThreadSearchTermsData::GetSuggestRequestIdentifier() const { | 111 std::string UIThreadSearchTermsData::GetSuggestRequestIdentifier() const { |
| 111 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) || | 112 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) || |
| 112 BrowserThread::CurrentlyOn(BrowserThread::UI)); | 113 BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 113 #if defined(OS_ANDROID) | 114 #if defined(OS_ANDROID) |
| 114 sync_pb::SyncEnums::DeviceType device_type = | 115 sync_pb::SyncEnums::DeviceType device_type = |
| 115 browser_sync::DeviceInfo::GetLocalDeviceType(); | 116 browser_sync::DeviceInfo::GetLocalDeviceType(); |
| 116 if (device_type == sync_pb::SyncEnums_DeviceType_TYPE_PHONE) { | 117 if (device_type == sync_pb::SyncEnums_DeviceType_TYPE_PHONE) { |
| 117 if (CommandLine::ForCurrentProcess()->HasSwitch( | 118 return OmniboxFieldTrial::EnableAnswersInSuggest() ? |
| 118 switches::kEnableAnswersInSuggest)) { | 119 "chrome-mobile-ext-ansg" : "chrome-mobile-ext"; |
| 119 return "chrome-mobile-ext-ansg"; | |
| 120 } else { | |
| 121 return "chrome-mobile-ext"; | |
| 122 } | |
| 123 } | 120 } |
| 124 return "chrome-ext"; | 121 return "chrome-ext"; |
| 125 #else | 122 #else |
| 126 return "chrome-ext"; | 123 return "chrome-ext"; |
| 127 #endif | 124 #endif |
| 128 } | 125 } |
| 129 | 126 |
| 130 std::string UIThreadSearchTermsData::NTPIsThemedParam() const { | 127 std::string UIThreadSearchTermsData::NTPIsThemedParam() const { |
| 131 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) || | 128 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) || |
| 132 BrowserThread::CurrentlyOn(BrowserThread::UI)); | 129 BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 144 #endif // defined(ENABLE_THEMES) | 141 #endif // defined(ENABLE_THEMES) |
| 145 | 142 |
| 146 return std::string(); | 143 return std::string(); |
| 147 } | 144 } |
| 148 | 145 |
| 149 // static | 146 // static |
| 150 void UIThreadSearchTermsData::SetGoogleBaseURL(const std::string& base_url) { | 147 void UIThreadSearchTermsData::SetGoogleBaseURL(const std::string& base_url) { |
| 151 delete google_base_url_; | 148 delete google_base_url_; |
| 152 google_base_url_ = base_url.empty() ? NULL : new std::string(base_url); | 149 google_base_url_ = base_url.empty() ? NULL : new std::string(base_url); |
| 153 } | 150 } |
| OLD | NEW |