| OLD | NEW |
| 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/google/google_url_tracker.h" | 5 #include "chrome/browser/google/google_url_tracker.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 } | 132 } |
| 133 | 133 |
| 134 // See if the response data was valid. It should be | 134 // See if the response data was valid. It should be |
| 135 // "<scheme>://[www.]google.<TLD>/". | 135 // "<scheme>://[www.]google.<TLD>/". |
| 136 std::string url_str; | 136 std::string url_str; |
| 137 source->GetResponseAsString(&url_str); | 137 source->GetResponseAsString(&url_str); |
| 138 TrimWhitespace(url_str, TRIM_ALL, &url_str); | 138 TrimWhitespace(url_str, TRIM_ALL, &url_str); |
| 139 GURL url(url_str); | 139 GURL url(url_str); |
| 140 if (!url.is_valid() || (url.path().length() > 1) || url.has_query() || | 140 if (!url.is_valid() || (url.path().length() > 1) || url.has_query() || |
| 141 url.has_ref() || | 141 url.has_ref() || |
| 142 !google_util::IsGoogleDomainUrl(url.spec(), | 142 !google_util::IsGoogleDomainUrl(url, google_util::DISALLOW_SUBDOMAIN, |
| 143 google_util::DISALLOW_SUBDOMAIN, | |
| 144 google_util::DISALLOW_NON_STANDARD_PORTS)) | 143 google_util::DISALLOW_NON_STANDARD_PORTS)) |
| 145 return; | 144 return; |
| 146 | 145 |
| 147 std::swap(url, fetched_google_url_); | 146 std::swap(url, fetched_google_url_); |
| 148 GURL last_prompted_url( | 147 GURL last_prompted_url( |
| 149 profile_->GetPrefs()->GetString(prefs::kLastPromptedGoogleURL)); | 148 profile_->GetPrefs()->GetString(prefs::kLastPromptedGoogleURL)); |
| 150 | 149 |
| 151 if (last_prompted_url.is_empty()) { | 150 if (last_prompted_url.is_empty()) { |
| 152 // On the very first run of Chrome, when we've never looked up the URL at | 151 // On the very first run of Chrome, when we've never looked up the URL at |
| 153 // all, we should just silently switch over to whatever we get immediately. | 152 // all, we should just silently switch over to whatever we get immediately. |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 i->second->navigation_controller())) { | 411 i->second->navigation_controller())) { |
| 413 DCHECK(nav_helper_->IsListeningForNavigationStart()); | 412 DCHECK(nav_helper_->IsListeningForNavigationStart()); |
| 414 return; | 413 return; |
| 415 } | 414 } |
| 416 } | 415 } |
| 417 if (nav_helper_->IsListeningForNavigationStart()) { | 416 if (nav_helper_->IsListeningForNavigationStart()) { |
| 418 DCHECK(!search_committed_); | 417 DCHECK(!search_committed_); |
| 419 nav_helper_->SetListeningForNavigationStart(false); | 418 nav_helper_->SetListeningForNavigationStart(false); |
| 420 } | 419 } |
| 421 } | 420 } |
| OLD | NEW |