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

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

Issue 1911573002: Teach SiteInstance::GetSiteForURL() about blob and filesystem URLs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add search unittest. Created 4 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
« no previous file with comments | « no previous file | 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/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 483
484 GURL GetEffectiveURLForInstant(const GURL& url, Profile* profile) { 484 GURL GetEffectiveURLForInstant(const GURL& url, Profile* profile) {
485 CHECK(ShouldAssignURLToInstantRenderer(url, profile)) 485 CHECK(ShouldAssignURLToInstantRenderer(url, profile))
486 << "Error granting Instant access."; 486 << "Error granting Instant access.";
487 487
488 if (url.SchemeIs(chrome::kChromeSearchScheme)) 488 if (url.SchemeIs(chrome::kChromeSearchScheme))
489 return url; 489 return url;
490 490
491 GURL effective_url(url); 491 GURL effective_url(url);
492 492
493 // Replace the scheme with "chrome-search:". 493 // Replace the scheme with "chrome-search:", and clear the port, since
494 // chrome-search is a scheme without port.
494 url::Replacements<char> replacements; 495 url::Replacements<char> replacements;
495 std::string search_scheme(chrome::kChromeSearchScheme); 496 std::string search_scheme(chrome::kChromeSearchScheme);
496 replacements.SetScheme(search_scheme.data(), 497 replacements.SetScheme(search_scheme.data(),
497 url::Component(0, search_scheme.length())); 498 url::Component(0, search_scheme.length()));
499 replacements.ClearPort();
498 500
499 // If this is the URL for a server-provided NTP, replace the host with 501 // If this is the URL for a server-provided NTP, replace the host with
500 // "remote-ntp". 502 // "remote-ntp".
501 std::string remote_ntp_host(chrome::kChromeSearchRemoteNtpHost); 503 std::string remote_ntp_host(chrome::kChromeSearchRemoteNtpHost);
502 NewTabURLDetails details = NewTabURLDetails::ForProfile(profile); 504 NewTabURLDetails details = NewTabURLDetails::ForProfile(profile);
503 if (details.state == NEW_TAB_URL_VALID && 505 if (details.state == NEW_TAB_URL_VALID &&
504 MatchesOriginAndPath(url, details.url)) { 506 MatchesOriginAndPath(url, details.url)) {
505 replacements.SetHost(remote_ntp_host.c_str(), 507 replacements.SetHost(remote_ntp_host.c_str(),
506 url::Component(0, remote_ntp_host.length())); 508 url::Component(0, remote_ntp_host.length()));
507 } 509 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 kUseAltInstantURL, false, flags); 586 kUseAltInstantURL, false, flags);
585 } 587 }
586 588
587 bool ShouldUseSearchPathForInstant() { 589 bool ShouldUseSearchPathForInstant() {
588 FieldTrialFlags flags; 590 FieldTrialFlags flags;
589 return GetFieldTrialInfo(&flags) && GetBoolValueForFlagWithDefault( 591 return GetFieldTrialInfo(&flags) && GetBoolValueForFlagWithDefault(
590 kUseSearchPathForInstant, false, flags); 592 kUseSearchPathForInstant, false, flags);
591 } 593 }
592 594
593 } // namespace search 595 } // namespace search
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/search/search_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698