summaryrefslogtreecommitdiffstats
path: root/chrome/browser/automation/automation_tab_tracker.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/automation/automation_tab_tracker.h')
-rw-r--r--chrome/browser/automation/automation_tab_tracker.h42
1 files changed, 22 insertions, 20 deletions
diff --git a/chrome/browser/automation/automation_tab_tracker.h b/chrome/browser/automation/automation_tab_tracker.h
index 1033ad0..9e0c63c 100644
--- a/chrome/browser/automation/automation_tab_tracker.h
+++ b/chrome/browser/automation/automation_tab_tracker.h
@@ -2,14 +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_AUTOMATION_AUTOMATION_TAB_TRACKER_H_
-#define CHROME_BROWSER_AUTOMATION_AUTOMATION_TAB_TRACKER_H_
+#ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_TAB_TRACKER_H__
+#define CHROME_BROWSER_AUTOMATION_AUTOMATION_TAB_TRACKER_H__
#include "chrome/browser/automation/automation_resource_tracker.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/navigation_controller.h"
-#include "chrome/common/notification_registrar.h"
class AutomationTabTracker
: public AutomationResourceTracker<NavigationController*> {
@@ -23,24 +22,28 @@ 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,
- Source<NavigationController>(resource));
- registrar_.Add(this, NOTIFY_EXTERNAL_TAB_CLOSED,
- Source<NavigationController>(resource));
+ // Register for both notifications
+ NotificationService::current()->AddObserver(
+ this, NOTIFY_TAB_CLOSING, Source<NavigationController>(resource));
+ NotificationService::current()->AddObserver(
+ this, NOTIFY_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,
- Source<NavigationController>(resource));
+ NotificationService::current()->AddObserver(
+ this, NOTIFY_NAV_ENTRY_COMMITTED,
+ Source<NavigationController>(resource));
}
virtual void RemoveObserver(NavigationController* resource) {
- registrar_.Remove(this, NOTIFY_TAB_CLOSING,
- Source<NavigationController>(resource));
- registrar_.Remove(this, NOTIFY_EXTERNAL_TAB_CLOSED,
- Source<NavigationController>(resource));
- registrar_.Remove(this, NOTIFY_NAV_ENTRY_COMMITTED,
- Source<NavigationController>(resource));
+ NotificationService::current()->RemoveObserver(
+ this, NOTIFY_TAB_CLOSING, Source<NavigationController>(resource));
+ NotificationService::current()->RemoveObserver(
+ this, NOTIFY_EXTERNAL_TAB_CLOSED,
+ Source<NavigationController>(resource));
+ NotificationService::current()->RemoveObserver(
+ this, NOTIFY_NAV_ENTRY_COMMITTED,
+ Source<NavigationController>(resource));
}
virtual void Observe(NotificationType type,
@@ -77,12 +80,11 @@ public:
}
private:
- NotificationRegistrar registrar_;
-
// Last time a navigation occurred.
- std::map<NavigationController*, base::Time> last_navigation_times_;
+ std::map<NavigationController*, base::Time> last_navigation_times_;
DISALLOW_COPY_AND_ASSIGN(AutomationTabTracker);
};
-#endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_TAB_TRACKER_H_
+#endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_TAB_TRACKER_H__
+