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

Side by Side Diff: chrome/browser/ui/omnibox/alternate_nav_url_fetcher.cc

Issue 15140003: Add support for split Public Suffix List distinctions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased again 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/ui/omnibox/alternate_nav_url_fetcher.h" 5 #include "chrome/browser/ui/omnibox/alternate_nav_url_fetcher.h"
6 6
7 #include "chrome/browser/infobars/infobar_service.h" 7 #include "chrome/browser/infobars/infobar_service.h"
8 #include "chrome/browser/intranet_redirect_detector.h" 8 #include "chrome/browser/intranet_redirect_detector.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.h" 10 #include "chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 int response_code) { 126 int response_code) {
127 if (status.is_success()) { 127 if (status.is_success()) {
128 // HTTP 2xx, 401, and 407 all indicate that the target address exists. 128 // HTTP 2xx, 401, and 407 all indicate that the target address exists.
129 state_ = (((response_code / 100) == 2) || (response_code == 401) || 129 state_ = (((response_code / 100) == 2) || (response_code == 401) ||
130 (response_code == 407)) ? SUCCEEDED : FAILED; 130 (response_code == 407)) ? SUCCEEDED : FAILED;
131 } else { 131 } else {
132 // If we got HTTP 3xx, we'll have auto-canceled; treat this as evidence the 132 // If we got HTTP 3xx, we'll have auto-canceled; treat this as evidence the
133 // target address exists as long as we're not redirected to a common 133 // target address exists as long as we're not redirected to a common
134 // location every time, lest we annoy the user with infobars on everything 134 // location every time, lest we annoy the user with infobars on everything
135 // they type. See comments on IntranetRedirectDetector. 135 // they type. See comments on IntranetRedirectDetector.
136 state_ = ((status.status() == net::URLRequestStatus::CANCELED) && 136 if (status.status() == net::URLRequestStatus::CANCELED &&
137 ((response_code / 100) == 3) && 137 (response_code / 100) == 3) {
138 !net::RegistryControlledDomainService::SameDomainOrHost(url, 138 const bool same_domain_or_host =
139 IntranetRedirectDetector::RedirectOrigin())) ? SUCCEEDED : FAILED; 139 net::registry_controlled_domains::SameDomainOrHost(
140 url,
141 IntranetRedirectDetector::RedirectOrigin(),
142 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES);
143 state_ = same_domain_or_host ? FAILED : SUCCEEDED;
144 } else {
145 state_ = FAILED;
146 }
140 } 147 }
141 } 148 }
142 149
143 void AlternateNavURLFetcher::ShowInfobarIfPossible() { 150 void AlternateNavURLFetcher::ShowInfobarIfPossible() {
144 if (navigated_to_entry_ && (state_ == SUCCEEDED)) { 151 if (navigated_to_entry_ && (state_ == SUCCEEDED)) {
145 AlternateNavInfoBarDelegate::Create( 152 AlternateNavInfoBarDelegate::Create(
146 InfoBarService::FromWebContents(controller_->GetWebContents()), 153 InfoBarService::FromWebContents(controller_->GetWebContents()),
147 alternate_nav_url_); 154 alternate_nav_url_);
148 } else if (state_ != FAILED) { 155 } else if (state_ != FAILED) {
149 return; 156 return;
150 } 157 }
151 delete this; 158 delete this;
152 } 159 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/ui_manager.cc ('k') | chrome/browser/ui/toolbar/back_forward_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698