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

Side by Side Diff: chrome/browser/ui/search/search.cc

Issue 12319124: Enable query extraction for Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/search/search.h" 5 #include "chrome/browser/ui/search/search.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/string_split.h" 9 #include "base/string_split.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 if (cl->HasSwitch(switches::kEnableInstantExtendedAPI)) { 160 if (cl->HasSwitch(switches::kEnableInstantExtendedAPI)) {
161 // The user has manually flipped the about:flags switch - give the default 161 // The user has manually flipped the about:flags switch - give the default
162 // UI version. 162 // UI version.
163 return kEmbeddedPageVersionDefault; 163 return kEmbeddedPageVersionDefault;
164 } 164 }
165 165
166 return 0; 166 return 0;
167 } 167 }
168 168
169 bool IsQueryExtractionEnabled(const Profile* profile) { 169 bool IsQueryExtractionEnabled(const Profile* profile) {
170 #if defined(OS_IOS) 170 #if defined(OS_IOS) || defined(OS_ANDROID)
171 const CommandLine* cl = CommandLine::ForCurrentProcess(); 171 const CommandLine* cl = CommandLine::ForCurrentProcess();
172 return cl->HasSwitch(switches::kEnableQueryExtraction); 172 return cl->HasSwitch(switches::kEnableQueryExtraction);
173 #else 173 #else
174 // On desktop, query extraction is controlled by the instant-extended-api 174 // On desktop, query extraction is controlled by the instant-extended-api
175 // flag. 175 // flag.
176 return IsInstantExtendedAPIEnabled(profile); 176 return IsInstantExtendedAPIEnabled(profile);
177 #endif 177 #endif
178 } 178 }
179 179
180 string16 GetSearchTermsFromNavigationEntry( 180 string16 GetSearchTermsFromNavigationEntry(
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 IsInstantExtendedAPIEnabled(profile), 255 IsInstantExtendedAPIEnabled(profile),
256 template_url); 256 template_url);
257 } 257 }
258 258
259 void EnableInstantExtendedAPIForTesting() { 259 void EnableInstantExtendedAPIForTesting() {
260 CommandLine* cl = CommandLine::ForCurrentProcess(); 260 CommandLine* cl = CommandLine::ForCurrentProcess();
261 cl->AppendSwitch(switches::kEnableInstantExtendedAPI); 261 cl->AppendSwitch(switches::kEnableInstantExtendedAPI);
262 } 262 }
263 263
264 void EnableQueryExtractionForTesting() { 264 void EnableQueryExtractionForTesting() {
265 #if defined(OS_IOS) 265 #if defined(OS_IOS) || defined(OS_ANDROID)
266 CommandLine* cl = CommandLine::ForCurrentProcess(); 266 CommandLine* cl = CommandLine::ForCurrentProcess();
267 cl->AppendSwitch(switches::kEnableQueryExtraction); 267 cl->AppendSwitch(switches::kEnableQueryExtraction);
268 #else 268 #else
269 EnableInstantExtendedAPIForTesting(); 269 EnableInstantExtendedAPIForTesting();
270 #endif 270 #endif
271 } 271 }
272 272
273 bool ShouldAssignURLToInstantRendererImpl(const GURL& url, 273 bool ShouldAssignURLToInstantRendererImpl(const GURL& url,
274 bool extended_api_enabled, 274 bool extended_api_enabled,
275 TemplateURL* template_url) { 275 TemplateURL* template_url) {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 // Given a FieldTrialFlags object, returns the boolean value of the provided 365 // Given a FieldTrialFlags object, returns the boolean value of the provided
366 // flag. 366 // flag.
367 bool GetBoolValueForFlagWithDefault(const std::string& flag, 367 bool GetBoolValueForFlagWithDefault(const std::string& flag,
368 bool default_value, 368 bool default_value,
369 const FieldTrialFlags& flags) { 369 const FieldTrialFlags& flags) {
370 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); 370 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags);
371 } 371 }
372 372
373 } // namespace search 373 } // namespace search
374 } // namespace chrome 374 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698