| 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_ROOT_WINDOW_H_ | 5 #ifndef UI_AURA_ROOT_WINDOW_H_ |
| 6 #define UI_AURA_ROOT_WINDOW_H_ | 6 #define UI_AURA_ROOT_WINDOW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 class TouchEvent; | 42 class TouchEvent; |
| 43 class GestureEvent; | 43 class GestureEvent; |
| 44 | 44 |
| 45 // RootWindow is responsible for hosting a set of windows. | 45 // RootWindow is responsible for hosting a set of windows. |
| 46 class AURA_EXPORT RootWindow : public ui::CompositorDelegate, | 46 class AURA_EXPORT RootWindow : public ui::CompositorDelegate, |
| 47 public ui::CompositorObserver, | 47 public ui::CompositorObserver, |
| 48 public Window, | 48 public Window, |
| 49 public internal::FocusManager, | 49 public internal::FocusManager, |
| 50 public ui::LayerAnimationObserver { | 50 public ui::LayerAnimationObserver { |
| 51 public: | 51 public: |
| 52 RootWindow(); | 52 explicit RootWindow(const gfx::Rect& initial_bounds); |
| 53 virtual ~RootWindow(); | 53 virtual ~RootWindow(); |
| 54 | 54 |
| 55 // TODO(oshima): Move this to monitor manager. | |
| 56 static void set_use_fullscreen_host_window(bool use_fullscreen) { | |
| 57 use_fullscreen_host_window_ = use_fullscreen; | |
| 58 } | |
| 59 static bool use_fullscreen_host_window() { | |
| 60 return use_fullscreen_host_window_; | |
| 61 } | |
| 62 | |
| 63 static void set_hide_host_cursor(bool hide) { | 55 static void set_hide_host_cursor(bool hide) { |
| 64 hide_host_cursor_ = hide; | 56 hide_host_cursor_ = hide; |
| 65 } | 57 } |
| 66 static bool hide_host_cursor() { | 58 static bool hide_host_cursor() { |
| 67 return hide_host_cursor_; | 59 return hide_host_cursor_; |
| 68 } | 60 } |
| 69 | 61 |
| 70 ui::Compositor* compositor() { return compositor_.get(); } | 62 ui::Compositor* compositor() { return compositor_.get(); } |
| 71 gfx::Point last_mouse_location() const { return last_mouse_location_; } | 63 gfx::Point last_mouse_location() const { return last_mouse_location_; } |
| 72 gfx::NativeCursor last_cursor() const { return last_cursor_; } | 64 gfx::NativeCursor last_cursor() const { return last_cursor_; } |
| 73 bool cursor_shown() const { return cursor_shown_; } | 65 bool cursor_shown() const { return cursor_shown_; } |
| 74 Window* mouse_pressed_handler() { return mouse_pressed_handler_; } | 66 Window* mouse_pressed_handler() { return mouse_pressed_handler_; } |
| 75 Window* capture_window() { return capture_window_; } | 67 Window* capture_window() { return capture_window_; } |
| 76 Window* focused_window() { return focused_window_; } | 68 Window* focused_window() { return focused_window_; } |
| 77 | 69 |
| 78 // Shows the root window host. | 70 // Shows the root window host. |
| 79 void ShowRootWindow(); | 71 void ShowRootWindow(); |
| 80 | 72 |
| 81 // Sets the size of the root window. | 73 // Sets the size of the root window. |
| 82 void SetHostSize(const gfx::Size& size); | 74 void SetHostSize(const gfx::Size& size); |
| 83 gfx::Size GetHostSize() const; | 75 gfx::Size GetHostSize() const; |
| 84 | 76 |
| 77 // Sets the bounds of the host window. |
| 78 void SetHostBounds(const gfx::Rect& size); |
| 79 |
| 85 // Sets the currently-displayed cursor. If the cursor was previously hidden | 80 // Sets the currently-displayed cursor. If the cursor was previously hidden |
| 86 // via ShowCursor(false), it will remain hidden until ShowCursor(true) is | 81 // via ShowCursor(false), it will remain hidden until ShowCursor(true) is |
| 87 // called, at which point the cursor that was last set via SetCursor() will be | 82 // called, at which point the cursor that was last set via SetCursor() will be |
| 88 // used. | 83 // used. |
| 89 void SetCursor(gfx::NativeCursor cursor); | 84 void SetCursor(gfx::NativeCursor cursor); |
| 90 | 85 |
| 91 // Shows or hides the cursor. | 86 // Shows or hides the cursor. |
| 92 void ShowCursor(bool show); | 87 void ShowCursor(bool show); |
| 93 | 88 |
| 94 // Moves the cursor to the specified location relative to the root window. | 89 // Moves the cursor to the specified location relative to the root window. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 // HoldMouseMoves when an resize is initiated and then ReleaseMouseMoves | 184 // HoldMouseMoves when an resize is initiated and then ReleaseMouseMoves |
| 190 // once the resize is completed. | 185 // once the resize is completed. |
| 191 // | 186 // |
| 192 // More than one hold can be invoked and each hold must be cancelled by a | 187 // More than one hold can be invoked and each hold must be cancelled by a |
| 193 // release before we resume normal operation. | 188 // release before we resume normal operation. |
| 194 void HoldMouseMoves(); | 189 void HoldMouseMoves(); |
| 195 void ReleaseMouseMoves(); | 190 void ReleaseMouseMoves(); |
| 196 | 191 |
| 197 // Overridden from Window: | 192 // Overridden from Window: |
| 198 virtual RootWindow* GetRootWindow() OVERRIDE; | 193 virtual RootWindow* GetRootWindow() OVERRIDE; |
| 194 virtual const RootWindow* GetRootWindow() const OVERRIDE; |
| 199 virtual void SetTransform(const ui::Transform& transform) OVERRIDE; | 195 virtual void SetTransform(const ui::Transform& transform) OVERRIDE; |
| 200 | 196 |
| 201 // Overridden from ui::CompositorDelegate: | 197 // Overridden from ui::CompositorDelegate: |
| 202 virtual void ScheduleDraw() OVERRIDE; | 198 virtual void ScheduleDraw() OVERRIDE; |
| 203 | 199 |
| 204 // Overridden from ui::CompositorObserver: | 200 // Overridden from ui::CompositorObserver: |
| 205 virtual void OnCompositingEnded(ui::Compositor*) OVERRIDE; | 201 virtual void OnCompositingEnded(ui::Compositor*) OVERRIDE; |
| 206 | 202 |
| 207 private: | 203 private: |
| 208 friend class Window; | 204 friend class Window; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 // Creates and dispatches synthesized mouse move event using the | 267 // Creates and dispatches synthesized mouse move event using the |
| 272 // current mouse location. | 268 // current mouse location. |
| 273 void SynthesizeMouseMoveEvent(); | 269 void SynthesizeMouseMoveEvent(); |
| 274 | 270 |
| 275 scoped_ptr<ui::Compositor> compositor_; | 271 scoped_ptr<ui::Compositor> compositor_; |
| 276 | 272 |
| 277 scoped_ptr<RootWindowHost> host_; | 273 scoped_ptr<RootWindowHost> host_; |
| 278 | 274 |
| 279 static RootWindow* instance_; | 275 static RootWindow* instance_; |
| 280 | 276 |
| 281 // If set before the RootWindow is created, the host window will cover the | |
| 282 // entire screen. Note that this can still be overridden via the | |
| 283 // switches::kAuraHostWindowSize flag. | |
| 284 static bool use_fullscreen_host_window_; | |
| 285 | |
| 286 // If set before the RootWindow is created, the cursor will be drawn within | 277 // If set before the RootWindow is created, the cursor will be drawn within |
| 287 // the Aura root window but hidden outside of it, and it'll remain hidden | 278 // the Aura root window but hidden outside of it, and it'll remain hidden |
| 288 // after the Aura window is closed. | 279 // after the Aura window is closed. |
| 289 static bool hide_host_cursor_; | 280 static bool hide_host_cursor_; |
| 290 | 281 |
| 291 // Used to schedule painting. | 282 // Used to schedule painting. |
| 292 base::WeakPtrFactory<RootWindow> schedule_paint_factory_; | 283 base::WeakPtrFactory<RootWindow> schedule_paint_factory_; |
| 293 | 284 |
| 294 // Use to post mouse move event. | 285 // Use to post mouse move event. |
| 295 base::WeakPtrFactory<RootWindow> event_factory_; | 286 base::WeakPtrFactory<RootWindow> event_factory_; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 bool should_hold_mouse_moves_; | 324 bool should_hold_mouse_moves_; |
| 334 bool release_mouse_moves_after_draw_; | 325 bool release_mouse_moves_after_draw_; |
| 335 scoped_ptr<MouseEvent> held_mouse_move_; | 326 scoped_ptr<MouseEvent> held_mouse_move_; |
| 336 | 327 |
| 337 DISALLOW_COPY_AND_ASSIGN(RootWindow); | 328 DISALLOW_COPY_AND_ASSIGN(RootWindow); |
| 338 }; | 329 }; |
| 339 | 330 |
| 340 } // namespace aura | 331 } // namespace aura |
| 341 | 332 |
| 342 #endif // UI_AURA_ROOT_WINDOW_H_ | 333 #endif // UI_AURA_ROOT_WINDOW_H_ |
| OLD | NEW |