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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // Gets/Sets the size of the WindowTreeHost. | 128 // Gets/Sets the size of the WindowTreeHost. |
129 virtual gfx::Rect GetBounds() const = 0; | 129 virtual gfx::Rect GetBounds() const = 0; |
130 virtual void SetBounds(const gfx::Rect& bounds) = 0; | 130 virtual void SetBounds(const gfx::Rect& bounds) = 0; |
131 | 131 |
132 // Sets the OS capture to the root window. | 132 // Sets the OS capture to the root window. |
133 virtual void SetCapture() = 0; | 133 virtual void SetCapture() = 0; |
134 | 134 |
135 // Releases OS capture of the root window. | 135 // Releases OS capture of the root window. |
136 virtual void ReleaseCapture() = 0; | 136 virtual void ReleaseCapture() = 0; |
137 | 137 |
138 // Queries the mouse's current position relative to the host window and sets | |
139 // it in |location_return|. Returns true if the cursor is within the host | |
140 // window. The position set to |location_return| is constrained within the | |
141 // host window. If the cursor is disabled, returns false and (0, 0) is set to | |
142 // |location_return|. | |
143 // This method is expensive, instead use gfx::Screen::GetCursorScreenPoint(). | |
144 virtual bool QueryMouseLocation(gfx::Point* location_return) = 0; | |
145 | |
146 // Posts |native_event| to the platform's event queue. | 138 // Posts |native_event| to the platform's event queue. |
147 virtual void PostNativeEvent(const base::NativeEvent& native_event) = 0; | 139 virtual void PostNativeEvent(const base::NativeEvent& native_event) = 0; |
148 | 140 |
149 // Called when the device scale factor of the root window has chagned. | 141 // Called when the device scale factor of the root window has chagned. |
150 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) = 0; | 142 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) = 0; |
151 | 143 |
152 protected: | 144 protected: |
153 friend class TestScreen; // TODO(beng): see if we can remove/consolidate. | 145 friend class TestScreen; // TODO(beng): see if we can remove/consolidate. |
154 | 146 |
155 WindowTreeHost(); | 147 WindowTreeHost(); |
(...skipping 14 matching lines...) Expand all Loading... |
170 // Sets the currently displayed cursor. | 162 // Sets the currently displayed cursor. |
171 virtual void SetCursorNative(gfx::NativeCursor cursor) = 0; | 163 virtual void SetCursorNative(gfx::NativeCursor cursor) = 0; |
172 | 164 |
173 // Moves the cursor to the specified location relative to the root window. | 165 // Moves the cursor to the specified location relative to the root window. |
174 virtual void MoveCursorToNative(const gfx::Point& location) = 0; | 166 virtual void MoveCursorToNative(const gfx::Point& location) = 0; |
175 | 167 |
176 // kCalled when the cursor visibility has changed. | 168 // kCalled when the cursor visibility has changed. |
177 virtual void OnCursorVisibilityChangedNative(bool show) = 0; | 169 virtual void OnCursorVisibilityChangedNative(bool show) = 0; |
178 | 170 |
179 private: | 171 private: |
| 172 friend class WindowTreeHostTestApi; |
| 173 |
180 // Moves the cursor to the specified location. This method is internally used | 174 // Moves the cursor to the specified location. This method is internally used |
181 // by MoveCursorTo() and MoveCursorToHostLocation(). | 175 // by MoveCursorTo() and MoveCursorToHostLocation(). |
182 void MoveCursorToInternal(const gfx::Point& root_location, | 176 void MoveCursorToInternal(const gfx::Point& root_location, |
183 const gfx::Point& host_location); | 177 const gfx::Point& host_location); |
184 | 178 |
185 // We don't use a scoped_ptr for |window_| since we need this ptr to be valid | 179 // We don't use a scoped_ptr for |window_| since we need this ptr to be valid |
186 // during its deletion. (Window's dtor notifies observers that may attempt to | 180 // during its deletion. (Window's dtor notifies observers that may attempt to |
187 // reach back up to access this object which will be valid until the end of | 181 // reach back up to access this object which will be valid until the end of |
188 // the dtor). | 182 // the dtor). |
189 Window* window_; // Owning. | 183 Window* window_; // Owning. |
190 | 184 |
191 ObserverList<WindowTreeHostObserver> observers_; | 185 ObserverList<WindowTreeHostObserver> observers_; |
192 | 186 |
193 scoped_ptr<WindowEventDispatcher> dispatcher_; | 187 scoped_ptr<WindowEventDispatcher> dispatcher_; |
194 | 188 |
195 scoped_ptr<ui::Compositor> compositor_; | 189 scoped_ptr<ui::Compositor> compositor_; |
196 | 190 |
197 // Last cursor set. Used for testing. | 191 // Last cursor set. Used for testing. |
198 gfx::NativeCursor last_cursor_; | 192 gfx::NativeCursor last_cursor_; |
| 193 gfx::Point last_cursor_request_position_in_host_; |
199 | 194 |
200 scoped_ptr<ui::ViewProp> prop_; | 195 scoped_ptr<ui::ViewProp> prop_; |
201 | 196 |
202 DISALLOW_COPY_AND_ASSIGN(WindowTreeHost); | 197 DISALLOW_COPY_AND_ASSIGN(WindowTreeHost); |
203 }; | 198 }; |
204 | 199 |
205 } // namespace aura | 200 } // namespace aura |
206 | 201 |
207 #endif // UI_AURA_WINDOW_TREE_HOST_H_ | 202 #endif // UI_AURA_WINDOW_TREE_HOST_H_ |
OLD | NEW |