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

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

Issue 450663002: Move ShouldHideTopVerbatimMatch to components/search (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 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 | Annotate | Revision Log
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 27 matching lines...) Expand all
38 #if defined(ENABLE_MANAGED_USERS) 38 #if defined(ENABLE_MANAGED_USERS)
39 #include "chrome/browser/supervised_user/supervised_user_service.h" 39 #include "chrome/browser/supervised_user/supervised_user_service.h"
40 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" 40 #include "chrome/browser/supervised_user/supervised_user_service_factory.h"
41 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" 41 #include "chrome/browser/supervised_user/supervised_user_url_filter.h"
42 #endif 42 #endif
43 43
44 namespace chrome { 44 namespace chrome {
45 45
46 namespace { 46 namespace {
47 47
48 const char kHideVerbatimFlagName[] = "hide_verbatim";
49 const char kPrefetchSearchResultsOnSRP[] = "prefetch_results_srp"; 48 const char kPrefetchSearchResultsOnSRP[] = "prefetch_results_srp";
50 const char kAllowPrefetchNonDefaultMatch[] = "allow_prefetch_non_default_match"; 49 const char kAllowPrefetchNonDefaultMatch[] = "allow_prefetch_non_default_match";
51 const char kPrerenderInstantUrlOnOmniboxFocus[] = 50 const char kPrerenderInstantUrlOnOmniboxFocus[] =
52 "prerender_instant_url_on_omnibox_focus"; 51 "prerender_instant_url_on_omnibox_focus";
53 52
54 #if defined(OS_ANDROID) 53 #if defined(OS_ANDROID)
55 const char kPrefetchSearchResultsFlagName[] = "prefetch_results"; 54 const char kPrefetchSearchResultsFlagName[] = "prefetch_results";
56 55
57 // Controls whether to reuse prerendered Instant Search base page to commit any 56 // Controls whether to reuse prerendered Instant Search base page to commit any
58 // search query. 57 // search query.
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 kReuseInstantSearchBasePage, false, flags); 572 kReuseInstantSearchBasePage, false, flags);
574 #else 573 #else
575 return true; 574 return true;
576 #endif 575 #endif
577 } 576 }
578 577
579 GURL GetLocalInstantURL(Profile* profile) { 578 GURL GetLocalInstantURL(Profile* profile) {
580 return GURL(chrome::kChromeSearchLocalNtpUrl); 579 return GURL(chrome::kChromeSearchLocalNtpUrl);
581 } 580 }
582 581
583 bool ShouldHideTopVerbatimMatch() {
584 FieldTrialFlags flags;
585 return GetFieldTrialInfo(&flags) && GetBoolValueForFlagWithDefault(
586 kHideVerbatimFlagName, false, flags);
587 }
588
589 DisplaySearchButtonConditions GetDisplaySearchButtonConditions() { 582 DisplaySearchButtonConditions GetDisplaySearchButtonConditions() {
590 const CommandLine* cl = CommandLine::ForCurrentProcess(); 583 const CommandLine* cl = CommandLine::ForCurrentProcess();
591 if (cl->HasSwitch(switches::kDisableSearchButtonInOmnibox)) 584 if (cl->HasSwitch(switches::kDisableSearchButtonInOmnibox))
592 return DISPLAY_SEARCH_BUTTON_NEVER; 585 return DISPLAY_SEARCH_BUTTON_NEVER;
593 if (cl->HasSwitch(switches::kEnableSearchButtonInOmniboxForStr)) 586 if (cl->HasSwitch(switches::kEnableSearchButtonInOmniboxForStr))
594 return DISPLAY_SEARCH_BUTTON_FOR_STR; 587 return DISPLAY_SEARCH_BUTTON_FOR_STR;
595 if (cl->HasSwitch(switches::kEnableSearchButtonInOmniboxForStrOrIip)) 588 if (cl->HasSwitch(switches::kEnableSearchButtonInOmniboxForStrOrIip))
596 return DISPLAY_SEARCH_BUTTON_FOR_STR_OR_IIP; 589 return DISPLAY_SEARCH_BUTTON_FOR_STR_OR_IIP;
597 if (cl->HasSwitch(switches::kEnableSearchButtonInOmniboxAlways)) 590 if (cl->HasSwitch(switches::kEnableSearchButtonInOmniboxAlways))
598 return DISPLAY_SEARCH_BUTTON_ALWAYS; 591 return DISPLAY_SEARCH_BUTTON_ALWAYS;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 cl->AppendSwitch(switches::kEnableQueryExtraction); 732 cl->AppendSwitch(switches::kEnableQueryExtraction);
740 } 733 }
741 734
742 bool ShouldUseAltInstantURL() { 735 bool ShouldUseAltInstantURL() {
743 FieldTrialFlags flags; 736 FieldTrialFlags flags;
744 return GetFieldTrialInfo(&flags) && GetBoolValueForFlagWithDefault( 737 return GetFieldTrialInfo(&flags) && GetBoolValueForFlagWithDefault(
745 kUseAltInstantURL, false, flags); 738 kUseAltInstantURL, false, flags);
746 } 739 }
747 740
748 } // namespace chrome 741 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698