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