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