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_ROOT_WINDOW_HOST_H_ | 5 #ifndef UI_AURA_ROOT_WINDOW_HOST_H_ |
6 #define UI_AURA_ROOT_WINDOW_HOST_H_ | 6 #define UI_AURA_ROOT_WINDOW_HOST_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "ui/aura/aura_export.h" | 11 #include "ui/aura/aura_export.h" |
12 #include "ui/base/cursor/cursor.h" | 12 #include "ui/base/cursor/cursor.h" |
13 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
14 | 14 |
15 namespace gfx { | 15 namespace gfx { |
16 class Insets; | 16 class Insets; |
17 class Point; | 17 class Point; |
18 class Rect; | 18 class Rect; |
19 class Size; | 19 class Size; |
20 class Transform; | 20 class Transform; |
21 } | 21 } |
22 | 22 |
23 namespace ui { | 23 namespace ui { |
24 class Compositor; | 24 class Compositor; |
25 } | 25 } |
26 | 26 |
27 namespace aura { | 27 namespace aura { |
28 | 28 |
29 class RootWindow; | 29 class RootWindow; |
30 class WindowTreeHostDelegate; | 30 class RootWindowHostDelegate; |
31 class RootWindowTransformer; | 31 class RootWindowTransformer; |
32 | 32 |
33 // WindowTreeHost bridges between a native window and the embedded RootWindow. | 33 // RootWindowHost bridges between a native window and the embedded RootWindow. |
34 // It provides the accelerated widget and maps events from the native os to | 34 // It provides the accelerated widget and maps events from the native os to |
35 // aura. | 35 // aura. |
36 class AURA_EXPORT WindowTreeHost { | 36 class AURA_EXPORT RootWindowHost { |
37 public: | 37 public: |
38 virtual ~WindowTreeHost(); | 38 virtual ~RootWindowHost(); |
39 | 39 |
40 // Creates a new WindowTreeHost. The caller owns the returned value. | 40 // Creates a new RootWindowHost. The caller owns the returned value. |
41 static WindowTreeHost* Create(const gfx::Rect& bounds); | 41 static RootWindowHost* Create(const gfx::Rect& bounds); |
42 | 42 |
43 void InitHost(); | 43 void InitHost(); |
44 | 44 |
45 // TODO(beng): these will become trivial accessors in a future CL. | 45 // TODO(beng): these will become trivial accessors in a future CL. |
46 aura::Window* window(); | 46 aura::Window* window(); |
47 const aura::Window* window() const; | 47 const aura::Window* window() const; |
48 | 48 |
49 ui::Compositor* compositor() { return compositor_.get(); } | 49 ui::Compositor* compositor() { return compositor_.get(); } |
50 | 50 |
51 void SetRootWindowTransformer(scoped_ptr<RootWindowTransformer> transformer); | 51 void SetRootWindowTransformer(scoped_ptr<RootWindowTransformer> transformer); |
52 gfx::Transform GetRootTransform() const; | 52 gfx::Transform GetRootTransform() const; |
53 | 53 |
54 void SetTransform(const gfx::Transform& transform); | 54 void SetTransform(const gfx::Transform& transform); |
55 | 55 |
56 gfx::Transform GetInverseRootTransform() const; | 56 gfx::Transform GetInverseRootTransform() const; |
57 | 57 |
58 // Updates the root window's size using |host_size|, current | 58 // Updates the root window's size using |host_size|, current |
59 // transform and insets. | 59 // transform and insets. |
60 void UpdateRootWindowSize(const gfx::Size& host_size); | 60 void UpdateRootWindowSize(const gfx::Size& host_size); |
61 | 61 |
62 // Returns the actual size of the screen. | 62 // Returns the actual size of the screen. |
63 // (gfx::Screen only reports on the virtual desktop exposed by Aura.) | 63 // (gfx::Screen only reports on the virtual desktop exposed by Aura.) |
64 static gfx::Size GetNativeScreenSize(); | 64 static gfx::Size GetNativeScreenSize(); |
65 | 65 |
66 void set_delegate(WindowTreeHostDelegate* delegate) { | 66 void set_delegate(RootWindowHostDelegate* delegate) { |
67 delegate_ = delegate; | 67 delegate_ = delegate; |
68 } | 68 } |
69 | 69 |
70 // Converts |point| from the root window's coordinate system to native | 70 // Converts |point| from the root window's coordinate system to native |
71 // screen's. | 71 // screen's. |
72 void ConvertPointToNativeScreen(gfx::Point* point) const; | 72 void ConvertPointToNativeScreen(gfx::Point* point) const; |
73 | 73 |
74 // Converts |point| from native screen coordinate system to the root window's. | 74 // Converts |point| from native screen coordinate system to the root window's. |
75 void ConvertPointFromNativeScreen(gfx::Point* point) const; | 75 void ConvertPointFromNativeScreen(gfx::Point* point) const; |
76 | 76 |
77 // Converts |point| from the root window's coordinate system to the | 77 // Converts |point| from the root window's coordinate system to the |
78 // host window's. | 78 // host window's. |
79 void ConvertPointToHost(gfx::Point* point) const; | 79 void ConvertPointToHost(gfx::Point* point) const; |
80 | 80 |
81 // Converts |point| from the host window's coordinate system to the | 81 // Converts |point| from the host window's coordinate system to the |
82 // root window's. | 82 // root window's. |
83 void ConvertPointFromHost(gfx::Point* point) const; | 83 void ConvertPointFromHost(gfx::Point* point) const; |
84 | 84 |
85 virtual RootWindow* GetRootWindow() = 0; | 85 virtual RootWindow* GetRootWindow() = 0; |
86 | 86 |
87 // Returns the accelerated widget. | 87 // Returns the accelerated widget. |
88 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; | 88 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; |
89 | 89 |
90 // Shows the WindowTreeHost. | 90 // Shows the RootWindowHost. |
91 virtual void Show() = 0; | 91 virtual void Show() = 0; |
92 | 92 |
93 // Hides the WindowTreeHost. | 93 // Hides the RootWindowHost. |
94 virtual void Hide() = 0; | 94 virtual void Hide() = 0; |
95 | 95 |
96 // Toggles the host's full screen state. | 96 // Toggles the host's full screen state. |
97 virtual void ToggleFullScreen() = 0; | 97 virtual void ToggleFullScreen() = 0; |
98 | 98 |
99 // Gets/Sets the size of the WindowTreeHost. | 99 // Gets/Sets the size of the RootWindowHost. |
100 virtual gfx::Rect GetBounds() const = 0; | 100 virtual gfx::Rect GetBounds() const = 0; |
101 virtual void SetBounds(const gfx::Rect& bounds) = 0; | 101 virtual void SetBounds(const gfx::Rect& bounds) = 0; |
102 | 102 |
103 // Sets/Gets the insets that specifies the effective root window area | 103 // Sets/Gets the insets that specifies the effective root window area |
104 // in the host window. | 104 // in the host window. |
105 virtual gfx::Insets GetInsets() const = 0; | 105 virtual gfx::Insets GetInsets() const = 0; |
106 virtual void SetInsets(const gfx::Insets& insets) = 0; | 106 virtual void SetInsets(const gfx::Insets& insets) = 0; |
107 | 107 |
108 // Sets the OS capture to the root window. | 108 // Sets the OS capture to the root window. |
109 virtual void SetCapture() = 0; | 109 virtual void SetCapture() = 0; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 141 |
142 // Called when the device scale factor of the root window has chagned. | 142 // Called when the device scale factor of the root window has chagned. |
143 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) = 0; | 143 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) = 0; |
144 | 144 |
145 // Stop listening events in preparation for shutdown. | 145 // Stop listening events in preparation for shutdown. |
146 virtual void PrepareForShutdown() = 0; | 146 virtual void PrepareForShutdown() = 0; |
147 | 147 |
148 protected: | 148 protected: |
149 friend class TestScreen; // TODO(beng): see if we can remove/consolidate. | 149 friend class TestScreen; // TODO(beng): see if we can remove/consolidate. |
150 | 150 |
151 WindowTreeHost(); | 151 RootWindowHost(); |
152 | 152 |
153 void CreateCompositor(gfx::AcceleratedWidget accelerated_widget); | 153 void CreateCompositor(gfx::AcceleratedWidget accelerated_widget); |
154 | 154 |
155 // Returns the location of the RootWindow on native screen. | 155 // Returns the location of the RootWindow on native screen. |
156 virtual gfx::Point GetLocationOnNativeScreen() const = 0; | 156 virtual gfx::Point GetLocationOnNativeScreen() const = 0; |
157 | 157 |
158 void NotifyHostResized(const gfx::Size& new_size); | 158 void NotifyHostResized(const gfx::Size& new_size); |
159 | 159 |
160 WindowTreeHostDelegate* delegate_; | 160 RootWindowHostDelegate* delegate_; |
161 | 161 |
162 private: | 162 private: |
163 scoped_ptr<ui::Compositor> compositor_; | 163 scoped_ptr<ui::Compositor> compositor_; |
164 | 164 |
165 scoped_ptr<RootWindowTransformer> transformer_; | 165 scoped_ptr<RootWindowTransformer> transformer_; |
166 | 166 |
167 DISALLOW_COPY_AND_ASSIGN(WindowTreeHost); | 167 DISALLOW_COPY_AND_ASSIGN(RootWindowHost); |
168 }; | 168 }; |
169 | 169 |
170 } // namespace aura | 170 } // namespace aura |
171 | 171 |
172 #endif // UI_AURA_ROOT_WINDOW_HOST_H_ | 172 #endif // UI_AURA_ROOT_WINDOW_HOST_H_ |
OLD | NEW |