OLD | NEW |
1 // Copyright (c) 2010 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_FRAME_TEST_WINDOW_WATCHDOG_H_ | 5 #ifndef CHROME_FRAME_TEST_WINDOW_WATCHDOG_H_ |
6 #define CHROME_FRAME_TEST_WINDOW_WATCHDOG_H_ | 6 #define CHROME_FRAME_TEST_WINDOW_WATCHDOG_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 struct FunctionStub; | 13 struct FunctionStub; |
14 | 14 |
15 // Interface implemented by WindowWatchdog users. An observer can register | 15 // Interface implemented by WindowWatchdog users. An observer can register |
16 // for notifications on multiple window classes. | 16 // for notifications on multiple window classes. |
17 class WindowObserver { // NOLINT | 17 class WindowObserver { // NOLINT |
18 public: | 18 public: |
19 virtual void OnWindowDetected(HWND hwnd, const std::string& caption) = 0; | 19 virtual void OnWindowDetected(HWND hwnd, const std::string& caption) = 0; |
| 20 |
| 21 protected: |
| 22 virtual ~WindowObserver() {} |
20 }; | 23 }; |
21 | 24 |
22 // Watch a for window to be shown with the given window class name. | 25 // Watch a for window to be shown with the given window class name. |
23 // If found, call the observer interested in it. | 26 // If found, call the observer interested in it. |
24 class WindowWatchdog { | 27 class WindowWatchdog { |
25 public: | 28 public: |
26 WindowWatchdog(); | 29 WindowWatchdog(); |
27 ~WindowWatchdog(); | 30 ~WindowWatchdog(); |
28 | 31 |
29 // Register for notifications for |window_class|. An observer can register | 32 // Register for notifications for |window_class|. An observer can register |
(...skipping 21 matching lines...) Expand all Loading... |
51 | 54 |
52 typedef std::vector<WindowObserverEntry> ObserverMap; | 55 typedef std::vector<WindowObserverEntry> ObserverMap; |
53 | 56 |
54 HWINEVENTHOOK hook_; | 57 HWINEVENTHOOK hook_; |
55 ObserverMap observers_; | 58 ObserverMap observers_; |
56 FunctionStub* hook_stub_; | 59 FunctionStub* hook_stub_; |
57 }; | 60 }; |
58 | 61 |
59 | 62 |
60 #endif // CHROME_FRAME_TEST_WINDOW_WATCHDOG_H_ | 63 #endif // CHROME_FRAME_TEST_WINDOW_WATCHDOG_H_ |
OLD | NEW |