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

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

Issue 13877028: Renderer initiated navigations from non instant process should not fall into instant. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing another recently added test. Created 7 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
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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 return GetBoolValueForFlagWithDefault(kUseRemoteNTPOnStartupFlagName, false, 492 return GetBoolValueForFlagWithDefault(kUseRemoteNTPOnStartupFlagName, false,
493 flags); 493 flags);
494 } 494 }
495 return false; 495 return false;
496 } 496 }
497 497
498 bool MatchesOriginAndPath(const GURL& my_url, const GURL& other_url) { 498 bool MatchesOriginAndPath(const GURL& my_url, const GURL& other_url) {
499 return MatchesOrigin(my_url, other_url) && my_url.path() == other_url.path(); 499 return MatchesOrigin(my_url, other_url) && my_url.path() == other_url.path();
500 } 500 }
501 501
502 GURL GetPrivilegedURLForInstant(const GURL& url, Profile* profile) {
503 CHECK(ShouldAssignURLToInstantRenderer(url, profile))
504 << "Error granting Instant access.";
505
506 if (IsPrivilegedURLForInstant(url))
507 return url;
508
509 GURL privileged_url(url);
510
511 // Replace the scheme with "chrome-search:".
512 url_canon::Replacements<char> replacements;
513 std::string search_scheme(chrome::kChromeSearchScheme);
514 replacements.SetScheme(search_scheme.data(),
515 url_parse::Component(0, search_scheme.length()));
516 privileged_url = privileged_url.ReplaceComponents(replacements);
517 return privileged_url;
518 }
519
520 bool IsPrivilegedURLForInstant(const GURL& url) {
521 return url.SchemeIs(chrome::kChromeSearchScheme);
522 }
523
502 void EnableInstantExtendedAPIForTesting() { 524 void EnableInstantExtendedAPIForTesting() {
503 CommandLine* cl = CommandLine::ForCurrentProcess(); 525 CommandLine* cl = CommandLine::ForCurrentProcess();
504 cl->AppendSwitch(switches::kEnableInstantExtendedAPI); 526 cl->AppendSwitch(switches::kEnableInstantExtendedAPI);
505 } 527 }
506 528
507 bool GetFieldTrialInfo(const std::string& group_name, 529 bool GetFieldTrialInfo(const std::string& group_name,
508 FieldTrialFlags* flags, 530 FieldTrialFlags* flags,
509 uint64* group_number) { 531 uint64* group_number) {
510 if (EndsWith(group_name, kDisablingSuffix, true) || 532 if (EndsWith(group_name, kDisablingSuffix, true) ||
511 !StartsWithASCII(group_name, kGroupNumberPrefix, true)) 533 !StartsWithASCII(group_name, kGroupNumberPrefix, true))
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 624
603 GURL instant_url = TemplateURLRefToGURL(template_url->instant_url_ref(), 625 GURL instant_url = TemplateURLRefToGURL(template_url->instant_url_ref(),
604 kDisableStartMargin); 626 kDisableStartMargin);
605 // Extended mode instant requires a search terms replacement key. 627 // Extended mode instant requires a search terms replacement key.
606 return instant_url.is_valid() && 628 return instant_url.is_valid() &&
607 (!IsInstantExtendedAPIEnabled() || 629 (!IsInstantExtendedAPIEnabled() ||
608 template_url->HasSearchTermsReplacementKey(instant_url)); 630 template_url->HasSearchTermsReplacementKey(instant_url));
609 } 631 }
610 632
611 } // namespace chrome 633 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/search/search.h ('k') | chrome/browser/ui/search/instant_extended_interactive_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698