Chromium Code Reviews| 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 <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 | 45 |
| 46 // WindowTreeHost bridges between a native window and the embedded RootWindow. | 46 // WindowTreeHost bridges between a native window and the embedded RootWindow. |
| 47 // It provides the accelerated widget and maps events from the native os to | 47 // It provides the accelerated widget and maps events from the native os to |
| 48 // aura. | 48 // aura. |
| 49 class AURA_EXPORT WindowTreeHost : public ui::internal::InputMethodDelegate, | 49 class AURA_EXPORT WindowTreeHost : public ui::internal::InputMethodDelegate, |
| 50 public ui::EventSource { | 50 public ui::EventSource { |
| 51 public: | 51 public: |
| 52 ~WindowTreeHost() override; | 52 ~WindowTreeHost() override; |
| 53 | 53 |
| 54 // Creates a new WindowTreeHost. The caller owns the returned value. | 54 // Creates a new WindowTreeHost. The caller owns the returned value. |
| 55 static WindowTreeHost* Create(const gfx::Rect& bounds); | 55 static WindowTreeHost* Create(const gfx::Rect& bounds); |
|
sky
2016/11/22 21:38:15
rename this to bounds_in_pixels too.
| |
| 56 | 56 |
| 57 // Returns the WindowTreeHost for the specified accelerated widget, or NULL | 57 // Returns the WindowTreeHost for the specified accelerated widget, or NULL |
| 58 // if there is none associated. | 58 // if there is none associated. |
| 59 static WindowTreeHost* GetForAcceleratedWidget(gfx::AcceleratedWidget widget); | 59 static WindowTreeHost* GetForAcceleratedWidget(gfx::AcceleratedWidget widget); |
| 60 | 60 |
| 61 void InitHost(); | 61 void InitHost(); |
| 62 | 62 |
| 63 void InitCompositor(); | 63 void InitCompositor(); |
| 64 | 64 |
| 65 void AddObserver(WindowTreeHostObserver* observer); | 65 void AddObserver(WindowTreeHostObserver* observer); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 89 // padding.top(). | 89 // padding.top(). |
| 90 // This does not impact the bounds as returned from GetBounds(), only the | 90 // This does not impact the bounds as returned from GetBounds(), only the |
| 91 // output surface size and location of window(). Additionally window() is | 91 // output surface size and location of window(). Additionally window() is |
| 92 // sized to the size set by bounds (more specifically the size passed to | 92 // sized to the size set by bounds (more specifically the size passed to |
| 93 // OnHostResized()), but the location of window() is set to that of | 93 // OnHostResized()), but the location of window() is set to that of |
| 94 // |padding|. | 94 // |padding|. |
| 95 void SetOutputSurfacePadding(const gfx::Insets& padding); | 95 void SetOutputSurfacePadding(const gfx::Insets& padding); |
| 96 | 96 |
| 97 // Updates the root window's size using |host_size|, current | 97 // Updates the root window's size using |host_size|, current |
| 98 // transform and outsets. | 98 // transform and outsets. |
| 99 virtual void UpdateRootWindowSize(const gfx::Size& host_size); | 99 virtual void UpdateRootWindowSize(const gfx::Size& host_size); |
|
sadrul
2016/11/23 03:08:20
Update this too in a follow up CL.
| |
| 100 | 100 |
| 101 // Converts |point| from the root window's coordinate system to native | 101 // Converts |point| from the root window's coordinate system to native |
| 102 // screen's. | 102 // screen's. |
| 103 void ConvertPointToNativeScreen(gfx::Point* point) const; | 103 void ConvertPointToNativeScreen(gfx::Point* point) const; |
|
sky
2016/11/22 21:38:15
All of these should be InPixels too.
| |
| 104 | 104 |
| 105 // Converts |point| from native screen coordinate system to the root window's. | 105 // Converts |point| from native screen coordinate system to the root window's. |
| 106 void ConvertPointFromNativeScreen(gfx::Point* point) const; | 106 void ConvertPointFromNativeScreen(gfx::Point* point) const; |
| 107 | 107 |
| 108 // Converts |point| from the root window's coordinate system to the | 108 // Converts |point| from the root window's coordinate system to the |
| 109 // host window's. | 109 // host window's. |
| 110 void ConvertPointToHost(gfx::Point* point) const; | 110 void ConvertPointToHost(gfx::Point* point) const; |
| 111 | 111 |
| 112 // Converts |point| from the host window's coordinate system to the | 112 // Converts |point| from the host window's coordinate system to the |
| 113 // root window's. | 113 // root window's. |
| 114 void ConvertPointFromHost(gfx::Point* point) const; | 114 void ConvertPointFromHost(gfx::Point* point) const; |
| 115 | 115 |
| 116 // Cursor. | 116 // Cursor. |
| 117 // Sets the currently-displayed cursor. If the cursor was previously hidden | 117 // Sets the currently-displayed cursor. If the cursor was previously hidden |
| 118 // via ShowCursor(false), it will remain hidden until ShowCursor(true) is | 118 // via ShowCursor(false), it will remain hidden until ShowCursor(true) is |
| 119 // called, at which point the cursor that was last set via SetCursor() will be | 119 // called, at which point the cursor that was last set via SetCursor() will be |
| 120 // used. | 120 // used. |
| 121 void SetCursor(gfx::NativeCursor cursor); | 121 void SetCursor(gfx::NativeCursor cursor); |
| 122 | 122 |
| 123 // Invoked when the cursor's visibility has changed. | 123 // Invoked when the cursor's visibility has changed. |
| 124 void OnCursorVisibilityChanged(bool visible); | 124 void OnCursorVisibilityChanged(bool visible); |
| 125 | 125 |
| 126 // Moves the cursor to the specified location relative to the root window. | 126 // Moves the cursor to the specified location relative to the root window. |
| 127 void MoveCursorTo(const gfx::Point& location); | 127 void MoveCursorTo(const gfx::Point& location); |
|
sky
2016/11/22 21:38:15
LocationInPixels
| |
| 128 | 128 |
| 129 // Moves the cursor to the |host_location| given in host coordinates. | 129 // Moves the cursor to the |host_location| given in host coordinates. |
| 130 void MoveCursorToHostLocation(const gfx::Point& host_location); | 130 void MoveCursorToHostLocation(const gfx::Point& host_location); |
|
sky
2016/11/22 21:38:15
InPixels
| |
| 131 | 131 |
| 132 gfx::NativeCursor last_cursor() const { return last_cursor_; } | 132 gfx::NativeCursor last_cursor() const { return last_cursor_; } |
| 133 | 133 |
| 134 // Gets the InputMethod instance, if NULL, creates & owns it. | 134 // Gets the InputMethod instance, if NULL, creates & owns it. |
| 135 ui::InputMethod* GetInputMethod(); | 135 ui::InputMethod* GetInputMethod(); |
| 136 | 136 |
| 137 // Sets a shared unowned InputMethod. This is used when there is a singleton | 137 // Sets a shared unowned InputMethod. This is used when there is a singleton |
| 138 // InputMethod shared between multiple WindowTreeHost instances. | 138 // InputMethod shared between multiple WindowTreeHost instances. |
| 139 // | 139 // |
| 140 // This is used for Ash only. There are 2 reasons: | 140 // This is used for Ash only. There are 2 reasons: |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 166 // Returns the accelerated widget. | 166 // Returns the accelerated widget. |
| 167 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; | 167 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; |
| 168 | 168 |
| 169 // Shows the WindowTreeHost. | 169 // Shows the WindowTreeHost. |
| 170 void Show(); | 170 void Show(); |
| 171 | 171 |
| 172 // Hides the WindowTreeHost. | 172 // Hides the WindowTreeHost. |
| 173 void Hide(); | 173 void Hide(); |
| 174 | 174 |
| 175 // Gets/Sets the size of the WindowTreeHost (in pixels). | 175 // Gets/Sets the size of the WindowTreeHost (in pixels). |
| 176 virtual gfx::Rect GetBounds() const = 0; | 176 virtual gfx::Rect GetBoundsInPixel() const = 0; |
| 177 virtual void SetBounds(const gfx::Rect& bounds_in_pixels) = 0; | 177 virtual void SetBoundsInPixel(const gfx::Rect& bounds_in_pixels) = 0; |
| 178 | 178 |
| 179 // Sets the OS capture to the root window. | 179 // Sets the OS capture to the root window. |
| 180 virtual void SetCapture() = 0; | 180 virtual void SetCapture() = 0; |
| 181 | 181 |
| 182 // Releases OS capture of the root window. | 182 // Releases OS capture of the root window. |
| 183 virtual void ReleaseCapture() = 0; | 183 virtual void ReleaseCapture() = 0; |
| 184 | 184 |
| 185 protected: | 185 protected: |
| 186 friend class TestScreen; // TODO(beng): see if we can remove/consolidate. | 186 friend class TestScreen; // TODO(beng): see if we can remove/consolidate. |
| 187 | 187 |
| 188 WindowTreeHost(); | 188 WindowTreeHost(); |
| 189 explicit WindowTreeHost(std::unique_ptr<WindowPort> window_port); | 189 explicit WindowTreeHost(std::unique_ptr<WindowPort> window_port); |
| 190 | 190 |
| 191 void DestroyCompositor(); | 191 void DestroyCompositor(); |
| 192 void DestroyDispatcher(); | 192 void DestroyDispatcher(); |
| 193 | 193 |
| 194 void CreateCompositor(); | 194 void CreateCompositor(); |
| 195 void OnAcceleratedWidgetAvailable(); | 195 void OnAcceleratedWidgetAvailable(); |
| 196 | 196 |
| 197 // Returns the location of the RootWindow on native screen. | 197 // Returns the location of the RootWindow on native screen. |
| 198 virtual gfx::Point GetLocationOnNativeScreen() const = 0; | 198 virtual gfx::Point GetLocationOnNativeScreen() const = 0; |
|
sky
2016/11/22 21:38:15
GetLocationOnNativeScreenInPixels.
| |
| 199 | 199 |
| 200 void OnHostMoved(const gfx::Point& new_location); | 200 void OnHostMoved(const gfx::Point& new_location); |
|
sky
2016/11/22 21:38:15
OnHostMovedInPixels
| |
| 201 void OnHostResized(const gfx::Size& new_size); | 201 void OnHostResized(const gfx::Size& new_size); |
|
sky
2016/11/22 21:38:16
OnHostResizedInPixels
| |
| 202 void OnHostWorkspaceChanged(); | 202 void OnHostWorkspaceChanged(); |
| 203 void OnHostCloseRequested(); | 203 void OnHostCloseRequested(); |
| 204 void OnHostActivated(); | 204 void OnHostActivated(); |
| 205 void OnHostLostWindowCapture(); | 205 void OnHostLostWindowCapture(); |
| 206 | 206 |
| 207 // Sets the currently displayed cursor. | 207 // Sets the currently displayed cursor. |
| 208 virtual void SetCursorNative(gfx::NativeCursor cursor) = 0; | 208 virtual void SetCursorNative(gfx::NativeCursor cursor) = 0; |
| 209 | 209 |
| 210 // Moves the cursor to the specified location relative to the root window. | 210 // Moves the cursor to the specified location relative to the root window. |
| 211 virtual void MoveCursorToNative(const gfx::Point& location) = 0; | 211 virtual void MoveCursorToNative(const gfx::Point& location) = 0; |
|
sky
2016/11/22 21:38:15
MoveCursorToNativeLocationInPixels.
| |
| 212 | 212 |
| 213 // kCalled when the cursor visibility has changed. | 213 // kCalled when the cursor visibility has changed. |
| 214 virtual void OnCursorVisibilityChangedNative(bool show) = 0; | 214 virtual void OnCursorVisibilityChangedNative(bool show) = 0; |
| 215 | 215 |
| 216 // Shows the WindowTreeHost. | 216 // Shows the WindowTreeHost. |
| 217 virtual void ShowImpl() = 0; | 217 virtual void ShowImpl() = 0; |
| 218 | 218 |
| 219 // Hides the WindowTreeHost. | 219 // Hides the WindowTreeHost. |
| 220 virtual void HideImpl() = 0; | 220 virtual void HideImpl() = 0; |
| 221 | 221 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 bool owned_input_method_; | 259 bool owned_input_method_; |
| 260 | 260 |
| 261 gfx::Insets output_surface_padding_; | 261 gfx::Insets output_surface_padding_; |
| 262 | 262 |
| 263 DISALLOW_COPY_AND_ASSIGN(WindowTreeHost); | 263 DISALLOW_COPY_AND_ASSIGN(WindowTreeHost); |
| 264 }; | 264 }; |
| 265 | 265 |
| 266 } // namespace aura | 266 } // namespace aura |
| 267 | 267 |
| 268 #endif // UI_AURA_WINDOW_TREE_HOST_H_ | 268 #endif // UI_AURA_WINDOW_TREE_HOST_H_ |
| OLD | NEW |