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

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

Issue 889463003: GURL::Replacements methods accept a StringPiece instead of std::string&. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase (fixed some merge conflicts). Created 5 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
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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 if (!instant_url.is_valid() || 479 if (!instant_url.is_valid() ||
480 !template_url->HasSearchTermsReplacementKey(instant_url)) 480 !template_url->HasSearchTermsReplacementKey(instant_url))
481 return GURL(); 481 return GURL();
482 482
483 // Extended mode requires HTTPS. Force it unless the base URL was overridden 483 // Extended mode requires HTTPS. Force it unless the base URL was overridden
484 // on the command line, in which case we allow HTTP (see comments on 484 // on the command line, in which case we allow HTTP (see comments on
485 // IsSuitableURLForInstant()). 485 // IsSuitableURLForInstant()).
486 if (!instant_url.SchemeIsSecure() && 486 if (!instant_url.SchemeIsSecure() &&
487 !google_util::StartsWithCommandLineGoogleBaseURL(instant_url)) { 487 !google_util::StartsWithCommandLineGoogleBaseURL(instant_url)) {
488 GURL::Replacements replacements; 488 GURL::Replacements replacements;
489 const std::string secure_scheme(url::kHttpsScheme); 489 replacements.SetSchemeStr(url::kHttpsScheme);
490 replacements.SetSchemeStr(secure_scheme);
491 instant_url = instant_url.ReplaceComponents(replacements); 490 instant_url = instant_url.ReplaceComponents(replacements);
492 } 491 }
493 492
494 if (!IsURLAllowedForSupervisedUser(instant_url, profile)) 493 if (!IsURLAllowedForSupervisedUser(instant_url, profile))
495 return GURL(); 494 return GURL();
496 495
497 if (ShouldUseAltInstantURL()) { 496 if (ShouldUseAltInstantURL()) {
498 GURL::Replacements replacements; 497 GURL::Replacements replacements;
499 const std::string path( 498 const std::string path(
500 ShouldUseSearchPathForInstant() ? kAltInstantURLPath : std::string()); 499 ShouldUseSearchPathForInstant() ? kAltInstantURLPath : std::string());
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 kUseAltInstantURL, false, flags); 741 kUseAltInstantURL, false, flags);
743 } 742 }
744 743
745 bool ShouldUseSearchPathForInstant() { 744 bool ShouldUseSearchPathForInstant() {
746 FieldTrialFlags flags; 745 FieldTrialFlags flags;
747 return GetFieldTrialInfo(&flags) && GetBoolValueForFlagWithDefault( 746 return GetFieldTrialInfo(&flags) && GetBoolValueForFlagWithDefault(
748 kUseSearchPathForInstant, false, flags); 747 kUseSearchPathForInstant, false, flags);
749 } 748 }
750 749
751 } // namespace chrome 750 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_browsertest.cc ('k') | chrome/browser/ssl/ssl_browser_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698