summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-27 05:26:49 +0000
committerukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-27 05:26:49 +0000
commitf60b55b692783e607226023857da2de8ed536530 (patch)
treebf9405a6cd1007672a763e8772fe5ef7b3676f24 /chrome
parent4a5b5695a4cc32bcbc0e396111b34e692bf9b809 (diff)
downloadchromium_src-f60b55b692783e607226023857da2de8ed536530.zip
chromium_src-f60b55b692783e607226023857da2de8ed536530.tar.gz
chromium_src-f60b55b692783e607226023857da2de8ed536530.tar.bz2
Ignore *.corp.google.* as GoogleBaseURL
On Mac (prior EasyStreet), http://www.google.com might be redirected to wifi.corp.google.com, so that google:baseURL would be set to wifi.corp.google.com, but user might want to use the URL for default search. BUG=38472 TEST=GoogleURLTrackerTest.CheckAndConvertURL passes Review URL: http://codereview.chromium.org/1780006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45674 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/google_url_tracker.cc14
-rw-r--r--chrome/browser/google_url_tracker_unittest.cc3
2 files changed, 13 insertions, 4 deletions
diff --git a/chrome/browser/google_url_tracker.cc b/chrome/browser/google_url_tracker.cc
index a4428c3..2dc32e1 100644
--- a/chrome/browser/google_url_tracker.cc
+++ b/chrome/browser/google_url_tracker.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -79,14 +79,22 @@ bool GoogleURLTracker::CheckAndConvertToGoogleBaseURL(const GURL& url,
SplitStringDontTrim(url.host(), '.', &host_components);
if (host_components.size() < 2)
return false;
- std::string& component = host_components[host_components.size() - 2];
+ size_t google_component = host_components.size() - 2;
+ const std::string& component = host_components[google_component];
if (component != "google") {
if ((host_components.size() < 3) ||
((component != "co") && (component != "com")))
return false;
- if (host_components[host_components.size() - 3] != "google")
+ google_component = host_components.size() - 3;
+ if (host_components[google_component] != "google")
return false;
}
+ // For Google employees only: If the URL appears to be on
+ // [*.]corp.google.com, it's likely a doorway (e.g.
+ // wifi.corp.google.com), so ignore it.
+ if ((google_component > 0) &&
+ (host_components[google_component - 1] == "corp"))
+ return false;
// If the url's path does not begin "/intl/", reset it to "/". Other paths
// represent services such as iGoogle that are irrelevant to the baseURL.
diff --git a/chrome/browser/google_url_tracker_unittest.cc b/chrome/browser/google_url_tracker_unittest.cc
index a0eefe2..9de0b88 100644
--- a/chrome/browser/google_url_tracker_unittest.cc
+++ b/chrome/browser/google_url_tracker_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -22,6 +22,7 @@ TEST(GoogleURLTrackerTest, CheckAndConvertURL) {
{ "http://google.evil.com/", false, "", },
{ "http://google.com.com.com/", false, "", },
{ "http://google/", false, "", },
+ { "http://wifi.corp.google.com/", false, "" },
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) {