OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_ | 5 #ifndef ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_ |
6 #define ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_ | 6 #define ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "ui/aura/window_tree_host.h" | |
13 #include "ui/aura/window_tree_host_observer.h" | 12 #include "ui/aura/window_tree_host_observer.h" |
14 #include "ui/gfx/display.h" | |
15 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
16 #include "ui/gfx/point.h" | |
17 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
18 | 15 |
19 namespace aura { | 16 namespace aura { |
20 class RootWindowTransformer; | |
21 class Window; | 17 class Window; |
22 } | 18 } |
23 | 19 |
24 namespace ui { | 20 namespace ui { |
25 class Reflector; | 21 class Reflector; |
26 } | 22 } |
27 | 23 |
28 namespace ash { | 24 namespace ash { |
| 25 class AshWindowTreeHost; |
29 class DisplayInfo; | 26 class DisplayInfo; |
| 27 class RootWindowTransformer; |
30 | 28 |
31 namespace test{ | 29 namespace test{ |
32 class MirrorWindowTestApi; | 30 class MirrorWindowTestApi; |
33 } | 31 } |
34 | 32 |
35 // An object that copies the content of the primary root window to a | 33 // An object that copies the content of the primary root window to a |
36 // mirror window. This also draws a mouse cursor as the mouse cursor | 34 // mirror window. This also draws a mouse cursor as the mouse cursor |
37 // is typically drawn by the window system. | 35 // is typically drawn by the window system. |
38 class ASH_EXPORT MirrorWindowController : public aura::WindowTreeHostObserver { | 36 class ASH_EXPORT MirrorWindowController : public aura::WindowTreeHostObserver { |
39 public: | 37 public: |
40 MirrorWindowController(); | 38 MirrorWindowController(); |
41 virtual ~MirrorWindowController(); | 39 virtual ~MirrorWindowController(); |
42 | 40 |
43 // Updates the root window's bounds using |display_info|. | 41 // Updates the root window's bounds using |display_info|. |
44 // Creates the new root window if one doesn't exist. | 42 // Creates the new root window if one doesn't exist. |
45 void UpdateWindow(const DisplayInfo& display_info); | 43 void UpdateWindow(const DisplayInfo& display_info); |
46 | 44 |
47 // Same as above, but using existing display info | 45 // Same as above, but using existing display info |
48 // for the mirrored display. | 46 // for the mirrored display. |
49 void UpdateWindow(); | 47 void UpdateWindow(); |
50 | 48 |
51 // Close the mirror window. | 49 // Close the mirror window. |
52 void Close(); | 50 void Close(); |
53 | 51 |
54 // aura::WindowTreeHostObserver overrides: | 52 // aura::WindowTreeHostObserver overrides: |
55 virtual void OnHostResized(const aura::WindowTreeHost* host) OVERRIDE; | 53 virtual void OnHostResized(const aura::WindowTreeHost* host) OVERRIDE; |
56 | 54 |
57 aura::WindowTreeHost* host() const { return host_.get(); } | 55 // Return the root window used to mirror the content. NULL if the |
| 56 // display is not mirrored by the compositor path. |
| 57 aura::Window* GetWindow(); |
58 | 58 |
59 private: | 59 private: |
60 friend class test::MirrorWindowTestApi; | 60 friend class test::MirrorWindowTestApi; |
61 | 61 |
62 // Creates a RootWindowTransformer for current display | 62 // Creates a RootWindowTransformer for current display |
63 // configuration. | 63 // configuration. |
64 scoped_ptr<aura::RootWindowTransformer> CreateRootWindowTransformer() const; | 64 scoped_ptr<RootWindowTransformer> CreateRootWindowTransformer() const; |
65 | 65 |
66 scoped_ptr<aura::WindowTreeHost> host_; | 66 scoped_ptr<AshWindowTreeHost> ash_host_; |
67 gfx::Size mirror_window_host_size_; | 67 gfx::Size mirror_window_host_size_; |
68 scoped_refptr<ui::Reflector> reflector_; | 68 scoped_refptr<ui::Reflector> reflector_; |
69 | 69 |
70 DISALLOW_COPY_AND_ASSIGN(MirrorWindowController); | 70 DISALLOW_COPY_AND_ASSIGN(MirrorWindowController); |
71 }; | 71 }; |
72 | 72 |
73 } // namespace ash | 73 } // namespace ash |
74 | 74 |
75 #endif // ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_ | 75 #endif // ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_ |
OLD | NEW |