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

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

Issue 303233006: Abstract GoogleURLTracker & google_util Profile dependencies (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Build fix and 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_profile_helper.cc ('k') | chrome/browser/google/google_url_tracker.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.h
diff --git a/chrome/browser/google/google_url_tracker.h b/chrome/browser/google/google_url_tracker.h
index 207ac7b8cca0cdf6daa112e3f3b57d4d563b0e2e..3687427cded32fed580f12ea82e1a381ef638e3e 100644
--- a/chrome/browser/google/google_url_tracker.h
+++ b/chrome/browser/google/google_url_tracker.h
@@ -34,11 +34,9 @@ class InfoBar;
// change, and if necessary prompting the user to see if they want to change to
// using it. The current and last prompted values are saved to prefs.
//
-// Most consumers should only call GoogleURL(), which is guaranteed to
-// synchronously return a value at all times (even during startup or in unittest
-// mode). Consumers who need to be notified when things change should register
-// a callback that provides the original and updated values via
-// RegisterCallback().
+// Most consumers should only call google_url(). Consumers who need to be
+// notified when things change should register a callback that provides the
+// original and updated values via RegisterCallback().
//
// To protect users' privacy and reduce server load, no updates will be
// performed (ever) unless at least one consumer registers interest by calling
@@ -61,22 +59,16 @@ class GoogleURLTracker : public net::URLFetcherDelegate,
};
static const char kDefaultGoogleHomepage[];
- static const char kSearchDomainCheckURL[];
- // Only the GoogleURLTrackerFactory and tests should call this. No code other
- // than the GoogleURLTracker itself should actually use
- // GoogleURLTrackerFactory::GetForProfile().
+ // Only the GoogleURLTrackerFactory and tests should call this.
GoogleURLTracker(Profile* profile,
scoped_ptr<GoogleURLTrackerClient> client,
Mode mode);
virtual ~GoogleURLTracker();
- // Returns the current Google URL. This will return a valid URL even if
- // |profile| is NULL or a testing profile.
- //
- // This is the only function most code should ever call.
- static GURL GoogleURL(Profile* profile);
+ // Returns the current Google homepage URL.
+ const GURL& google_url() const { return google_url_; }
// Requests that the tracker perform a server check to update the Google URL
// as necessary. If |force| is false, this will happen at most once per
@@ -85,30 +77,25 @@ class GoogleURLTracker : public net::URLFetcherDelegate,
// will occur immediately, if no other checks have been made during this run).
// If |force| is true, and the tracker has already performed any requested
// check, it will check again.
- //
- // When |profile| is NULL or a testing profile, this function does nothing.
- static void RequestServerCheck(Profile* profile, bool force);
+ void RequestServerCheck(bool force);
// Notifies the tracker that the user has started a Google search.
// If prompting is necessary, we then listen for the subsequent pending
- // navigation to get the appropriate NavigationController. When the load
+ // navigation to get the appropriate NavigationHelper. When the load
// commits, we'll show the infobar.
- //
- // When |profile| is NULL or a testing profile, this function does nothing.
- static void GoogleURLSearchCommitted(Profile* profile);
+ void SearchCommitted();
// No one but GoogleURLTrackerInfoBarDelegate or test code should call these.
void AcceptGoogleURL(bool redo_searches);
void CancelGoogleURL();
- const GURL& google_url() const { return google_url_; }
const GURL& fetched_google_url() const { return fetched_google_url_; }
// No one but GoogleURLTrackerMapEntry should call this.
void DeleteMapEntryForManager(
const infobars::InfoBarManager* infobar_manager);
- // Called by the client after SearchCommitted() registers listeners, to
- // indicate that we've received the "load now pending" notification.
+ // Called by the client after SearchCommitted() registers listeners,
+ // to indicate that we've received the "load now pending" notification.
// |nav_helper| is the GoogleURLTrackerNavigationHelper associated with this
// navigation; |infobar_manager| is the InfoBarManager of the associated tab;
// and |pending_id| is the unique ID of the newly pending NavigationEntry.
@@ -134,10 +121,13 @@ class GoogleURLTracker : public net::URLFetcherDelegate,
private:
friend class GoogleURLTrackerTest;
+ friend class SyncTest;
typedef std::map<const infobars::InfoBarManager*, GoogleURLTrackerMapEntry*>
EntryMap;
+ static const char kSearchDomainCheckURL[];
+
// net::URLFetcherDelegate:
virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
@@ -160,11 +150,6 @@ class GoogleURLTracker : public net::URLFetcherDelegate,
// it and can currently do so.
void StartFetchIfDesirable();
- // Called each time the user performs a search. This checks whether we need
- // to prompt the user about a domain change, and if so, starts listening for
- // the notifications sent when the actual load is triggered.
- void SearchCommitted();
-
// Closes all map entries. If |redo_searches| is true, this also triggers
// each tab with an infobar to re-perform the user's search, but on the new
// Google TLD.
« no previous file with comments | « chrome/browser/google/google_profile_helper.cc ('k') | chrome/browser/google/google_url_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698