Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(493)

Side by Side Diff: chrome/browser/search_engines/ui_thread_search_terms_data.cc

Issue 1260033003: Partially componentize //chrome/browser/search/search.{h,cc} (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on iOS Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/search/search_unittest.cc ('k') | chrome/browser/sessions/session_restore.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 } 104 }
105 #endif 105 #endif
106 106
107 std::string UIThreadSearchTermsData::GetSuggestClient() const { 107 std::string UIThreadSearchTermsData::GetSuggestClient() const {
108 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) || 108 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) ||
109 BrowserThread::CurrentlyOn(BrowserThread::UI)); 109 BrowserThread::CurrentlyOn(BrowserThread::UI));
110 #if defined(OS_ANDROID) 110 #if defined(OS_ANDROID)
111 return ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_PHONE ? 111 return ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_PHONE ?
112 "chrome" : "chrome-omni"; 112 "chrome" : "chrome-omni";
113 #else 113 #else
114 return chrome::IsInstantExtendedAPIEnabled() ? "chrome-omni" : "chrome"; 114 return search::IsInstantExtendedAPIEnabled() ? "chrome-omni" : "chrome";
115 #endif 115 #endif
116 } 116 }
117 117
118 std::string UIThreadSearchTermsData::GetSuggestRequestIdentifier() const { 118 std::string UIThreadSearchTermsData::GetSuggestRequestIdentifier() const {
119 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) || 119 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) ||
120 BrowserThread::CurrentlyOn(BrowserThread::UI)); 120 BrowserThread::CurrentlyOn(BrowserThread::UI));
121 #if defined(OS_ANDROID) 121 #if defined(OS_ANDROID)
122 if (ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_PHONE) 122 if (ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_PHONE)
123 return "chrome-mobile-ext-ansg"; 123 return "chrome-mobile-ext-ansg";
124 #endif 124 #endif
125 return "chrome-ext-ansg"; 125 return "chrome-ext-ansg";
126 } 126 }
127 127
128 bool UIThreadSearchTermsData::IsShowingSearchTermsOnSearchResultsPages() const { 128 bool UIThreadSearchTermsData::IsShowingSearchTermsOnSearchResultsPages() const {
129 return chrome::IsInstantExtendedAPIEnabled() && 129 return search::IsInstantExtendedAPIEnabled() &&
130 chrome::IsQueryExtractionEnabled(); 130 search::IsQueryExtractionEnabled();
131 } 131 }
132 132
133 std::string UIThreadSearchTermsData::InstantExtendedEnabledParam( 133 std::string UIThreadSearchTermsData::InstantExtendedEnabledParam(
134 bool for_search) const { 134 bool for_search) const {
135 return chrome::InstantExtendedEnabledParam(for_search); 135 return search::InstantExtendedEnabledParam(for_search);
136 } 136 }
137 137
138 std::string UIThreadSearchTermsData::ForceInstantResultsParam( 138 std::string UIThreadSearchTermsData::ForceInstantResultsParam(
139 bool for_prerender) const { 139 bool for_prerender) const {
140 return chrome::ForceInstantResultsParam(for_prerender); 140 return search::ForceInstantResultsParam(for_prerender);
141 } 141 }
142 142
143 int UIThreadSearchTermsData::OmniboxStartMargin() const { 143 int UIThreadSearchTermsData::OmniboxStartMargin() const {
144 InstantService* instant_service = 144 InstantService* instant_service =
145 InstantServiceFactory::GetForProfile(profile_); 145 InstantServiceFactory::GetForProfile(profile_);
146 // Android and iOS have no InstantService. 146 // Android and iOS have no InstantService.
147 return instant_service ? 147 return instant_service ? instant_service->omnibox_start_margin()
148 instant_service->omnibox_start_margin() : chrome::kDisableStartMargin; 148 : search::kDisableStartMargin;
149 } 149 }
150 150
151 std::string UIThreadSearchTermsData::NTPIsThemedParam() const { 151 std::string UIThreadSearchTermsData::NTPIsThemedParam() const {
152 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) || 152 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) ||
153 BrowserThread::CurrentlyOn(BrowserThread::UI)); 153 BrowserThread::CurrentlyOn(BrowserThread::UI));
154 #if defined(ENABLE_THEMES) 154 #if defined(ENABLE_THEMES)
155 if (!chrome::IsInstantExtendedAPIEnabled()) 155 if (!search::IsInstantExtendedAPIEnabled())
156 return std::string(); 156 return std::string();
157 157
158 // TODO(dhollowa): Determine fraction of custom themes that don't affect the 158 // TODO(dhollowa): Determine fraction of custom themes that don't affect the
159 // NTP background and/or color. 159 // NTP background and/or color.
160 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile_); 160 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile_);
161 // NTP is considered themed if the theme is not default and not native (GTK+). 161 // NTP is considered themed if the theme is not default and not native (GTK+).
162 if (theme_service && !theme_service->UsingDefaultTheme() && 162 if (theme_service && !theme_service->UsingDefaultTheme() &&
163 !theme_service->UsingSystemTheme()) 163 !theme_service->UsingSystemTheme())
164 return "es_th=1&"; 164 return "es_th=1&";
165 #endif // defined(ENABLE_THEMES) 165 #endif // defined(ENABLE_THEMES)
(...skipping 19 matching lines...) Expand all
185 std::string UIThreadSearchTermsData::GetAcceptLanguages() const { 185 std::string UIThreadSearchTermsData::GetAcceptLanguages() const {
186 return profile_ ? profile_->GetPrefs()->GetString(prefs::kAcceptLanguages) 186 return profile_ ? profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)
187 : std::string(); 187 : std::string();
188 } 188 }
189 189
190 // static 190 // static
191 void UIThreadSearchTermsData::SetGoogleBaseURL(const std::string& base_url) { 191 void UIThreadSearchTermsData::SetGoogleBaseURL(const std::string& base_url) {
192 delete google_base_url_; 192 delete google_base_url_;
193 google_base_url_ = base_url.empty() ? NULL : new std::string(base_url); 193 google_base_url_ = base_url.empty() ? NULL : new std::string(base_url);
194 } 194 }
OLDNEW
« no previous file with comments | « chrome/browser/search/search_unittest.cc ('k') | chrome/browser/sessions/session_restore.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698