Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Unified Diff: chrome/browser/google/google_url_tracker.cc

Issue 285193002: Create GoogleURLTrackerClient interface and //chrome implementation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/google/google_url_tracker.h ('k') | chrome/browser/google/google_url_tracker_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
}
« no previous file with comments | « chrome/browser/google/google_url_tracker.h ('k') | chrome/browser/google/google_url_tracker_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698