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