| Index: chrome/browser/google/google_url_tracker.cc
|
| diff --git a/chrome/browser/google/google_url_tracker.cc b/chrome/browser/google/google_url_tracker.cc
|
| index 535cbbaa8ecac4a3a3c9bec030592abe7f3d8783..e81fc282bbe6d06a9abb12c0cfef939af731e22c 100644
|
| --- a/chrome/browser/google/google_url_tracker.cc
|
| +++ b/chrome/browser/google/google_url_tracker.cc
|
| @@ -17,6 +17,7 @@
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/common/chrome_switches.h"
|
| #include "chrome/common/pref_names.h"
|
| +#include "components/google/core/browser/google_url_tracker_client.h"
|
| #include "components/infobars/core/infobar.h"
|
| #include "content/public/browser/navigation_controller.h"
|
| #include "content/public/browser/navigation_entry.h"
|
| @@ -34,9 +35,11 @@ const char GoogleURLTracker::kSearchDomainCheckURL[] =
|
|
|
| GoogleURLTracker::GoogleURLTracker(
|
| Profile* profile,
|
| + scoped_ptr<GoogleURLTrackerClient> client,
|
| scoped_ptr<GoogleURLTrackerNavigationHelper> nav_helper,
|
| Mode mode)
|
| : profile_(profile),
|
| + client_(client.Pass()),
|
| nav_helper_(nav_helper.Pass()),
|
| infobar_creator_(base::Bind(&GoogleURLTrackerInfoBarDelegate::Create)),
|
| google_url_(mode == UNIT_TEST_MODE ? kDefaultGoogleHomepage :
|
| @@ -49,6 +52,7 @@ GoogleURLTracker::GoogleURLTracker(
|
| search_committed_(false),
|
| weak_ptr_factory_(this) {
|
| net::NetworkChangeNotifier::AddIPAddressObserver(this);
|
| + client_->set_google_url_tracker(this);
|
| nav_helper_->SetGoogleURLTracker(this);
|
|
|
| // Because this function can be called during startup, when kicking off a URL
|
| @@ -201,6 +205,7 @@ void GoogleURLTracker::OnIPAddressChanged() {
|
| }
|
|
|
| void GoogleURLTracker::Shutdown() {
|
| + client_.reset();
|
| nav_helper_.reset();
|
| fetcher_.reset();
|
| weak_ptr_factory_.InvalidateWeakPtrs();
|
| @@ -271,8 +276,8 @@ void GoogleURLTracker::SearchCommitted() {
|
| search_committed_ = true;
|
| // These notifications will fire a bit later in the same call chain we're
|
| // currently in.
|
| - if (!nav_helper_->IsListeningForNavigationStart())
|
| - nav_helper_->SetListeningForNavigationStart(true);
|
| + if (!client_->IsListeningForNavigationStart())
|
| + client_->SetListeningForNavigationStart(true);
|
| }
|
| }
|
|
|
| @@ -412,12 +417,12 @@ void GoogleURLTracker::UnregisterForEntrySpecificNotifications(
|
| ++i) {
|
| if (nav_helper_->IsListeningForNavigationCommit(
|
| i->second->navigation_controller())) {
|
| - DCHECK(nav_helper_->IsListeningForNavigationStart());
|
| + DCHECK(client_->IsListeningForNavigationStart());
|
| return;
|
| }
|
| }
|
| - if (nav_helper_->IsListeningForNavigationStart()) {
|
| + if (client_->IsListeningForNavigationStart()) {
|
| DCHECK(!search_committed_);
|
| - nav_helper_->SetListeningForNavigationStart(false);
|
| + client_->SetListeningForNavigationStart(false);
|
| }
|
| }
|
|
|