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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // Don't update the URL if the request didn't succeed. | 129 // Don't update the URL if the request didn't succeed. |
130 if (!source->GetStatus().is_success() || (source->GetResponseCode() != 200)) { | 130 if (!source->GetStatus().is_success() || (source->GetResponseCode() != 200)) { |
131 already_fetched_ = false; | 131 already_fetched_ = false; |
132 return; | 132 return; |
133 } | 133 } |
134 | 134 |
135 // See if the response data was valid. It should be | 135 // See if the response data was valid. It should be |
136 // "<scheme>://[www.]google.<TLD>/". | 136 // "<scheme>://[www.]google.<TLD>/". |
137 std::string url_str; | 137 std::string url_str; |
138 source->GetResponseAsString(&url_str); | 138 source->GetResponseAsString(&url_str); |
139 TrimWhitespace(url_str, TRIM_ALL, &url_str); | 139 base::TrimWhitespace(url_str, base::TRIM_ALL, &url_str); |
140 GURL url(url_str); | 140 GURL url(url_str); |
141 if (!url.is_valid() || (url.path().length() > 1) || url.has_query() || | 141 if (!url.is_valid() || (url.path().length() > 1) || url.has_query() || |
142 url.has_ref() || | 142 url.has_ref() || |
143 !google_util::IsGoogleDomainUrl(url, google_util::DISALLOW_SUBDOMAIN, | 143 !google_util::IsGoogleDomainUrl(url, google_util::DISALLOW_SUBDOMAIN, |
144 google_util::DISALLOW_NON_STANDARD_PORTS)) | 144 google_util::DISALLOW_NON_STANDARD_PORTS)) |
145 return; | 145 return; |
146 | 146 |
147 std::swap(url, fetched_google_url_); | 147 std::swap(url, fetched_google_url_); |
148 GURL last_prompted_url( | 148 GURL last_prompted_url( |
149 profile_->GetPrefs()->GetString(prefs::kLastPromptedGoogleURL)); | 149 profile_->GetPrefs()->GetString(prefs::kLastPromptedGoogleURL)); |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 i->second->navigation_controller())) { | 418 i->second->navigation_controller())) { |
419 DCHECK(nav_helper_->IsListeningForNavigationStart()); | 419 DCHECK(nav_helper_->IsListeningForNavigationStart()); |
420 return; | 420 return; |
421 } | 421 } |
422 } | 422 } |
423 if (nav_helper_->IsListeningForNavigationStart()) { | 423 if (nav_helper_->IsListeningForNavigationStart()) { |
424 DCHECK(!search_committed_); | 424 DCHECK(!search_committed_); |
425 nav_helper_->SetListeningForNavigationStart(false); | 425 nav_helper_->SetListeningForNavigationStart(false); |
426 } | 426 } |
427 } | 427 } |
OLD | NEW |