| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 278 |
| 279 // See if the response data was valid. It should be | 279 // See if the response data was valid. It should be |
| 280 // "<scheme>://[www.]google.<TLD>/". | 280 // "<scheme>://[www.]google.<TLD>/". |
| 281 std::string url_str; | 281 std::string url_str; |
| 282 source->GetResponseAsString(&url_str); | 282 source->GetResponseAsString(&url_str); |
| 283 TrimWhitespace(url_str, TRIM_ALL, &url_str); | 283 TrimWhitespace(url_str, TRIM_ALL, &url_str); |
| 284 GURL url(url_str); | 284 GURL url(url_str); |
| 285 if (!url.is_valid() || (url.path().length() > 1) || url.has_query() || | 285 if (!url.is_valid() || (url.path().length() > 1) || url.has_query() || |
| 286 url.has_ref() || | 286 url.has_ref() || |
| 287 !google_util::IsGoogleDomainUrl(url.spec(), | 287 !google_util::IsGoogleDomainUrl(url.spec(), |
| 288 google_util::DISALLOW_SUBDOMAIN)) | 288 google_util::DISALLOW_SUBDOMAIN, |
| 289 google_util::DISALLOW_NON_STANDARD_PORTS)) |
| 289 return; | 290 return; |
| 290 | 291 |
| 291 std::swap(url, fetched_google_url_); | 292 std::swap(url, fetched_google_url_); |
| 292 GURL last_prompted_url( | 293 GURL last_prompted_url( |
| 293 profile_->GetPrefs()->GetString(prefs::kLastPromptedGoogleURL)); | 294 profile_->GetPrefs()->GetString(prefs::kLastPromptedGoogleURL)); |
| 294 | 295 |
| 295 if (last_prompted_url.is_empty()) { | 296 if (last_prompted_url.is_empty()) { |
| 296 // On the very first run of Chrome, when we've never looked up the URL at | 297 // On the very first run of Chrome, when we've never looked up the URL at |
| 297 // all, we should just silently switch over to whatever we get immediately. | 298 // all, we should just silently switch over to whatever we get immediately. |
| 298 AcceptGoogleURL(fetched_google_url_, true); // Second arg is irrelevant. | 299 AcceptGoogleURL(fetched_google_url_, true); // Second arg is irrelevant. |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 } | 656 } |
| 656 if (registrar_.IsRegistered(this, content::NOTIFICATION_NAV_ENTRY_PENDING, | 657 if (registrar_.IsRegistered(this, content::NOTIFICATION_NAV_ENTRY_PENDING, |
| 657 content::NotificationService::AllBrowserContextsAndSources())) { | 658 content::NotificationService::AllBrowserContextsAndSources())) { |
| 658 DCHECK(!search_committed_); | 659 DCHECK(!search_committed_); |
| 659 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_PENDING, | 660 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_PENDING, |
| 660 content::NotificationService::AllBrowserContextsAndSources()); | 661 content::NotificationService::AllBrowserContextsAndSources()); |
| 661 registrar_.Remove(this, chrome::NOTIFICATION_INSTANT_COMMITTED, | 662 registrar_.Remove(this, chrome::NOTIFICATION_INSTANT_COMMITTED, |
| 662 content::NotificationService::AllBrowserContextsAndSources()); | 663 content::NotificationService::AllBrowserContextsAndSources()); |
| 663 } | 664 } |
| 664 } | 665 } |
| OLD | NEW |