diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-01 18:16:56 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-01 18:16:56 +0000 |
commit | bfd04a62ce610d7bb61dbb78811dccbed23589b7 (patch) | |
tree | 70bb228c0f00ba1c12c584efd569daccf96b4026 /chrome/browser/automation/automation_tab_tracker.h | |
parent | a814d863440f0a154a7299f2d8b440f405c7700e (diff) | |
download | chromium_src-bfd04a62ce610d7bb61dbb78811dccbed23589b7.zip chromium_src-bfd04a62ce610d7bb61dbb78811dccbed23589b7.tar.gz chromium_src-bfd04a62ce610d7bb61dbb78811dccbed23589b7.tar.bz2 |
Remove most header file dependencies on the notification type list. It is
really painful to add more types, since lots of headers include the
notification service to derive from the notification observer. This splits that
out, so much less of the project should end up including notification_types.h
---Paths modified but not in any changelist:
Review URL: http://codereview.chromium.org/19744
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9020 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation/automation_tab_tracker.h')
-rw-r--r-- | chrome/browser/automation/automation_tab_tracker.h | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/chrome/browser/automation/automation_tab_tracker.h b/chrome/browser/automation/automation_tab_tracker.h index a221ae4..d119915 100644 --- a/chrome/browser/automation/automation_tab_tracker.h +++ b/chrome/browser/automation/automation_tab_tracker.h @@ -10,12 +10,13 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/tab_contents/navigation_controller.h" #include "chrome/common/notification_registrar.h" +#include "chrome/common/notification_type.h" class AutomationTabTracker : public AutomationResourceTracker<NavigationController*> { public: AutomationTabTracker(IPC::Message::Sender* automation) - : AutomationResourceTracker(automation) {} + : AutomationResourceTracker(automation) {} virtual ~AutomationTabTracker() { ClearAllMappings(); @@ -24,35 +25,35 @@ public: virtual void AddObserver(NavigationController* resource) { // This tab could either be a regular tab or an external tab // Register for both notifications. - registrar_.Add(this, NOTIFY_TAB_CLOSING, + registrar_.Add(this, NotificationType::TAB_CLOSING, Source<NavigationController>(resource)); - registrar_.Add(this, NOTIFY_EXTERNAL_TAB_CLOSED, + registrar_.Add(this, NotificationType::EXTERNAL_TAB_CLOSED, Source<NavigationController>(resource)); // We also want to know about navigations so we can keep track of the last // navigation time. - registrar_.Add(this, NOTIFY_NAV_ENTRY_COMMITTED, + registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, Source<NavigationController>(resource)); } virtual void RemoveObserver(NavigationController* resource) { - registrar_.Remove(this, NOTIFY_TAB_CLOSING, + registrar_.Remove(this, NotificationType::TAB_CLOSING, Source<NavigationController>(resource)); - registrar_.Remove(this, NOTIFY_EXTERNAL_TAB_CLOSED, + registrar_.Remove(this, NotificationType::EXTERNAL_TAB_CLOSED, Source<NavigationController>(resource)); - registrar_.Remove(this, NOTIFY_NAV_ENTRY_COMMITTED, + registrar_.Remove(this, NotificationType::NAV_ENTRY_COMMITTED, Source<NavigationController>(resource)); } virtual void Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { - switch (type) { - case NOTIFY_NAV_ENTRY_COMMITTED: + switch (type.value) { + case NotificationType::NAV_ENTRY_COMMITTED: last_navigation_times_[Source<NavigationController>(source).ptr()] = base::Time::Now(); return; - case NOTIFY_EXTERNAL_TAB_CLOSED: - case NOTIFY_TAB_CLOSING: + case NotificationType::EXTERNAL_TAB_CLOSED: + case NotificationType::TAB_CLOSING: std::map<NavigationController*, base::Time>::iterator iter = last_navigation_times_.find( Source<NavigationController>(source).ptr()); |