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 11 matching lines...) Expand all Loading... |
22 } | 22 } |
23 | 23 |
24 namespace ui { | 24 namespace ui { |
25 class Compositor; | 25 class Compositor; |
26 class ViewProp; | 26 class ViewProp; |
27 } | 27 } |
28 | 28 |
29 namespace aura { | 29 namespace aura { |
30 class RootWindowTransformer; | 30 class RootWindowTransformer; |
31 class WindowEventDispatcher; | 31 class WindowEventDispatcher; |
32 class WindowTreeHostDelegate; | |
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 |
42 // Creates a new WindowTreeHost. The caller owns the returned value. | 41 // Creates a new WindowTreeHost. The caller owns the returned value. |
(...skipping 29 matching lines...) Expand all Loading... |
72 gfx::Transform GetInverseRootTransform() const; | 71 gfx::Transform GetInverseRootTransform() const; |
73 | 72 |
74 // Updates the root window's size using |host_size|, current | 73 // Updates the root window's size using |host_size|, current |
75 // transform and insets. | 74 // transform and insets. |
76 void UpdateRootWindowSize(const gfx::Size& host_size); | 75 void UpdateRootWindowSize(const gfx::Size& host_size); |
77 | 76 |
78 // Returns the actual size of the screen. | 77 // Returns the actual size of the screen. |
79 // (gfx::Screen only reports on the virtual desktop exposed by Aura.) | 78 // (gfx::Screen only reports on the virtual desktop exposed by Aura.) |
80 static gfx::Size GetNativeScreenSize(); | 79 static gfx::Size GetNativeScreenSize(); |
81 | 80 |
82 void set_delegate(WindowTreeHostDelegate* delegate) { | |
83 delegate_ = delegate; | |
84 } | |
85 | |
86 // Converts |point| from the root window's coordinate system to native | 81 // Converts |point| from the root window's coordinate system to native |
87 // screen's. | 82 // screen's. |
88 void ConvertPointToNativeScreen(gfx::Point* point) const; | 83 void ConvertPointToNativeScreen(gfx::Point* point) const; |
89 | 84 |
90 // 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. |
91 void ConvertPointFromNativeScreen(gfx::Point* point) const; | 86 void ConvertPointFromNativeScreen(gfx::Point* point) const; |
92 | 87 |
93 // Converts |point| from the root window's coordinate system to the | 88 // Converts |point| from the root window's coordinate system to the |
94 // host window's. | 89 // host window's. |
95 void ConvertPointToHost(gfx::Point* point) const; | 90 void ConvertPointToHost(gfx::Point* point) const; |
(...skipping 13 matching lines...) Expand all Loading... |
109 void OnCursorVisibilityChanged(bool visible); | 104 void OnCursorVisibilityChanged(bool visible); |
110 | 105 |
111 // Moves the cursor to the specified location relative to the root window. | 106 // Moves the cursor to the specified location relative to the root window. |
112 void MoveCursorTo(const gfx::Point& location); | 107 void MoveCursorTo(const gfx::Point& location); |
113 | 108 |
114 // Moves the cursor to the |host_location| given in host coordinates. | 109 // Moves the cursor to the |host_location| given in host coordinates. |
115 void MoveCursorToHostLocation(const gfx::Point& host_location); | 110 void MoveCursorToHostLocation(const gfx::Point& host_location); |
116 | 111 |
117 gfx::NativeCursor last_cursor() const { return last_cursor_; } | 112 gfx::NativeCursor last_cursor() const { return last_cursor_; } |
118 | 113 |
119 WindowEventDispatcher* GetDispatcher(); | |
120 | |
121 // Returns the accelerated widget. | 114 // Returns the accelerated widget. |
122 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; | 115 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; |
123 | 116 |
124 // Shows the WindowTreeHost. | 117 // Shows the WindowTreeHost. |
125 virtual void Show() = 0; | 118 virtual void Show() = 0; |
126 | 119 |
127 // Hides the WindowTreeHost. | 120 // Hides the WindowTreeHost. |
128 virtual void Hide() = 0; | 121 virtual void Hide() = 0; |
129 | 122 |
130 // Toggles the host's full screen state. | 123 // Toggles the host's full screen state. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 void DestroyDispatcher(); | 171 void DestroyDispatcher(); |
179 | 172 |
180 void CreateCompositor(gfx::AcceleratedWidget accelerated_widget); | 173 void CreateCompositor(gfx::AcceleratedWidget accelerated_widget); |
181 | 174 |
182 // Returns the location of the RootWindow on native screen. | 175 // Returns the location of the RootWindow on native screen. |
183 virtual gfx::Point GetLocationOnNativeScreen() const = 0; | 176 virtual gfx::Point GetLocationOnNativeScreen() const = 0; |
184 | 177 |
185 void OnHostMoved(const gfx::Point& new_location); | 178 void OnHostMoved(const gfx::Point& new_location); |
186 void OnHostResized(const gfx::Size& new_size); | 179 void OnHostResized(const gfx::Size& new_size); |
187 void OnHostCloseRequested(); | 180 void OnHostCloseRequested(); |
| 181 void OnHostActivated(); |
| 182 void OnHostLostWindowCapture(); |
188 | 183 |
189 // Sets the currently displayed cursor. | 184 // Sets the currently displayed cursor. |
190 virtual void SetCursorNative(gfx::NativeCursor cursor) = 0; | 185 virtual void SetCursorNative(gfx::NativeCursor cursor) = 0; |
191 | 186 |
192 // Moves the cursor to the specified location relative to the root window. | 187 // Moves the cursor to the specified location relative to the root window. |
193 virtual void MoveCursorToNative(const gfx::Point& location) = 0; | 188 virtual void MoveCursorToNative(const gfx::Point& location) = 0; |
194 | 189 |
195 // kCalled when the cursor visibility has changed. | 190 // kCalled when the cursor visibility has changed. |
196 virtual void OnCursorVisibilityChangedNative(bool show) = 0; | 191 virtual void OnCursorVisibilityChangedNative(bool show) = 0; |
197 | 192 |
198 WindowTreeHostDelegate* delegate_; | |
199 | |
200 private: | 193 private: |
201 // Moves the cursor to the specified location. This method is internally used | 194 // Moves the cursor to the specified location. This method is internally used |
202 // by MoveCursorTo() and MoveCursorToHostLocation(). | 195 // by MoveCursorTo() and MoveCursorToHostLocation(). |
203 void MoveCursorToInternal(const gfx::Point& root_location, | 196 void MoveCursorToInternal(const gfx::Point& root_location, |
204 const gfx::Point& host_location); | 197 const gfx::Point& host_location); |
205 | 198 |
206 // We don't use a scoped_ptr for |window_| since we need this ptr to be valid | 199 // We don't use a scoped_ptr for |window_| since we need this ptr to be valid |
207 // during its deletion. (Window's dtor notifies observers that may attempt to | 200 // during its deletion. (Window's dtor notifies observers that may attempt to |
208 // reach back up to access this object which will be valid until the end of | 201 // reach back up to access this object which will be valid until the end of |
209 // the dtor). | 202 // the dtor). |
(...skipping 11 matching lines...) Expand all Loading... |
221 gfx::NativeCursor last_cursor_; | 214 gfx::NativeCursor last_cursor_; |
222 | 215 |
223 scoped_ptr<ui::ViewProp> prop_; | 216 scoped_ptr<ui::ViewProp> prop_; |
224 | 217 |
225 DISALLOW_COPY_AND_ASSIGN(WindowTreeHost); | 218 DISALLOW_COPY_AND_ASSIGN(WindowTreeHost); |
226 }; | 219 }; |
227 | 220 |
228 } // namespace aura | 221 } // namespace aura |
229 | 222 |
230 #endif // UI_AURA_WINDOW_TREE_HOST_H_ | 223 #endif // UI_AURA_WINDOW_TREE_HOST_H_ |
OLD | NEW |