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_AURA_CLIENT_CAPTURE_CLIENT_H_ | 5 #ifndef UI_AURA_CLIENT_CAPTURE_CLIENT_H_ |
6 #define UI_AURA_CLIENT_CAPTURE_CLIENT_H_ | 6 #define UI_AURA_CLIENT_CAPTURE_CLIENT_H_ |
7 | 7 |
8 #include "ui/aura/aura_export.h" | 8 #include "ui/aura/aura_export.h" |
9 | 9 |
10 namespace aura { | 10 namespace aura { |
11 class Window; | 11 class Window; |
12 | 12 |
13 namespace client { | 13 namespace client { |
14 | 14 |
| 15 class CaptureClientObserver; |
| 16 |
15 // An interface implemented by an object that manages input capture. | 17 // An interface implemented by an object that manages input capture. |
16 class AURA_EXPORT CaptureClient { | 18 class AURA_EXPORT CaptureClient { |
17 public: | 19 public: |
18 // Does a capture on the |window|. | 20 // Does a capture on the |window|. |
19 virtual void SetCapture(Window* window) = 0; | 21 virtual void SetCapture(Window* window) = 0; |
20 | 22 |
21 // Releases a capture from the |window|. | 23 // Releases a capture from the |window|. |
22 virtual void ReleaseCapture(Window* window) = 0; | 24 virtual void ReleaseCapture(Window* window) = 0; |
23 | 25 |
24 // Returns the current capture window. This may only return a Window if the | 26 // Returns the current capture window. This may only return a Window if the |
25 // Window that has capture is a child of the Window the CaptureClient is | 27 // Window that has capture is a child of the Window the CaptureClient is |
26 // installed on. GetGlobalCaptureWindow() can be used to locate the Window | 28 // installed on. GetGlobalCaptureWindow() can be used to locate the Window |
27 // that has capture regardless of the Window the CaptureClient is installed | 29 // that has capture regardless of the Window the CaptureClient is installed |
28 // on. | 30 // on. |
29 virtual Window* GetCaptureWindow() = 0; | 31 virtual Window* GetCaptureWindow() = 0; |
30 | 32 |
31 // See description of GetCaptureWindow() for details. | 33 // See description of GetCaptureWindow() for details. |
32 virtual Window* GetGlobalCaptureWindow() = 0; | 34 virtual Window* GetGlobalCaptureWindow() = 0; |
33 | 35 |
| 36 virtual void AddObserver(CaptureClientObserver* observer) = 0; |
| 37 virtual void RemoveObserver(CaptureClientObserver* observer) = 0; |
| 38 |
34 protected: | 39 protected: |
35 virtual ~CaptureClient() {} | 40 virtual ~CaptureClient() {} |
36 }; | 41 }; |
37 | 42 |
38 // Sets/Gets the capture client on the root Window. | 43 // Sets/Gets the capture client on the root Window. |
39 AURA_EXPORT void SetCaptureClient(Window* root_window, | 44 AURA_EXPORT void SetCaptureClient(Window* root_window, |
40 CaptureClient* client); | 45 CaptureClient* client); |
41 AURA_EXPORT CaptureClient* GetCaptureClient(Window* root_window); | 46 AURA_EXPORT CaptureClient* GetCaptureClient(Window* root_window); |
42 | 47 |
43 // A utility function to get the current capture window. Returns NULL | 48 // A utility function to get the current capture window. Returns NULL |
44 // if the window doesn't have a root window, or there is no capture window. | 49 // if the window doesn't have a root window, or there is no capture window. |
45 AURA_EXPORT Window* GetCaptureWindow(Window* window); | 50 AURA_EXPORT Window* GetCaptureWindow(Window* window); |
46 | 51 |
47 } // namespace client | 52 } // namespace client |
48 } // namespace aura | 53 } // namespace aura |
49 | 54 |
50 #endif // UI_AURA_CLIENT_CAPTURE_CLIENT_H_ | 55 #endif // UI_AURA_CLIENT_CAPTURE_CLIENT_H_ |
OLD | NEW |