| 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 virtual gfx::Transform GetRootTransform() const; |
| 70 gfx::Transform GetRootTransform() const; | 69 virtual void SetTransform(const gfx::Transform& transform); |
| 71 | 70 virtual gfx::Transform GetInverseRootTransform() const; |
| 72 void SetTransform(const gfx::Transform& transform); | |
| 73 | |
| 74 gfx::Transform GetInverseRootTransform() const; | |
| 75 | 71 |
| 76 // Updates the root window's size using |host_size|, current | 72 // Updates the root window's size using |host_size|, current |
| 77 // transform and insets. | 73 // transform and insets. |
| 78 void UpdateRootWindowSize(const gfx::Size& host_size); | 74 virtual void UpdateRootWindowSize(const gfx::Size& host_size); |
| 79 | 75 |
| 80 // Returns the actual size of the screen. | 76 // Returns the actual size of the screen. |
| 81 // (gfx::Screen only reports on the virtual desktop exposed by Aura.) | 77 // (gfx::Screen only reports on the virtual desktop exposed by Aura.) |
| 82 static gfx::Size GetNativeScreenSize(); | 78 static gfx::Size GetNativeScreenSize(); |
| 83 | 79 |
| 84 // Converts |point| from the root window's coordinate system to native | 80 // Converts |point| from the root window's coordinate system to native |
| 85 // screen's. | 81 // screen's. |
| 86 void ConvertPointToNativeScreen(gfx::Point* point) const; | 82 void ConvertPointToNativeScreen(gfx::Point* point) const; |
| 87 | 83 |
| 88 // Converts |point| from native screen coordinate system to the root window's. | 84 // Converts |point| from native screen coordinate system to the root window's. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 116 | 112 |
| 117 // Returns the accelerated widget. | 113 // Returns the accelerated widget. |
| 118 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; | 114 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; |
| 119 | 115 |
| 120 // Shows the WindowTreeHost. | 116 // Shows the WindowTreeHost. |
| 121 virtual void Show() = 0; | 117 virtual void Show() = 0; |
| 122 | 118 |
| 123 // Hides the WindowTreeHost. | 119 // Hides the WindowTreeHost. |
| 124 virtual void Hide() = 0; | 120 virtual void Hide() = 0; |
| 125 | 121 |
| 126 // Toggles the host's full screen state. | |
| 127 virtual void ToggleFullScreen() = 0; | |
| 128 | |
| 129 // Gets/Sets the size of the WindowTreeHost. | 122 // Gets/Sets the size of the WindowTreeHost. |
| 130 virtual gfx::Rect GetBounds() const = 0; | 123 virtual gfx::Rect GetBounds() const = 0; |
| 131 virtual void SetBounds(const gfx::Rect& bounds) = 0; | 124 virtual void SetBounds(const gfx::Rect& bounds) = 0; |
| 132 | 125 |
| 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. | 126 // Sets the OS capture to the root window. |
| 139 virtual void SetCapture() = 0; | 127 virtual void SetCapture() = 0; |
| 140 | 128 |
| 141 // Releases OS capture of the root window. | 129 // Releases OS capture of the root window. |
| 142 virtual void ReleaseCapture() = 0; | 130 virtual void ReleaseCapture() = 0; |
| 143 | 131 |
| 144 // Queries the mouse's current position relative to the host window and sets | 132 // 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 | 133 // 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 | 134 // 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 | 135 // host window. If the cursor is disabled, returns false and (0, 0) is set to |
| 148 // |location_return|. | 136 // |location_return|. |
| 149 // This method is expensive, instead use gfx::Screen::GetCursorScreenPoint(). | 137 // This method is expensive, instead use gfx::Screen::GetCursorScreenPoint(). |
| 150 virtual bool QueryMouseLocation(gfx::Point* location_return) = 0; | 138 virtual bool QueryMouseLocation(gfx::Point* location_return) = 0; |
| 151 | 139 |
| 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. | 140 // Posts |native_event| to the platform's event queue. |
| 161 virtual void PostNativeEvent(const base::NativeEvent& native_event) = 0; | 141 virtual void PostNativeEvent(const base::NativeEvent& native_event) = 0; |
| 162 | 142 |
| 163 // Called when the device scale factor of the root window has chagned. | 143 // Called when the device scale factor of the root window has chagned. |
| 164 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) = 0; | 144 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) = 0; |
| 165 | 145 |
| 166 protected: | 146 protected: |
| 167 friend class TestScreen; // TODO(beng): see if we can remove/consolidate. | 147 friend class TestScreen; // TODO(beng): see if we can remove/consolidate. |
| 168 | 148 |
| 169 WindowTreeHost(); | 149 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 | 181 // reach back up to access this object which will be valid until the end of |
| 202 // the dtor). | 182 // the dtor). |
| 203 Window* window_; // Owning. | 183 Window* window_; // Owning. |
| 204 | 184 |
| 205 ObserverList<WindowTreeHostObserver> observers_; | 185 ObserverList<WindowTreeHostObserver> observers_; |
| 206 | 186 |
| 207 scoped_ptr<WindowEventDispatcher> dispatcher_; | 187 scoped_ptr<WindowEventDispatcher> dispatcher_; |
| 208 | 188 |
| 209 scoped_ptr<ui::Compositor> compositor_; | 189 scoped_ptr<ui::Compositor> compositor_; |
| 210 | 190 |
| 211 scoped_ptr<RootWindowTransformer> transformer_; | |
| 212 | |
| 213 // Last cursor set. Used for testing. | 191 // Last cursor set. Used for testing. |
| 214 gfx::NativeCursor last_cursor_; | 192 gfx::NativeCursor last_cursor_; |
| 215 | 193 |
| 216 scoped_ptr<ui::ViewProp> prop_; | 194 scoped_ptr<ui::ViewProp> prop_; |
| 217 | 195 |
| 218 DISALLOW_COPY_AND_ASSIGN(WindowTreeHost); | 196 DISALLOW_COPY_AND_ASSIGN(WindowTreeHost); |
| 219 }; | 197 }; |
| 220 | 198 |
| 221 } // namespace aura | 199 } // namespace aura |
| 222 | 200 |
| 223 #endif // UI_AURA_WINDOW_TREE_HOST_H_ | 201 #endif // UI_AURA_WINDOW_TREE_HOST_H_ |
| OLD | NEW |