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..aa368692dcc4d086f4f2e99088e94660685b7a87 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,13 +35,16 @@ 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 : |
- profile->GetPrefs()->GetString(prefs::kLastKnownGoogleURL)), |
+ google_url_(mode == UNIT_TEST_MODE ? kDefaultGoogleHomepage |
+ : profile->GetPrefs()->GetString( |
+ prefs::kLastKnownGoogleURL)), |
Peter Kasting
2014/05/16 23:21:08
Nit: Wrap like:
google_url_((mode == UNIT_T
blundell
2014/05/17 19:06:07
Done.
|
fetcher_id_(0), |
in_startup_sleep_(true), |
already_fetched_(false), |
@@ -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 |
@@ -201,6 +206,7 @@ void GoogleURLTracker::OnIPAddressChanged() { |
} |
void GoogleURLTracker::Shutdown() { |
+ client_.reset(); |
nav_helper_.reset(); |
fetcher_.reset(); |
weak_ptr_factory_.InvalidateWeakPtrs(); |
@@ -271,8 +277,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 +418,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); |
} |
} |