| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/google/core/browser/google_url_tracker.h" | 5 #include "components/google/core/browser/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/profiler/scoped_profile.h" |
| 10 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 11 #include "components/google/core/browser/google_pref_names.h" | 12 #include "components/google/core/browser/google_pref_names.h" |
| 12 #include "components/google/core/browser/google_switches.h" | 13 #include "components/google/core/browser/google_switches.h" |
| 13 #include "components/google/core/browser/google_url_tracker_infobar_delegate.h" | 14 #include "components/google/core/browser/google_url_tracker_infobar_delegate.h" |
| 14 #include "components/google/core/browser/google_url_tracker_navigation_helper.h" | 15 #include "components/google/core/browser/google_url_tracker_navigation_helper.h" |
| 15 #include "components/google/core/browser/google_util.h" | 16 #include "components/google/core/browser/google_util.h" |
| 16 #include "components/infobars/core/infobar.h" | 17 #include "components/infobars/core/infobar.h" |
| 17 #include "components/infobars/core/infobar_manager.h" | 18 #include "components/infobars/core/infobar_manager.h" |
| 18 #include "net/base/load_flags.h" | 19 #include "net/base/load_flags.h" |
| 19 #include "net/base/net_util.h" | 20 #include "net/base/net_util.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 } | 100 } |
| 100 | 101 |
| 101 void GoogleURLTracker::CancelGoogleURL() { | 102 void GoogleURLTracker::CancelGoogleURL() { |
| 102 client_->GetPrefs()->SetString(prefs::kLastPromptedGoogleURL, | 103 client_->GetPrefs()->SetString(prefs::kLastPromptedGoogleURL, |
| 103 fetched_google_url_.spec()); | 104 fetched_google_url_.spec()); |
| 104 need_to_prompt_ = false; | 105 need_to_prompt_ = false; |
| 105 CloseAllEntries(false); | 106 CloseAllEntries(false); |
| 106 } | 107 } |
| 107 | 108 |
| 108 void GoogleURLTracker::OnURLFetchComplete(const net::URLFetcher* source) { | 109 void GoogleURLTracker::OnURLFetchComplete(const net::URLFetcher* source) { |
| 110 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed. |
| 111 tracked_objects::ScopedProfile tracking_profile( |
| 112 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 113 "422577 GoogleURLTracker::OnURLFetchComplete")); |
| 114 |
| 109 // Delete the fetcher on this function's exit. | 115 // Delete the fetcher on this function's exit. |
| 110 scoped_ptr<net::URLFetcher> clean_up_fetcher(fetcher_.release()); | 116 scoped_ptr<net::URLFetcher> clean_up_fetcher(fetcher_.release()); |
| 111 | 117 |
| 112 // Don't update the URL if the request didn't succeed. | 118 // Don't update the URL if the request didn't succeed. |
| 113 if (!source->GetStatus().is_success() || (source->GetResponseCode() != 200)) { | 119 if (!source->GetStatus().is_success() || (source->GetResponseCode() != 200)) { |
| 114 already_fetched_ = false; | 120 already_fetched_ = false; |
| 115 return; | 121 return; |
| 116 } | 122 } |
| 117 | 123 |
| 118 // See if the response data was valid. It should be | 124 // See if the response data was valid. It should be |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 } | 412 } |
| 407 if (client_->IsListeningForNavigationStart()) { | 413 if (client_->IsListeningForNavigationStart()) { |
| 408 DCHECK(!search_committed_); | 414 DCHECK(!search_committed_); |
| 409 client_->SetListeningForNavigationStart(false); | 415 client_->SetListeningForNavigationStart(false); |
| 410 } | 416 } |
| 411 } | 417 } |
| 412 | 418 |
| 413 void GoogleURLTracker::NotifyGoogleURLUpdated() { | 419 void GoogleURLTracker::NotifyGoogleURLUpdated() { |
| 414 callback_list_.Notify(); | 420 callback_list_.Notify(); |
| 415 } | 421 } |
| OLD | NEW |