OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_WM_CORE_CAPTURE_CONTROLLER_H_ | 5 #ifndef UI_WM_CORE_CAPTURE_CONTROLLER_H_ |
6 #define UI_WM_CORE_CAPTURE_CONTROLLER_H_ | 6 #define UI_WM_CORE_CAPTURE_CONTROLLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/compiler_specific.h" | |
11 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/observer_list.h" |
12 #include "ui/aura/client/capture_client.h" | 12 #include "ui/aura/client/capture_client.h" |
13 #include "ui/aura/window_observer.h" | 13 #include "ui/aura/window_observer.h" |
14 #include "ui/wm/wm_export.h" | 14 #include "ui/wm/wm_export.h" |
15 | 15 |
16 namespace aura { | 16 namespace aura { |
17 namespace client { | 17 namespace client { |
18 class CaptureDelegate; | 18 class CaptureDelegate; |
19 } | 19 } |
20 } | 20 } |
21 | 21 |
(...skipping 10 matching lines...) Expand all Loading... |
32 | 32 |
33 // Returns true if this CaptureController is installed on at least one | 33 // Returns true if this CaptureController is installed on at least one |
34 // root window. | 34 // root window. |
35 bool is_active() const { return !delegates_.empty(); } | 35 bool is_active() const { return !delegates_.empty(); } |
36 | 36 |
37 // Overridden from aura::client::CaptureClient: | 37 // Overridden from aura::client::CaptureClient: |
38 void SetCapture(aura::Window* window) override; | 38 void SetCapture(aura::Window* window) override; |
39 void ReleaseCapture(aura::Window* window) override; | 39 void ReleaseCapture(aura::Window* window) override; |
40 aura::Window* GetCaptureWindow() override; | 40 aura::Window* GetCaptureWindow() override; |
41 aura::Window* GetGlobalCaptureWindow() override; | 41 aura::Window* GetGlobalCaptureWindow() override; |
| 42 void AddObserver(aura::client::CaptureClientObserver* observer) override; |
| 43 void RemoveObserver(aura::client::CaptureClientObserver* observer) override; |
42 | 44 |
43 private: | 45 private: |
44 friend class ScopedCaptureClient; | 46 friend class ScopedCaptureClient; |
45 | 47 |
46 CaptureController(); | 48 CaptureController(); |
47 ~CaptureController() override; | 49 ~CaptureController() override; |
48 | 50 |
49 // The current capture window. NULL if there is no capture window. | 51 // The current capture window. NULL if there is no capture window. |
50 aura::Window* capture_window_; | 52 aura::Window* capture_window_; |
51 | 53 |
52 // The capture delegate for the root window with native capture. The root | 54 // The capture delegate for the root window with native capture. The root |
53 // window with native capture may not contain |capture_window_|. This occurs | 55 // window with native capture may not contain |capture_window_|. This occurs |
54 // if |capture_window_| is reparented to a different root window while it has | 56 // if |capture_window_| is reparented to a different root window while it has |
55 // capture. | 57 // capture. |
56 aura::client::CaptureDelegate* capture_delegate_; | 58 aura::client::CaptureDelegate* capture_delegate_; |
57 | 59 |
58 // The delegates notified when capture changes. | 60 // The delegates notified when capture changes. |
59 std::map<aura::Window*, aura::client::CaptureDelegate*> delegates_; | 61 std::map<aura::Window*, aura::client::CaptureDelegate*> delegates_; |
60 | 62 |
| 63 base::ObserverList<aura::client::CaptureClientObserver> observers_; |
| 64 |
61 DISALLOW_COPY_AND_ASSIGN(CaptureController); | 65 DISALLOW_COPY_AND_ASSIGN(CaptureController); |
62 }; | 66 }; |
63 | 67 |
64 // ScopedCaptureClient is responsible for creating a CaptureClient for a | 68 // ScopedCaptureClient is responsible for creating a CaptureClient for a |
65 // RootWindow. Specifically it creates a single CaptureController that is shared | 69 // RootWindow. Specifically it creates a single CaptureController that is shared |
66 // among all ScopedCaptureClients and adds the RootWindow to it. | 70 // among all ScopedCaptureClients and adds the RootWindow to it. |
67 class WM_EXPORT ScopedCaptureClient : public aura::WindowObserver { | 71 class WM_EXPORT ScopedCaptureClient : public aura::WindowObserver { |
68 public: | 72 public: |
69 class WM_EXPORT TestApi { | 73 class WM_EXPORT TestApi { |
70 public: | 74 public: |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 107 |
104 // RootWindow this ScopedCaptureClient was create for. | 108 // RootWindow this ScopedCaptureClient was create for. |
105 aura::Window* root_window_; | 109 aura::Window* root_window_; |
106 | 110 |
107 DISALLOW_COPY_AND_ASSIGN(ScopedCaptureClient); | 111 DISALLOW_COPY_AND_ASSIGN(ScopedCaptureClient); |
108 }; | 112 }; |
109 | 113 |
110 } // namespace wm | 114 } // namespace wm |
111 | 115 |
112 #endif // UI_WM_CORE_CAPTURE_CONTROLLER_H_ | 116 #endif // UI_WM_CORE_CAPTURE_CONTROLLER_H_ |
OLD | NEW |