OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_WINDOW_TRACKER_H_ | 5 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_WINDOW_TRACKER_H_ |
6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_WINDOW_TRACKER_H_ | 6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_WINDOW_TRACKER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "chrome/browser/automation/automation_resource_tracker.h" | 10 #include "chrome/browser/automation/automation_resource_tracker.h" |
11 #include "chrome/common/native_window_notification_source.h" | |
12 #include "gfx/native_widget_types.h" | 11 #include "gfx/native_widget_types.h" |
13 | 12 |
14 class AutomationWindowTracker | 13 class AutomationWindowTracker |
15 : public AutomationResourceTracker<gfx::NativeWindow> { | 14 : public AutomationResourceTracker<gfx::NativeWindow> { |
16 public: | 15 public: |
17 explicit AutomationWindowTracker(IPC::Message::Sender* automation) | 16 explicit AutomationWindowTracker(IPC::Message::Sender* automation); |
18 : AutomationResourceTracker<gfx::NativeWindow>(automation) { } | 17 virtual ~AutomationWindowTracker(); |
19 virtual ~AutomationWindowTracker() { | |
20 } | |
21 | 18 |
22 virtual void AddObserver(gfx::NativeWindow resource) { | 19 virtual void AddObserver(gfx::NativeWindow resource); |
23 registrar_.Add(this, NotificationType::WINDOW_CLOSED, | 20 virtual void RemoveObserver(gfx::NativeWindow resource); |
24 Source<gfx::NativeWindow>(resource)); | |
25 } | |
26 | |
27 virtual void RemoveObserver(gfx::NativeWindow resource) { | |
28 registrar_.Remove(this, NotificationType::WINDOW_CLOSED, | |
29 Source<gfx::NativeWindow>(resource)); | |
30 } | |
31 }; | 21 }; |
32 | 22 |
33 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_WINDOW_TRACKER_H_ | 23 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_WINDOW_TRACKER_H_ |
OLD | NEW |