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/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
89 return hide_host_cursor_; | 89 return hide_host_cursor_; |
90 } | 90 } |
91 | 91 |
92 ui::Compositor* compositor() { return compositor_.get(); } | 92 ui::Compositor* compositor() { return compositor_.get(); } |
93 gfx::Point last_mouse_location() const { return last_mouse_location_; } | 93 gfx::Point last_mouse_location() const { return last_mouse_location_; } |
94 gfx::NativeCursor last_cursor() const { return last_cursor_; } | 94 gfx::NativeCursor last_cursor() const { return last_cursor_; } |
95 bool cursor_shown() const { return cursor_shown_; } | 95 bool cursor_shown() const { return cursor_shown_; } |
96 Window* mouse_pressed_handler() { return mouse_pressed_handler_; } | 96 Window* mouse_pressed_handler() { return mouse_pressed_handler_; } |
97 Window* capture_window() { return capture_window_; } | 97 Window* capture_window() { return capture_window_; } |
98 Window* focused_window() { return focused_window_; } | 98 Window* focused_window() { return focused_window_; } |
99 ui::Layer* magnification_layer() { return magnification_layer_.get(); } | |
99 | 100 |
100 // Initializes the root window. | 101 // Initializes the root window. |
101 void Init(); | 102 void Init(); |
102 | 103 |
103 // Shows the root window host. | 104 // Shows the root window host. |
104 void ShowRootWindow(); | 105 void ShowRootWindow(); |
105 | 106 |
106 // Sets the size of the root window. | 107 // Sets the size of the root window. |
107 void SetHostSize(const gfx::Size& size_in_pixel); | 108 void SetHostSize(const gfx::Size& size_in_pixel); |
108 gfx::Size GetHostSize() const; | 109 gfx::Size GetHostSize() const; |
109 | 110 |
110 // Sets the bounds of the host window. | 111 // Sets the bounds of the host window. |
111 void SetHostBounds(const gfx::Rect& size_in_pixel); | 112 void SetHostBounds(const gfx::Rect& size_in_pixel); |
112 | 113 |
113 // Returns where the RootWindow is on screen. | 114 // Returns where the RootWindow is on screen. |
114 gfx::Point GetHostOrigin() const; | 115 gfx::Point GetHostOrigin() const; |
115 | 116 |
116 // Sets the currently-displayed cursor. If the cursor was previously hidden | 117 // Sets the currently-displayed cursor. If the cursor was previously hidden |
117 // via ShowCursor(false), it will remain hidden until ShowCursor(true) is | 118 // via ShowCursor(false), it will remain hidden until ShowCursor(true) is |
118 // 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 |
119 // used. | 120 // used. |
120 void SetCursor(gfx::NativeCursor cursor); | 121 void SetCursor(gfx::NativeCursor cursor); |
121 | 122 |
123 void SetForceHideCursor(bool hide) { | |
sky
2012/05/16 15:40:48
Add description
yoshiki
2012/05/17 17:19:32
Done.
| |
124 force_hide_cursor_ = hide; | |
sky
2012/05/16 15:40:48
SHouldn't this update the cursor immediately if th
yoshiki
2012/05/17 17:19:32
Done.
| |
125 } | |
126 | |
122 // Shows or hides the cursor. | 127 // Shows or hides the cursor. |
123 void ShowCursor(bool show); | 128 void ShowCursor(bool show); |
124 | 129 |
125 // Moves the cursor to the specified location relative to the root window. | 130 // Moves the cursor to the specified location relative to the root window. |
126 void MoveCursorTo(const gfx::Point& location); | 131 void MoveCursorTo(const gfx::Point& location); |
127 | 132 |
128 // Clips the cursor movement to |capture_window_|. Should be invoked only | 133 // Clips the cursor movement to |capture_window_|. Should be invoked only |
129 // after SetCapture(). ReleaseCapture() implicitly removes any confines set | 134 // after SetCapture(). ReleaseCapture() implicitly removes any confines set |
130 // using this function. Returns true if successful. | 135 // using this function. Returns true if successful. |
131 bool ConfineCursorToWindow(); | 136 bool ConfineCursorToWindow(); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
342 // current mouse location. | 347 // current mouse location. |
343 void SynthesizeMouseMoveEvent(); | 348 void SynthesizeMouseMoveEvent(); |
344 | 349 |
345 // Called by CompositorLock. | 350 // Called by CompositorLock. |
346 void UnlockCompositor(); | 351 void UnlockCompositor(); |
347 | 352 |
348 scoped_ptr<ui::Compositor> compositor_; | 353 scoped_ptr<ui::Compositor> compositor_; |
349 | 354 |
350 scoped_ptr<RootWindowHost> host_; | 355 scoped_ptr<RootWindowHost> host_; |
351 | 356 |
357 scoped_ptr<ui::Layer> magnification_layer_; | |
sky
2012/05/16 15:40:48
Add description.
yoshiki
2012/05/17 17:19:32
Done.
| |
358 | |
352 // If set before the RootWindow is created, the cursor will be drawn within | 359 // If set before the RootWindow is created, the cursor will be drawn within |
353 // the Aura root window but hidden outside of it, and it'll remain hidden | 360 // the Aura root window but hidden outside of it, and it'll remain hidden |
354 // after the Aura window is closed. | 361 // after the Aura window is closed. |
355 static bool hide_host_cursor_; | 362 static bool hide_host_cursor_; |
356 | 363 |
357 // Used to schedule painting. | 364 // Used to schedule painting. |
358 base::WeakPtrFactory<RootWindow> schedule_paint_factory_; | 365 base::WeakPtrFactory<RootWindow> schedule_paint_factory_; |
359 | 366 |
360 // Use to post mouse move event. | 367 // Use to post mouse move event. |
361 base::WeakPtrFactory<RootWindow> event_factory_; | 368 base::WeakPtrFactory<RootWindow> event_factory_; |
(...skipping 30 matching lines...) Expand all Loading... | |
392 bool draw_on_compositing_end_; | 399 bool draw_on_compositing_end_; |
393 | 400 |
394 bool defer_draw_scheduling_; | 401 bool defer_draw_scheduling_; |
395 | 402 |
396 // How many holds are outstanding. We try to defer dispatching mouse moves | 403 // How many holds are outstanding. We try to defer dispatching mouse moves |
397 // while the count is > 0. | 404 // while the count is > 0. |
398 int mouse_move_hold_count_; | 405 int mouse_move_hold_count_; |
399 bool should_hold_mouse_moves_; | 406 bool should_hold_mouse_moves_; |
400 scoped_ptr<MouseEvent> held_mouse_move_; | 407 scoped_ptr<MouseEvent> held_mouse_move_; |
401 | 408 |
409 bool force_hide_cursor_; | |
410 | |
402 CompositorLock* compositor_lock_; | 411 CompositorLock* compositor_lock_; |
403 bool draw_on_compositor_unlock_; | 412 bool draw_on_compositor_unlock_; |
404 | 413 |
405 int draw_trace_count_; | 414 int draw_trace_count_; |
406 | 415 |
407 DISALLOW_COPY_AND_ASSIGN(RootWindow); | 416 DISALLOW_COPY_AND_ASSIGN(RootWindow); |
408 }; | 417 }; |
409 | 418 |
410 } // namespace aura | 419 } // namespace aura |
411 | 420 |
412 #endif // UI_AURA_ROOT_WINDOW_H_ | 421 #endif // UI_AURA_ROOT_WINDOW_H_ |
OLD | NEW |