summaryrefslogtreecommitdiffstats
path: root/chrome/browser/alternate_nav_url_fetcher.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-04 23:36:11 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-04 23:36:11 +0000
commit0f7c619654e11fde38e5189172f0c90fb2e74b52 (patch)
treed765601a0f47de7ad0f193dde222351eeb784c49 /chrome/browser/alternate_nav_url_fetcher.cc
parentb4677d1f8bb717220ab3231f698af10142dc0815 (diff)
downloadchromium_src-0f7c619654e11fde38e5189172f0c90fb2e74b52.zip
chromium_src-0f7c619654e11fde38e5189172f0c90fb2e74b52.tar.gz
chromium_src-0f7c619654e11fde38e5189172f0c90fb2e74b52.tar.bz2
Blacklist particular TLD+1s for accidental search infobars, to avoid showing the user an infobar on all kinds of searches.
BUG=31043 TEST=Legit intranet sites should still produce infobars. Search terms which previously generated infobars on Comcast/Verizon should not. Review URL: http://codereview.chromium.org/523043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35493 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/alternate_nav_url_fetcher.cc')
-rw-r--r--chrome/browser/alternate_nav_url_fetcher.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/chrome/browser/alternate_nav_url_fetcher.cc b/chrome/browser/alternate_nav_url_fetcher.cc
index 2ac0716..5650274 100644
--- a/chrome/browser/alternate_nav_url_fetcher.cc
+++ b/chrome/browser/alternate_nav_url_fetcher.cc
@@ -13,6 +13,7 @@
#include "chrome/common/notification_service.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
+#include "net/base/registry_controlled_domain.h"
#include "net/url_request/url_request.h"
AlternateNavURLFetcher::AlternateNavURLFetcher(
@@ -86,9 +87,31 @@ void AlternateNavURLFetcher::OnURLFetchComplete(const URLFetcher* source,
(((response_code / 100) == 2) ||
(response_code == 401) || (response_code == 407))) {
state_ = SUCCEEDED;
+
+ // The following TLD+1s are used as destinations by ISPs/DNS providers/etc.
+ // who return provider-controlled pages to arbitrary user navigation
+ // attempts. Because this can result in infobars on large fractions of user
+ // searches, we don't show automatic infobars for these. Note that users
+ // can still choose to explicitly navigate to or search for pages in these
+ // domains, and can still get infobars for cases that wind up on other
+ // domains (e.g. legit intranet sites), we're just trying to avoid
+ // erroneously harassing the user with our own UI prompts.
+ const char* kBlacklistedSites[] = {
+ "comcast.com",
+ "opendns.com",
+ "verizon.net",
+ };
+ for (size_t i = 0; i < arraysize(kBlacklistedSites); ++i) {
+ if (net::RegistryControlledDomainService::SameDomainOrHost(
+ url, GURL(kBlacklistedSites[i]))) {
+ state_ = FAILED;
+ break;
+ }
+ }
} else {
state_ = FAILED;
}
+
ShowInfobarIfPossible();
}