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 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 class KeyEvent; | 40 class KeyEvent; |
41 class LayerAnimationSequence; | 41 class LayerAnimationSequence; |
42 class MouseEvent; | 42 class MouseEvent; |
43 class ScrollEvent; | 43 class ScrollEvent; |
44 class TouchEvent; | 44 class TouchEvent; |
45 class ViewProp; | 45 class ViewProp; |
46 } | 46 } |
47 | 47 |
48 namespace aura { | 48 namespace aura { |
49 | 49 |
50 class FocusManager; | |
51 class RootWindow; | 50 class RootWindow; |
52 class RootWindowHost; | 51 class RootWindowHost; |
53 class RootWindowObserver; | 52 class RootWindowObserver; |
54 | 53 |
55 // RootWindow is responsible for hosting a set of windows. | 54 // RootWindow is responsible for hosting a set of windows. |
56 class AURA_EXPORT RootWindow : public ui::CompositorDelegate, | 55 class AURA_EXPORT RootWindow : public ui::CompositorDelegate, |
57 public ui::CompositorObserver, | 56 public ui::CompositorObserver, |
58 public Window, | 57 public Window, |
59 public ui::EventDispatcher, | 58 public ui::EventDispatcher, |
60 public ui::GestureEventHelper, | 59 public ui::GestureEventHelper, |
(...skipping 17 matching lines...) Expand all Loading... |
78 virtual ~RootWindow(); | 77 virtual ~RootWindow(); |
79 | 78 |
80 // Returns the RootWindowHost for the specified accelerated widget, or NULL | 79 // Returns the RootWindowHost for the specified accelerated widget, or NULL |
81 // if there is none associated. | 80 // if there is none associated. |
82 static RootWindow* GetForAcceleratedWidget(gfx::AcceleratedWidget widget); | 81 static RootWindow* GetForAcceleratedWidget(gfx::AcceleratedWidget widget); |
83 | 82 |
84 ui::Compositor* compositor() { return compositor_.get(); } | 83 ui::Compositor* compositor() { return compositor_.get(); } |
85 gfx::NativeCursor last_cursor() const { return last_cursor_; } | 84 gfx::NativeCursor last_cursor() const { return last_cursor_; } |
86 Window* mouse_pressed_handler() { return mouse_pressed_handler_; } | 85 Window* mouse_pressed_handler() { return mouse_pressed_handler_; } |
87 | 86 |
88 void set_focus_manager(FocusManager* focus_manager) { | |
89 focus_manager_ = focus_manager; | |
90 } | |
91 | |
92 // Initializes the root window. | 87 // Initializes the root window. |
93 void Init(); | 88 void Init(); |
94 | 89 |
95 // Shows the root window host. | 90 // Shows the root window host. |
96 void ShowRootWindow(); | 91 void ShowRootWindow(); |
97 | 92 |
98 // Hides the root window host. | 93 // Hides the root window host. |
99 void HideRootWindow(); | 94 void HideRootWindow(); |
100 | 95 |
101 // Stop listening events in preparation for shutdown. | 96 // Stop listening events in preparation for shutdown. |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 virtual void OnCompositingEnded(ui::Compositor*) OVERRIDE; | 242 virtual void OnCompositingEnded(ui::Compositor*) OVERRIDE; |
248 virtual void OnCompositingAborted(ui::Compositor*) OVERRIDE; | 243 virtual void OnCompositingAborted(ui::Compositor*) OVERRIDE; |
249 virtual void OnCompositingLockStateChanged(ui::Compositor*) OVERRIDE; | 244 virtual void OnCompositingLockStateChanged(ui::Compositor*) OVERRIDE; |
250 | 245 |
251 // Overridden from ui::LayerDelegate: | 246 // Overridden from ui::LayerDelegate: |
252 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; | 247 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; |
253 | 248 |
254 // Overridden from Window: | 249 // Overridden from Window: |
255 virtual bool CanFocus() const OVERRIDE; | 250 virtual bool CanFocus() const OVERRIDE; |
256 virtual bool CanReceiveEvents() const OVERRIDE; | 251 virtual bool CanReceiveEvents() const OVERRIDE; |
257 virtual FocusManager* GetFocusManager() OVERRIDE; | |
258 | 252 |
259 // Overridden from aura::client::CaptureDelegate: | 253 // Overridden from aura::client::CaptureDelegate: |
260 virtual void UpdateCapture(Window* old_capture, Window* new_capture) OVERRIDE; | 254 virtual void UpdateCapture(Window* old_capture, Window* new_capture) OVERRIDE; |
261 virtual void SetNativeCapture() OVERRIDE; | 255 virtual void SetNativeCapture() OVERRIDE; |
262 virtual void ReleaseNativeCapture() OVERRIDE; | 256 virtual void ReleaseNativeCapture() OVERRIDE; |
263 | 257 |
264 // Exposes RootWindowHost::QueryMouseLocation() for test purposes. | 258 // Exposes RootWindowHost::QueryMouseLocation() for test purposes. |
265 gfx::Point QueryMouseLocationForTest() const; | 259 gfx::Point QueryMouseLocationForTest() const; |
266 | 260 |
267 private: | 261 private: |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 373 |
380 // Last cursor set. Used for testing. | 374 // Last cursor set. Used for testing. |
381 gfx::NativeCursor last_cursor_; | 375 gfx::NativeCursor last_cursor_; |
382 | 376 |
383 ObserverList<RootWindowObserver> observers_; | 377 ObserverList<RootWindowObserver> observers_; |
384 | 378 |
385 Window* mouse_pressed_handler_; | 379 Window* mouse_pressed_handler_; |
386 Window* mouse_moved_handler_; | 380 Window* mouse_moved_handler_; |
387 Window* mouse_event_dispatch_target_; | 381 Window* mouse_event_dispatch_target_; |
388 Window* event_dispatch_target_; | 382 Window* event_dispatch_target_; |
389 FocusManager* focus_manager_; | |
390 | 383 |
391 // The gesture_recognizer_ for this. | 384 // The gesture_recognizer_ for this. |
392 scoped_ptr<ui::GestureRecognizer> gesture_recognizer_; | 385 scoped_ptr<ui::GestureRecognizer> gesture_recognizer_; |
393 | 386 |
394 bool synthesize_mouse_move_; | 387 bool synthesize_mouse_move_; |
395 bool waiting_on_compositing_end_; | 388 bool waiting_on_compositing_end_; |
396 bool draw_on_compositing_end_; | 389 bool draw_on_compositing_end_; |
397 | 390 |
398 bool defer_draw_scheduling_; | 391 bool defer_draw_scheduling_; |
399 | 392 |
400 // How many holds are outstanding. We try to defer dispatching mouse moves | 393 // How many holds are outstanding. We try to defer dispatching mouse moves |
401 // while the count is > 0. | 394 // while the count is > 0. |
402 int mouse_move_hold_count_; | 395 int mouse_move_hold_count_; |
403 scoped_ptr<ui::MouseEvent> held_mouse_move_; | 396 scoped_ptr<ui::MouseEvent> held_mouse_move_; |
404 // Used to schedule DispatchHeldMouseMove() when |mouse_move_hold_count_| goes | 397 // Used to schedule DispatchHeldMouseMove() when |mouse_move_hold_count_| goes |
405 // to 0. | 398 // to 0. |
406 base::WeakPtrFactory<RootWindow> held_mouse_event_factory_; | 399 base::WeakPtrFactory<RootWindow> held_mouse_event_factory_; |
407 | 400 |
408 scoped_ptr<ui::ViewProp> prop_; | 401 scoped_ptr<ui::ViewProp> prop_; |
409 | 402 |
410 DISALLOW_COPY_AND_ASSIGN(RootWindow); | 403 DISALLOW_COPY_AND_ASSIGN(RootWindow); |
411 }; | 404 }; |
412 | 405 |
413 } // namespace aura | 406 } // namespace aura |
414 | 407 |
415 #endif // UI_AURA_ROOT_WINDOW_H_ | 408 #endif // UI_AURA_ROOT_WINDOW_H_ |
OLD | NEW |