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