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 5f93554fc0ae05efedf3301636088277e3144cd2..62daab0ccc933f1b0796d69f4a2574ae36a3ed59 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,12 +35,15 @@ 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 : |
+ google_url_(mode == UNIT_TEST_MODE ? |
+ kDefaultGoogleHomepage : |
profile->GetPrefs()->GetString(prefs::kLastKnownGoogleURL)), |
fetcher_id_(0), |
in_startup_sleep_(true), |
@@ -49,6 +53,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 |
@@ -199,6 +204,7 @@ void GoogleURLTracker::OnIPAddressChanged() { |
} |
void GoogleURLTracker::Shutdown() { |
+ client_.reset(); |
nav_helper_.reset(); |
fetcher_.reset(); |
weak_ptr_factory_.InvalidateWeakPtrs(); |
@@ -269,8 +275,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); |
} |
} |
@@ -415,13 +421,13 @@ 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); |
} |
} |