diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-16 20:16:08 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-16 20:16:08 +0000 |
commit | d778c4701b5e5ffec54eee51d2427836f4f5c0b1 (patch) | |
tree | 850ae017300e5a83d4a4775451051ffc2c9187bd /chrome/browser/alternate_nav_url_fetcher.h | |
parent | 90e2b34d20d3cf5662ea8776580b9e437b4698a8 (diff) | |
download | chromium_src-d778c4701b5e5ffec54eee51d2427836f4f5c0b1.zip chromium_src-d778c4701b5e5ffec54eee51d2427836f4f5c0b1.tar.gz chromium_src-d778c4701b5e5ffec54eee51d2427836f4f5c0b1.tar.bz2 |
Remove an explicit call from the NavigationController to the alternate URL
fetcher since there is already a notification that does this.
I created a class that will automatically unregister for notifications when it
goes out of scope and used it here. I think it will be useful for most consumers
of notifications.
Review URL: http://codereview.chromium.org/2895
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2276 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/alternate_nav_url_fetcher.h')
-rw-r--r-- | chrome/browser/alternate_nav_url_fetcher.h | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/chrome/browser/alternate_nav_url_fetcher.h b/chrome/browser/alternate_nav_url_fetcher.h index b259a64..94833a4 100644 --- a/chrome/browser/alternate_nav_url_fetcher.h +++ b/chrome/browser/alternate_nav_url_fetcher.h @@ -2,12 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_ALTERNATE_NAV_URL_FETCHER_H__ -#define CHROME_BROWSER_ALTERNATE_NAV_URL_FETCHER_H__ +#ifndef CHROME_BROWSER_ALTERNATE_NAV_URL_FETCHER_H_ +#define CHROME_BROWSER_ALTERNATE_NAV_URL_FETCHER_H_ #include <string> #include "chrome/browser/url_fetcher.h" +#include "chrome/common/notification_registrar.h" #include "chrome/common/notification_service.h" class NavigationController; @@ -32,12 +33,6 @@ class AlternateNavURLFetcher : public NotificationObserver, State state() const { return state_; } - // Called by the NavigationController when it successfully navigates to the - // entry for which the fetcher is looking up an alternative. - // NOTE: This can be theoretically called multiple times, if multiple - // navigations with the same unique ID succeed. - void OnNavigatedToEntry(); - // NotificationObserver virtual void Observe(NotificationType type, const NotificationSource& source, @@ -52,7 +47,9 @@ class AlternateNavURLFetcher : public NotificationObserver, const std::string& data); private: - void ShowInfobar(); + // Displays the infobar if all conditions are met (the page has loaded and + // the fetch of the alternate URL succeeded). + void ShowInfobarIfPossible(); std::wstring alternate_nav_url_; scoped_ptr<URLFetcher> fetcher_; @@ -60,8 +57,10 @@ class AlternateNavURLFetcher : public NotificationObserver, State state_; bool navigated_to_entry_; - DISALLOW_EVIL_CONSTRUCTORS(AlternateNavURLFetcher); + NotificationRegistrar registrar_; + + DISALLOW_COPY_AND_ASSIGN(AlternateNavURLFetcher); }; -#endif // CHROME_BROWSER_ALTERNATE_NAV_URL_FETCHER_H__ +#endif // CHROME_BROWSER_ALTERNATE_NAV_URL_FETCHER_H_ |