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

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

Issue 282183002: [AiS] Enable AiS flag on all platforms (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
« no previous file with comments | « chrome/browser/search/search.h ('k') | chrome/browser/search_engines/search_terms_data.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/search/search.h" 5 #include "chrome/browser/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/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 switch (state) { 325 switch (state) {
326 case NEW_TAB_URL_VALID: 326 case NEW_TAB_URL_VALID:
327 // We can use the search provider's page. 327 // We can use the search provider's page.
328 return NewTabURLDetails(search_provider_url, state); 328 return NewTabURLDetails(search_provider_url, state);
329 case NEW_TAB_URL_INCOGNITO: 329 case NEW_TAB_URL_INCOGNITO:
330 // Incognito has its own New Tab. 330 // Incognito has its own New Tab.
331 return NewTabURLDetails(GURL(), state); 331 return NewTabURLDetails(GURL(), state);
332 default: 332 default:
333 // Use the local New Tab otherwise. 333 // Use the local New Tab otherwise.
334 return NewTabURLDetails(local_url, state); 334 return NewTabURLDetails(local_url, state);
335 }; 335 }
336 } 336 }
337 337
338 GURL url; 338 GURL url;
339 NewTabURLState state; 339 NewTabURLState state;
340 }; 340 };
341 341
342 } // namespace 342 } // namespace
343 343
344 // Negative start-margin values prevent the "es_sm" parameter from being used. 344 // Negative start-margin values prevent the "es_sm" parameter from being used.
345 const int kDisableStartMargin = -1; 345 const int kDisableStartMargin = -1;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 GURL new_tab_url(GetNewTabPageURL(profile)); 503 GURL new_tab_url(GetNewTabPageURL(profile));
504 return new_tab_url.is_valid() && 504 return new_tab_url.is_valid() &&
505 search::MatchesOriginAndPath(entry->GetURL(), new_tab_url); 505 search::MatchesOriginAndPath(entry->GetURL(), new_tab_url);
506 } 506 }
507 507
508 bool IsSuggestPrefEnabled(Profile* profile) { 508 bool IsSuggestPrefEnabled(Profile* profile) {
509 return profile && !profile->IsOffTheRecord() && profile->GetPrefs() && 509 return profile && !profile->IsOffTheRecord() && profile->GetPrefs() &&
510 profile->GetPrefs()->GetBoolean(prefs::kSearchSuggestEnabled); 510 profile->GetPrefs()->GetBoolean(prefs::kSearchSuggestEnabled);
511 } 511 }
512 512
513 bool IsAnswersInSuggestEnabled() {
Peter Kasting 2014/05/15 20:30:55 I'd prefer not to create a helper for this. (The
groby-ooo-7-16 2014/05/15 22:32:37 Done.
514 return CommandLine::ForCurrentProcess()->HasSwitch(
515 switches::kEnableAnswersInSuggest);
516 }
517
513 GURL GetInstantURL(Profile* profile, int start_margin, 518 GURL GetInstantURL(Profile* profile, int start_margin,
514 bool force_instant_results) { 519 bool force_instant_results) {
515 if (!IsInstantExtendedAPIEnabled() || !IsSuggestPrefEnabled(profile)) 520 if (!IsInstantExtendedAPIEnabled() || !IsSuggestPrefEnabled(profile))
516 return GURL(); 521 return GURL();
517 522
518 TemplateURL* template_url = GetDefaultSearchProviderTemplateURL(profile); 523 TemplateURL* template_url = GetDefaultSearchProviderTemplateURL(profile);
519 if (!template_url) 524 if (!template_url)
520 return GURL(); 525 return GURL();
521 526
522 GURL instant_url = 527 GURL instant_url =
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 848
844 // Given a FieldTrialFlags object, returns the boolean value of the provided 849 // Given a FieldTrialFlags object, returns the boolean value of the provided
845 // flag. 850 // flag.
846 bool GetBoolValueForFlagWithDefault(const std::string& flag, 851 bool GetBoolValueForFlagWithDefault(const std::string& flag,
847 bool default_value, 852 bool default_value,
848 const FieldTrialFlags& flags) { 853 const FieldTrialFlags& flags) {
849 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags); 854 return !!GetUInt64ValueForFlagWithDefault(flag, default_value ? 1 : 0, flags);
850 } 855 }
851 856
852 } // namespace chrome 857 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/search/search.h ('k') | chrome/browser/search_engines/search_terms_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698