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 <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 return hide_host_cursor_; | 91 return hide_host_cursor_; |
92 } | 92 } |
93 | 93 |
94 ui::Compositor* compositor() { return compositor_.get(); } | 94 ui::Compositor* compositor() { return compositor_.get(); } |
95 gfx::Point last_mouse_location() const { return last_mouse_location_; } | 95 gfx::Point last_mouse_location() const { return last_mouse_location_; } |
96 gfx::NativeCursor last_cursor() const { return last_cursor_; } | 96 gfx::NativeCursor last_cursor() const { return last_cursor_; } |
97 bool cursor_shown() const { return cursor_shown_; } | 97 bool cursor_shown() const { return cursor_shown_; } |
98 Window* mouse_pressed_handler() { return mouse_pressed_handler_; } | 98 Window* mouse_pressed_handler() { return mouse_pressed_handler_; } |
99 Window* capture_window() { return capture_window_; } | 99 Window* capture_window() { return capture_window_; } |
100 Window* focused_window() { return focused_window_; } | 100 Window* focused_window() { return focused_window_; } |
101 ui::Layer* magnification_layer() { return magnification_layer_.get(); } | |
101 | 102 |
102 // Initializes the root window. | 103 // Initializes the root window. |
103 void Init(); | 104 void Init(); |
104 | 105 |
105 // Shows the root window host. | 106 // Shows the root window host. |
106 void ShowRootWindow(); | 107 void ShowRootWindow(); |
107 | 108 |
108 // Sets the size of the root window. | 109 // Sets the size of the root window. |
109 void SetHostSize(const gfx::Size& size_in_pixel); | 110 void SetHostSize(const gfx::Size& size_in_pixel); |
110 gfx::Size GetHostSize() const; | 111 gfx::Size GetHostSize() const; |
111 | 112 |
112 // Sets the bounds of the host window. | 113 // Sets the bounds of the host window. |
113 void SetHostBounds(const gfx::Rect& size_in_pixel); | 114 void SetHostBounds(const gfx::Rect& size_in_pixel); |
114 | 115 |
115 // Returns where the RootWindow is on screen. | 116 // Returns where the RootWindow is on screen. |
116 gfx::Point GetHostOrigin() const; | 117 gfx::Point GetHostOrigin() const; |
117 | 118 |
118 // Sets the currently-displayed cursor. If the cursor was previously hidden | 119 // Sets the currently-displayed cursor. If the cursor was previously hidden |
119 // via ShowCursor(false), it will remain hidden until ShowCursor(true) is | 120 // via ShowCursor(false), it will remain hidden until ShowCursor(true) is |
120 // called, at which point the cursor that was last set via SetCursor() will be | 121 // called, at which point the cursor that was last set via SetCursor() will be |
121 // used. | 122 // used. |
122 void SetCursor(gfx::NativeCursor cursor); | 123 void SetCursor(gfx::NativeCursor cursor); |
123 | 124 |
125 // Hides the host cursor if true is set, regardless of ShowCursor(). This is | |
126 // used when chrome draws an alnative cursor instead. (cf. magnified cursor | |
piman
2012/05/18 03:09:49
nit: s/alnative/alternative/
| |
127 // for accessibility) | |
piman
2012/05/18 03:09:49
nit: end with a period.
| |
128 void SetForceHideCursor(bool hide); | |
129 | |
124 // Shows or hides the cursor. | 130 // Shows or hides the cursor. |
125 void ShowCursor(bool show); | 131 void ShowCursor(bool show); |
126 | 132 |
127 // Moves the cursor to the specified location relative to the root window. | 133 // Moves the cursor to the specified location relative to the root window. |
128 void MoveCursorTo(const gfx::Point& location); | 134 void MoveCursorTo(const gfx::Point& location); |
129 | 135 |
130 // Clips the cursor movement to |capture_window_|. Should be invoked only | 136 // Clips the cursor movement to |capture_window_|. Should be invoked only |
131 // after SetCapture(). ReleaseCapture() implicitly removes any confines set | 137 // after SetCapture(). ReleaseCapture() implicitly removes any confines set |
132 // using this function. Returns true if successful. | 138 // using this function. Returns true if successful. |
133 bool ConfineCursorToWindow(); | 139 bool ConfineCursorToWindow(); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
344 // current mouse location. | 350 // current mouse location. |
345 void SynthesizeMouseMoveEvent(); | 351 void SynthesizeMouseMoveEvent(); |
346 | 352 |
347 // Called by CompositorLock. | 353 // Called by CompositorLock. |
348 void UnlockCompositor(); | 354 void UnlockCompositor(); |
349 | 355 |
350 scoped_ptr<ui::Compositor> compositor_; | 356 scoped_ptr<ui::Compositor> compositor_; |
351 | 357 |
352 scoped_ptr<RootWindowHost> host_; | 358 scoped_ptr<RootWindowHost> host_; |
353 | 359 |
360 // Layer for screen magnification. This layer doesn't transform location of | |
361 // mouse event. When the layer were transformed, the mouse pointer drawn by | |
362 // the host would indicate diffirent location and chrome should draw a | |
363 // software cursor instead of a hardware cursor by the host. | |
364 scoped_ptr<ui::Layer> magnification_layer_; | |
365 | |
354 // If set before the RootWindow is created, the cursor will be drawn within | 366 // If set before the RootWindow is created, the cursor will be drawn within |
355 // the Aura root window but hidden outside of it, and it'll remain hidden | 367 // the Aura root window but hidden outside of it, and it'll remain hidden |
356 // after the Aura window is closed. | 368 // after the Aura window is closed. |
357 static bool hide_host_cursor_; | 369 static bool hide_host_cursor_; |
358 | 370 |
359 // Used to schedule painting. | 371 // Used to schedule painting. |
360 base::WeakPtrFactory<RootWindow> schedule_paint_factory_; | 372 base::WeakPtrFactory<RootWindow> schedule_paint_factory_; |
361 | 373 |
362 // Use to post mouse move event. | 374 // Use to post mouse move event. |
363 base::WeakPtrFactory<RootWindow> event_factory_; | 375 base::WeakPtrFactory<RootWindow> event_factory_; |
(...skipping 28 matching lines...) Expand all Loading... | |
392 bool draw_on_compositing_end_; | 404 bool draw_on_compositing_end_; |
393 | 405 |
394 bool defer_draw_scheduling_; | 406 bool defer_draw_scheduling_; |
395 | 407 |
396 // How many holds are outstanding. We try to defer dispatching mouse moves | 408 // How many holds are outstanding. We try to defer dispatching mouse moves |
397 // while the count is > 0. | 409 // while the count is > 0. |
398 int mouse_move_hold_count_; | 410 int mouse_move_hold_count_; |
399 bool should_hold_mouse_moves_; | 411 bool should_hold_mouse_moves_; |
400 scoped_ptr<MouseEvent> held_mouse_move_; | 412 scoped_ptr<MouseEvent> held_mouse_move_; |
401 | 413 |
414 bool force_hide_cursor_; | |
415 | |
402 CompositorLock* compositor_lock_; | 416 CompositorLock* compositor_lock_; |
403 bool draw_on_compositor_unlock_; | 417 bool draw_on_compositor_unlock_; |
404 | 418 |
405 int draw_trace_count_; | 419 int draw_trace_count_; |
406 | 420 |
407 DISALLOW_COPY_AND_ASSIGN(RootWindow); | 421 DISALLOW_COPY_AND_ASSIGN(RootWindow); |
408 }; | 422 }; |
409 | 423 |
410 } // namespace aura | 424 } // namespace aura |
411 | 425 |
412 #endif // UI_AURA_ROOT_WINDOW_H_ | 426 #endif // UI_AURA_ROOT_WINDOW_H_ |
OLD | NEW |