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" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
15 #include "ui/aura/aura_export.h" | 15 #include "ui/aura/aura_export.h" |
16 #include "ui/aura/client/capture_delegate.h" | 16 #include "ui/aura/client/capture_delegate.h" |
17 #include "ui/aura/root_window_host_delegate.h" | 17 #include "ui/aura/root_window_host_delegate.h" |
18 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
19 #include "ui/base/cursor/cursor.h" | 19 #include "ui/base/cursor/cursor.h" |
20 #include "ui/base/events/event_constants.h" | 20 #include "ui/base/events/event_constants.h" |
21 #include "ui/base/events/event_dispatcher.h" | 21 #include "ui/base/events/event_dispatcher.h" |
22 #include "ui/base/gestures/gesture_recognizer.h" | 22 #include "ui/base/gestures/gesture_recognizer.h" |
23 #include "ui/base/gestures/gesture_types.h" | 23 #include "ui/base/gestures/gesture_types.h" |
24 #include "ui/compositor/compositor.h" | 24 #include "ui/compositor/compositor.h" |
25 #include "ui/compositor/compositor_observer.h" | 25 #include "ui/compositor/compositor_observer.h" |
26 #include "ui/compositor/layer_animation_observer.h" | 26 #include "ui/compositor/layer_animation_observer.h" |
| 27 #include "ui/gfx/insets.h" |
27 #include "ui/gfx/native_widget_types.h" | 28 #include "ui/gfx/native_widget_types.h" |
28 #include "ui/gfx/point.h" | 29 #include "ui/gfx/point.h" |
29 | 30 |
30 class SkCanvas; | 31 class SkCanvas; |
31 | 32 |
32 namespace gfx { | 33 namespace gfx { |
33 class Size; | 34 class Size; |
34 class Transform; | 35 class Transform; |
35 } | 36 } |
36 | 37 |
(...skipping 18 matching lines...) Expand all Loading... |
55 class AURA_EXPORT RootWindow : public ui::CompositorDelegate, | 56 class AURA_EXPORT RootWindow : public ui::CompositorDelegate, |
56 public ui::CompositorObserver, | 57 public ui::CompositorObserver, |
57 public Window, | 58 public Window, |
58 public ui::EventDispatcherDelegate, | 59 public ui::EventDispatcherDelegate, |
59 public ui::GestureEventHelper, | 60 public ui::GestureEventHelper, |
60 public ui::LayerAnimationObserver, | 61 public ui::LayerAnimationObserver, |
61 public aura::client::CaptureDelegate, | 62 public aura::client::CaptureDelegate, |
62 public aura::RootWindowHostDelegate { | 63 public aura::RootWindowHostDelegate { |
63 public: | 64 public: |
64 struct AURA_EXPORT CreateParams { | 65 struct AURA_EXPORT CreateParams { |
65 // CreateParams with initial_bounds and default host. | 66 // CreateParams with initial_bounds and default host in pixel. |
66 explicit CreateParams(const gfx::Rect& initial_bounds); | 67 explicit CreateParams(const gfx::Rect& initial_bounds); |
67 ~CreateParams() {} | 68 ~CreateParams() {} |
68 | 69 |
69 gfx::Rect initial_bounds; | 70 gfx::Rect initial_bounds; |
70 | 71 |
| 72 gfx::Insets initial_insets; |
| 73 |
71 // A host to use in place of the default one that RootWindow will create. | 74 // A host to use in place of the default one that RootWindow will create. |
72 // NULL by default. | 75 // NULL by default. |
73 RootWindowHost* host; | 76 RootWindowHost* host; |
74 }; | 77 }; |
75 | 78 |
76 explicit RootWindow(const CreateParams& params); | 79 explicit RootWindow(const CreateParams& params); |
77 virtual ~RootWindow(); | 80 virtual ~RootWindow(); |
78 | 81 |
79 // Returns the RootWindowHost for the specified accelerated widget, or NULL | 82 // Returns the RootWindowHost for the specified accelerated widget, or NULL |
80 // if there is none associated. | 83 // if there is none associated. |
(...skipping 10 matching lines...) Expand all Loading... |
91 void ShowRootWindow(); | 94 void ShowRootWindow(); |
92 | 95 |
93 // Hides the root window host. | 96 // Hides the root window host. |
94 void HideRootWindow(); | 97 void HideRootWindow(); |
95 | 98 |
96 // Stop listening events in preparation for shutdown. | 99 // Stop listening events in preparation for shutdown. |
97 void PrepareForShutdown(); | 100 void PrepareForShutdown(); |
98 | 101 |
99 RootWindowHostDelegate* AsRootWindowHostDelegate(); | 102 RootWindowHostDelegate* AsRootWindowHostDelegate(); |
100 | 103 |
101 // Sets the size of the root window. | 104 // Gets/sets the size of the host window. |
102 void SetHostSize(const gfx::Size& size_in_pixel); | 105 void SetHostSize(const gfx::Size& size_in_pixel); |
103 gfx::Size GetHostSize() const; | 106 gfx::Size GetHostSize() const; |
104 | 107 |
105 // Sets the bounds of the host window. | 108 // Sets the bounds and insets of the host window. |
106 void SetHostBounds(const gfx::Rect& size_in_pixel); | 109 void SetHostBounds(const gfx::Rect& size_in_pizel); |
| 110 void SetHostBoundsAndInsets(const gfx::Rect& bounds_in_pixel, |
| 111 const gfx::Insets& insets_in_pixel); |
107 | 112 |
108 // Returns where the RootWindow is on screen. | 113 // Returns where the RootWindow is on screen. |
109 gfx::Point GetHostOrigin() const; | 114 gfx::Point GetHostOrigin() const; |
110 | 115 |
111 // Sets the currently-displayed cursor. If the cursor was previously hidden | 116 // Sets the currently-displayed cursor. If the cursor was previously hidden |
112 // via ShowCursor(false), it will remain hidden until ShowCursor(true) is | 117 // via ShowCursor(false), it will remain hidden until ShowCursor(true) is |
113 // called, at which point the cursor that was last set via SetCursor() will be | 118 // called, at which point the cursor that was last set via SetCursor() will be |
114 // used. | 119 // used. |
115 void SetCursor(gfx::NativeCursor cursor); | 120 void SetCursor(gfx::NativeCursor cursor); |
116 | 121 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 // |reason| specifies what triggered the hiding. |new_root| is the new root | 314 // |reason| specifies what triggered the hiding. |new_root| is the new root |
310 // window, and may be NULL. | 315 // window, and may be NULL. |
311 void OnWindowHidden(Window* invisible, | 316 void OnWindowHidden(Window* invisible, |
312 WindowHiddenReason reason, | 317 WindowHiddenReason reason, |
313 RootWindow* new_root); | 318 RootWindow* new_root); |
314 | 319 |
315 // Cleans up the gesture recognizer for all windows in |window| (including | 320 // Cleans up the gesture recognizer for all windows in |window| (including |
316 // |window| itself). | 321 // |window| itself). |
317 void CleanupGestureRecognizerState(Window* window); | 322 void CleanupGestureRecognizerState(Window* window); |
318 | 323 |
| 324 // Updates the root window's size using |host_size|, current |
| 325 // transform and insets. |
| 326 void UpdateWindowSize(const gfx::Size& host_size); |
| 327 |
| 328 void SetTransformInternal(const gfx::Transform& transform); |
| 329 |
319 // Overridden from ui::EventDispatcherDelegate. | 330 // Overridden from ui::EventDispatcherDelegate. |
320 virtual bool CanDispatchToTarget(EventTarget* target) OVERRIDE; | 331 virtual bool CanDispatchToTarget(EventTarget* target) OVERRIDE; |
321 | 332 |
322 // Overridden from ui::GestureEventHelper. | 333 // Overridden from ui::GestureEventHelper. |
323 virtual bool DispatchLongPressGestureEvent(ui::GestureEvent* event) OVERRIDE; | 334 virtual bool DispatchLongPressGestureEvent(ui::GestureEvent* event) OVERRIDE; |
324 virtual bool DispatchCancelTouchEvent(ui::TouchEvent* event) OVERRIDE; | 335 virtual bool DispatchCancelTouchEvent(ui::TouchEvent* event) OVERRIDE; |
325 | 336 |
326 // Overridden from ui::LayerAnimationObserver: | 337 // Overridden from ui::LayerAnimationObserver: |
327 virtual void OnLayerAnimationEnded( | 338 virtual void OnLayerAnimationEnded( |
328 ui::LayerAnimationSequence* animation) OVERRIDE; | 339 ui::LayerAnimationSequence* animation) OVERRIDE; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 base::WeakPtrFactory<RootWindow> held_mouse_event_factory_; | 423 base::WeakPtrFactory<RootWindow> held_mouse_event_factory_; |
413 | 424 |
414 scoped_ptr<ui::ViewProp> prop_; | 425 scoped_ptr<ui::ViewProp> prop_; |
415 | 426 |
416 DISALLOW_COPY_AND_ASSIGN(RootWindow); | 427 DISALLOW_COPY_AND_ASSIGN(RootWindow); |
417 }; | 428 }; |
418 | 429 |
419 } // namespace aura | 430 } // namespace aura |
420 | 431 |
421 #endif // UI_AURA_ROOT_WINDOW_H_ | 432 #endif // UI_AURA_ROOT_WINDOW_H_ |
OLD | NEW |