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_WINDOW_TREE_HOST_H_ | 5 #ifndef UI_AURA_WINDOW_TREE_HOST_H_ |
6 #define UI_AURA_WINDOW_TREE_HOST_H_ | 6 #define UI_AURA_WINDOW_TREE_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 class EventProcessor; | 26 class EventProcessor; |
27 class ViewProp; | 27 class ViewProp; |
28 } | 28 } |
29 | 29 |
30 namespace aura { | 30 namespace aura { |
31 class RootWindowTransformer; | |
32 class WindowEventDispatcher; | 31 class WindowEventDispatcher; |
33 class WindowTreeHostObserver; | 32 class WindowTreeHostObserver; |
34 | 33 |
35 // WindowTreeHost bridges between a native window and the embedded RootWindow. | 34 // WindowTreeHost bridges between a native window and the embedded RootWindow. |
36 // 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 |
37 // aura. | 36 // aura. |
38 class AURA_EXPORT WindowTreeHost { | 37 class AURA_EXPORT WindowTreeHost { |
39 public: | 38 public: |
40 virtual ~WindowTreeHost(); | 39 virtual ~WindowTreeHost(); |
41 | 40 |
(...skipping 17 matching lines...) Expand all Loading... |
59 ui::EventProcessor* event_processor(); | 58 ui::EventProcessor* event_processor(); |
60 | 59 |
61 WindowEventDispatcher* dispatcher() { | 60 WindowEventDispatcher* dispatcher() { |
62 return const_cast<WindowEventDispatcher*>( | 61 return const_cast<WindowEventDispatcher*>( |
63 const_cast<const WindowTreeHost*>(this)->dispatcher()); | 62 const_cast<const WindowTreeHost*>(this)->dispatcher()); |
64 } | 63 } |
65 const WindowEventDispatcher* dispatcher() const { return dispatcher_.get(); } | 64 const WindowEventDispatcher* dispatcher() const { return dispatcher_.get(); } |
66 | 65 |
67 ui::Compositor* compositor() { return compositor_.get(); } | 66 ui::Compositor* compositor() { return compositor_.get(); } |
68 | 67 |
69 void SetRootWindowTransformer(scoped_ptr<RootWindowTransformer> transformer); | 68 // Gets/Sets the root window's transform. |
70 gfx::Transform GetRootTransform() const; | 69 virtual gfx::Transform GetRootTransform() const; |
71 | 70 virtual void SetRootTransform(const gfx::Transform& transform); |
72 void SetTransform(const gfx::Transform& transform); | 71 virtual gfx::Transform GetInverseRootTransform() const; |
73 | |
74 gfx::Transform GetInverseRootTransform() const; | |
75 | 72 |
76 // Updates the root window's size using |host_size|, current | 73 // Updates the root window's size using |host_size|, current |
77 // transform and insets. | 74 // transform and insets. |
78 void UpdateRootWindowSize(const gfx::Size& host_size); | 75 virtual void UpdateRootWindowSize(const gfx::Size& host_size); |
79 | 76 |
80 // Returns the actual size of the screen. | 77 // Returns the actual size of the screen. |
81 // (gfx::Screen only reports on the virtual desktop exposed by Aura.) | 78 // (gfx::Screen only reports on the virtual desktop exposed by Aura.) |
82 static gfx::Size GetNativeScreenSize(); | 79 static gfx::Size GetNativeScreenSize(); |
83 | 80 |
84 // Converts |point| from the root window's coordinate system to native | 81 // Converts |point| from the root window's coordinate system to native |
85 // screen's. | 82 // screen's. |
86 void ConvertPointToNativeScreen(gfx::Point* point) const; | 83 void ConvertPointToNativeScreen(gfx::Point* point) const; |
87 | 84 |
88 // Converts |point| from native screen coordinate system to the root window's. | 85 // Converts |point| from native screen coordinate system to the root window's. |
(...skipping 27 matching lines...) Expand all Loading... |
116 | 113 |
117 // Returns the accelerated widget. | 114 // Returns the accelerated widget. |
118 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; | 115 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; |
119 | 116 |
120 // Shows the WindowTreeHost. | 117 // Shows the WindowTreeHost. |
121 virtual void Show() = 0; | 118 virtual void Show() = 0; |
122 | 119 |
123 // Hides the WindowTreeHost. | 120 // Hides the WindowTreeHost. |
124 virtual void Hide() = 0; | 121 virtual void Hide() = 0; |
125 | 122 |
126 // Toggles the host's full screen state. | |
127 virtual void ToggleFullScreen() = 0; | |
128 | |
129 // Gets/Sets the size of the WindowTreeHost. | 123 // Gets/Sets the size of the WindowTreeHost. |
130 virtual gfx::Rect GetBounds() const = 0; | 124 virtual gfx::Rect GetBounds() const = 0; |
131 virtual void SetBounds(const gfx::Rect& bounds) = 0; | 125 virtual void SetBounds(const gfx::Rect& bounds) = 0; |
132 | 126 |
133 // Sets/Gets the insets that specifies the effective root window area | |
134 // in the host window. | |
135 virtual gfx::Insets GetInsets() const = 0; | |
136 virtual void SetInsets(const gfx::Insets& insets) = 0; | |
137 | |
138 // Sets the OS capture to the root window. | 127 // Sets the OS capture to the root window. |
139 virtual void SetCapture() = 0; | 128 virtual void SetCapture() = 0; |
140 | 129 |
141 // Releases OS capture of the root window. | 130 // Releases OS capture of the root window. |
142 virtual void ReleaseCapture() = 0; | 131 virtual void ReleaseCapture() = 0; |
143 | 132 |
144 // Queries the mouse's current position relative to the host window and sets | 133 // Queries the mouse's current position relative to the host window and sets |
145 // it in |location_return|. Returns true if the cursor is within the host | 134 // it in |location_return|. Returns true if the cursor is within the host |
146 // window. The position set to |location_return| is constrained within the | 135 // window. The position set to |location_return| is constrained within the |
147 // host window. If the cursor is disabled, returns false and (0, 0) is set to | 136 // host window. If the cursor is disabled, returns false and (0, 0) is set to |
148 // |location_return|. | 137 // |location_return|. |
149 // This method is expensive, instead use gfx::Screen::GetCursorScreenPoint(). | 138 // This method is expensive, instead use gfx::Screen::GetCursorScreenPoint(). |
150 virtual bool QueryMouseLocation(gfx::Point* location_return) = 0; | 139 virtual bool QueryMouseLocation(gfx::Point* location_return) = 0; |
151 | 140 |
152 // Clips the cursor to the bounds of the root window until UnConfineCursor(). | |
153 // We would like to be able to confine the cursor to that window. However, | |
154 // currently, we do not have such functionality in X. So we just confine | |
155 // to the root window. This is ok because this option is currently only | |
156 // being used in fullscreen mode, so root_window bounds = window bounds. | |
157 virtual bool ConfineCursorToRootWindow() = 0; | |
158 virtual void UnConfineCursor() = 0; | |
159 | |
160 // Posts |native_event| to the platform's event queue. | 141 // Posts |native_event| to the platform's event queue. |
161 virtual void PostNativeEvent(const base::NativeEvent& native_event) = 0; | 142 virtual void PostNativeEvent(const base::NativeEvent& native_event) = 0; |
162 | 143 |
163 // Called when the device scale factor of the root window has chagned. | 144 // Called when the device scale factor of the root window has chagned. |
164 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) = 0; | 145 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) = 0; |
165 | 146 |
166 protected: | 147 protected: |
167 friend class TestScreen; // TODO(beng): see if we can remove/consolidate. | 148 friend class TestScreen; // TODO(beng): see if we can remove/consolidate. |
168 | 149 |
169 WindowTreeHost(); | 150 WindowTreeHost(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // reach back up to access this object which will be valid until the end of | 182 // reach back up to access this object which will be valid until the end of |
202 // the dtor). | 183 // the dtor). |
203 Window* window_; // Owning. | 184 Window* window_; // Owning. |
204 | 185 |
205 ObserverList<WindowTreeHostObserver> observers_; | 186 ObserverList<WindowTreeHostObserver> observers_; |
206 | 187 |
207 scoped_ptr<WindowEventDispatcher> dispatcher_; | 188 scoped_ptr<WindowEventDispatcher> dispatcher_; |
208 | 189 |
209 scoped_ptr<ui::Compositor> compositor_; | 190 scoped_ptr<ui::Compositor> compositor_; |
210 | 191 |
211 scoped_ptr<RootWindowTransformer> transformer_; | |
212 | |
213 // Last cursor set. Used for testing. | 192 // Last cursor set. Used for testing. |
214 gfx::NativeCursor last_cursor_; | 193 gfx::NativeCursor last_cursor_; |
215 | 194 |
216 scoped_ptr<ui::ViewProp> prop_; | 195 scoped_ptr<ui::ViewProp> prop_; |
217 | 196 |
218 DISALLOW_COPY_AND_ASSIGN(WindowTreeHost); | 197 DISALLOW_COPY_AND_ASSIGN(WindowTreeHost); |
219 }; | 198 }; |
220 | 199 |
221 } // namespace aura | 200 } // namespace aura |
222 | 201 |
223 #endif // UI_AURA_WINDOW_TREE_HOST_H_ | 202 #endif // UI_AURA_WINDOW_TREE_HOST_H_ |
OLD | NEW |