| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_BROWSER_TRACKER_H__ | 5 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_BROWSER_TRACKER_H__ |
| 6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_BROWSER_TRACKER_H__ | 6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_BROWSER_TRACKER_H__ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/automation/automation_resource_tracker.h" | 9 #include "chrome/browser/automation/automation_resource_tracker.h" |
| 10 #include "chrome/browser/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 11 #include "chrome/common/notification_source.h" | 11 #include "chrome/common/notification_source.h" |
| 12 | 12 |
| 13 // Tracks Browser objects. | 13 // Tracks Browser objects. |
| 14 class AutomationBrowserTracker : public AutomationResourceTracker<Browser*> { | 14 class AutomationBrowserTracker : public AutomationResourceTracker<Browser*> { |
| 15 public: | 15 public: |
| 16 explicit AutomationBrowserTracker(IPC::Message::Sender* automation) | 16 explicit AutomationBrowserTracker(IPC::Message::Sender* automation) |
| 17 : AutomationResourceTracker<Browser*>(automation) { } | 17 : AutomationResourceTracker<Browser*>(automation) { } |
| 18 | 18 |
| 19 virtual ~AutomationBrowserTracker() { | 19 virtual ~AutomationBrowserTracker() { |
| 20 } | 20 } |
| 21 | 21 |
| 22 virtual void AddObserver(Browser* resource) { | 22 virtual void AddObserver(Browser* resource) { |
| 23 registrar_.Add(this, NotificationType::BROWSER_CLOSED, | 23 registrar_.Add(this, NotificationType::BROWSER_CLOSED, |
| 24 Source<Browser>(resource)); | 24 Source<Browser>(resource)); |
| 25 } | 25 } |
| 26 | 26 |
| 27 virtual void RemoveObserver(Browser* resource) { | 27 virtual void RemoveObserver(Browser* resource) { |
| 28 registrar_.Remove(this, NotificationType::BROWSER_CLOSED, | 28 registrar_.Remove(this, NotificationType::BROWSER_CLOSED, |
| 29 Source<Browser>(resource)); | 29 Source<Browser>(resource)); |
| 30 } | 30 } |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_BROWSER_TRACKER_H__ | 33 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_BROWSER_TRACKER_H__ |
| OLD | NEW |