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

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

Issue 2152743002: Remove search::ShouldPrerenderInstantUrlOnOmniboxFocus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_prefetch_srp
Patch Set: rebase Created 4 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.h ('k') | chrome/browser/search/search_unittest.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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #endif 45 #endif
46 46
47 #if defined(OS_CHROMEOS) 47 #if defined(OS_CHROMEOS)
48 #include "chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h" 48 #include "chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h"
49 #endif // defined(OS_CHROMEOS) 49 #endif // defined(OS_CHROMEOS)
50 50
51 namespace search { 51 namespace search {
52 52
53 namespace { 53 namespace {
54 54
55 const char kPrerenderInstantUrlOnOmniboxFocus[] =
56 "prerender_instant_url_on_omnibox_focus";
57
58 // Controls whether to use the alternate Instant search base URL. This allows 55 // Controls whether to use the alternate Instant search base URL. This allows
59 // experimentation of Instant search. 56 // experimentation of Instant search.
60 const char kUseAltInstantURL[] = "use_alternate_instant_url"; 57 const char kUseAltInstantURL[] = "use_alternate_instant_url";
61 const char kUseSearchPathForInstant[] = "use_search_path_for_instant"; 58 const char kUseSearchPathForInstant[] = "use_search_path_for_instant";
62 const char kAltInstantURLPath[] = "search"; 59 const char kAltInstantURLPath[] = "search";
63 const char kAltInstantURLQueryParams[] = "&qbp=1"; 60 const char kAltInstantURLQueryParams[] = "&qbp=1";
64 61
65 // Status of the New Tab URL for the default Search provider. NOTE: Used in a 62 // Status of the New Tab URL for the default Search provider. NOTE: Used in a
66 // UMA histogram so values should only be added at the end and not reordered. 63 // UMA histogram so values should only be added at the end and not reordered.
67 enum NewTabURLState { 64 enum NewTabURLState {
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 } 507 }
511 508
512 GURL GetNewTabPageURL(Profile* profile) { 509 GURL GetNewTabPageURL(Profile* profile) {
513 return NewTabURLDetails::ForProfile(profile).url; 510 return NewTabURLDetails::ForProfile(profile).url;
514 } 511 }
515 512
516 GURL GetSearchResultPrefetchBaseURL(Profile* profile) { 513 GURL GetSearchResultPrefetchBaseURL(Profile* profile) {
517 return ShouldPrefetchSearchResults() ? GetInstantURL(profile, true) : GURL(); 514 return ShouldPrefetchSearchResults() ? GetInstantURL(profile, true) : GURL();
518 } 515 }
519 516
520 bool ShouldPrerenderInstantUrlOnOmniboxFocus() {
521 if (!ShouldPrefetchSearchResults())
522 return false;
523
524 FieldTrialFlags flags;
525 return GetFieldTrialInfo(&flags) && GetBoolValueForFlagWithDefault(
526 kPrerenderInstantUrlOnOmniboxFocus, false, flags);
527 }
528
529 GURL GetEffectiveURLForInstant(const GURL& url, Profile* profile) { 517 GURL GetEffectiveURLForInstant(const GURL& url, Profile* profile) {
530 CHECK(ShouldAssignURLToInstantRenderer(url, profile)) 518 CHECK(ShouldAssignURLToInstantRenderer(url, profile))
531 << "Error granting Instant access."; 519 << "Error granting Instant access.";
532 520
533 if (url.SchemeIs(chrome::kChromeSearchScheme)) 521 if (url.SchemeIs(chrome::kChromeSearchScheme))
534 return url; 522 return url;
535 523
536 // Replace the scheme with "chrome-search:", and clear the port, since 524 // Replace the scheme with "chrome-search:", and clear the port, since
537 // chrome-search is a scheme without port. 525 // chrome-search is a scheme without port.
538 url::Replacements<char> replacements; 526 url::Replacements<char> replacements;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 kUseAltInstantURL, false, flags); 604 kUseAltInstantURL, false, flags);
617 } 605 }
618 606
619 bool ShouldUseSearchPathForInstant() { 607 bool ShouldUseSearchPathForInstant() {
620 FieldTrialFlags flags; 608 FieldTrialFlags flags;
621 return GetFieldTrialInfo(&flags) && GetBoolValueForFlagWithDefault( 609 return GetFieldTrialInfo(&flags) && GetBoolValueForFlagWithDefault(
622 kUseSearchPathForInstant, false, flags); 610 kUseSearchPathForInstant, false, flags);
623 } 611 }
624 612
625 } // namespace search 613 } // namespace search
OLDNEW
« no previous file with comments | « chrome/browser/search/search.h ('k') | chrome/browser/search/search_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698