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_VIEWS_WIDGET_NATIVE_WIDGET_AURA_H_ | 5 #ifndef UI_VIEWS_WIDGET_NATIVE_WIDGET_AURA_H_ |
6 #define UI_VIEWS_WIDGET_NATIVE_WIDGET_AURA_H_ | 6 #define UI_VIEWS_WIDGET_NATIVE_WIDGET_AURA_H_ |
7 | 7 |
8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "ui/aura/client/focus_change_observer.h" | 10 #include "ui/aura/client/focus_change_observer.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 public: | 44 public: |
45 explicit NativeWidgetAura(internal::NativeWidgetDelegate* delegate); | 45 explicit NativeWidgetAura(internal::NativeWidgetDelegate* delegate); |
46 | 46 |
47 // Called internally by NativeWidgetAura and DesktopNativeWidgetAura to | 47 // Called internally by NativeWidgetAura and DesktopNativeWidgetAura to |
48 // associate |native_widget| with |window|. | 48 // associate |native_widget| with |window|. |
49 static void RegisterNativeWidgetForWindow( | 49 static void RegisterNativeWidgetForWindow( |
50 internal::NativeWidgetPrivate* native_widget, | 50 internal::NativeWidgetPrivate* native_widget, |
51 aura::Window* window); | 51 aura::Window* window); |
52 | 52 |
53 // Overridden from internal::NativeWidgetPrivate: | 53 // Overridden from internal::NativeWidgetPrivate: |
54 virtual void InitNativeWidget(const Widget::InitParams& params) override; | 54 void InitNativeWidget(const Widget::InitParams& params) override; |
55 virtual NonClientFrameView* CreateNonClientFrameView() override; | 55 NonClientFrameView* CreateNonClientFrameView() override; |
56 virtual bool ShouldUseNativeFrame() const override; | 56 bool ShouldUseNativeFrame() const override; |
57 virtual bool ShouldWindowContentsBeTransparent() const override; | 57 bool ShouldWindowContentsBeTransparent() const override; |
58 virtual void FrameTypeChanged() override; | 58 void FrameTypeChanged() override; |
59 virtual Widget* GetWidget() override; | 59 Widget* GetWidget() override; |
60 virtual const Widget* GetWidget() const override; | 60 const Widget* GetWidget() const override; |
61 virtual gfx::NativeView GetNativeView() const override; | 61 gfx::NativeView GetNativeView() const override; |
62 virtual gfx::NativeWindow GetNativeWindow() const override; | 62 gfx::NativeWindow GetNativeWindow() const override; |
63 virtual Widget* GetTopLevelWidget() override; | 63 Widget* GetTopLevelWidget() override; |
64 virtual const ui::Compositor* GetCompositor() const override; | 64 const ui::Compositor* GetCompositor() const override; |
65 virtual ui::Compositor* GetCompositor() override; | 65 ui::Compositor* GetCompositor() override; |
66 virtual ui::Layer* GetLayer() override; | 66 ui::Layer* GetLayer() override; |
67 virtual void ReorderNativeViews() override; | 67 void ReorderNativeViews() override; |
68 virtual void ViewRemoved(View* view) override; | 68 void ViewRemoved(View* view) override; |
69 virtual void SetNativeWindowProperty(const char* name, void* value) override; | 69 void SetNativeWindowProperty(const char* name, void* value) override; |
70 virtual void* GetNativeWindowProperty(const char* name) const override; | 70 void* GetNativeWindowProperty(const char* name) const override; |
71 virtual TooltipManager* GetTooltipManager() const override; | 71 TooltipManager* GetTooltipManager() const override; |
72 virtual void SetCapture() override; | 72 void SetCapture() override; |
73 virtual void ReleaseCapture() override; | 73 void ReleaseCapture() override; |
74 virtual bool HasCapture() const override; | 74 bool HasCapture() const override; |
75 virtual InputMethod* CreateInputMethod() override; | 75 InputMethod* CreateInputMethod() override; |
76 virtual internal::InputMethodDelegate* GetInputMethodDelegate() override; | 76 internal::InputMethodDelegate* GetInputMethodDelegate() override; |
77 virtual ui::InputMethod* GetHostInputMethod() override; | 77 ui::InputMethod* GetHostInputMethod() override; |
78 virtual void CenterWindow(const gfx::Size& size) override; | 78 void CenterWindow(const gfx::Size& size) override; |
79 virtual void GetWindowPlacement( | 79 void GetWindowPlacement(gfx::Rect* bounds, |
80 gfx::Rect* bounds, | 80 ui::WindowShowState* maximized) const override; |
81 ui::WindowShowState* maximized) const override; | 81 bool SetWindowTitle(const base::string16& title) override; |
82 virtual bool SetWindowTitle(const base::string16& title) override; | 82 void SetWindowIcons(const gfx::ImageSkia& window_icon, |
83 virtual void SetWindowIcons(const gfx::ImageSkia& window_icon, | 83 const gfx::ImageSkia& app_icon) override; |
84 const gfx::ImageSkia& app_icon) override; | 84 void InitModalType(ui::ModalType modal_type) override; |
85 virtual void InitModalType(ui::ModalType modal_type) override; | 85 gfx::Rect GetWindowBoundsInScreen() const override; |
86 virtual gfx::Rect GetWindowBoundsInScreen() const override; | 86 gfx::Rect GetClientAreaBoundsInScreen() const override; |
87 virtual gfx::Rect GetClientAreaBoundsInScreen() const override; | 87 gfx::Rect GetRestoredBounds() const override; |
88 virtual gfx::Rect GetRestoredBounds() const override; | 88 void SetBounds(const gfx::Rect& bounds) override; |
89 virtual void SetBounds(const gfx::Rect& bounds) override; | 89 void SetSize(const gfx::Size& size) override; |
90 virtual void SetSize(const gfx::Size& size) override; | 90 void StackAbove(gfx::NativeView native_view) override; |
91 virtual void StackAbove(gfx::NativeView native_view) override; | 91 void StackAtTop() override; |
92 virtual void StackAtTop() override; | 92 void StackBelow(gfx::NativeView native_view) override; |
93 virtual void StackBelow(gfx::NativeView native_view) override; | 93 void SetShape(gfx::NativeRegion shape) override; |
94 virtual void SetShape(gfx::NativeRegion shape) override; | 94 void Close() override; |
95 virtual void Close() override; | 95 void CloseNow() override; |
96 virtual void CloseNow() override; | 96 void Show() override; |
97 virtual void Show() override; | 97 void Hide() override; |
98 virtual void Hide() override; | 98 void ShowMaximizedWithBounds(const gfx::Rect& restored_bounds) override; |
99 virtual void ShowMaximizedWithBounds( | 99 void ShowWithWindowState(ui::WindowShowState state) override; |
100 const gfx::Rect& restored_bounds) override; | 100 bool IsVisible() const override; |
101 virtual void ShowWithWindowState(ui::WindowShowState state) override; | 101 void Activate() override; |
102 virtual bool IsVisible() const override; | 102 void Deactivate() override; |
103 virtual void Activate() override; | 103 bool IsActive() const override; |
104 virtual void Deactivate() override; | 104 void SetAlwaysOnTop(bool always_on_top) override; |
105 virtual bool IsActive() const override; | 105 bool IsAlwaysOnTop() const override; |
106 virtual void SetAlwaysOnTop(bool always_on_top) override; | 106 void SetVisibleOnAllWorkspaces(bool always_visible) override; |
107 virtual bool IsAlwaysOnTop() const override; | 107 void Maximize() override; |
108 virtual void SetVisibleOnAllWorkspaces(bool always_visible) override; | 108 void Minimize() override; |
109 virtual void Maximize() override; | 109 bool IsMaximized() const override; |
110 virtual void Minimize() override; | 110 bool IsMinimized() const override; |
111 virtual bool IsMaximized() const override; | 111 void Restore() override; |
112 virtual bool IsMinimized() const override; | 112 void SetFullscreen(bool fullscreen) override; |
113 virtual void Restore() override; | 113 bool IsFullscreen() const override; |
114 virtual void SetFullscreen(bool fullscreen) override; | 114 void SetOpacity(unsigned char opacity) override; |
115 virtual bool IsFullscreen() const override; | 115 void SetUseDragFrame(bool use_drag_frame) override; |
116 virtual void SetOpacity(unsigned char opacity) override; | 116 void FlashFrame(bool flash_frame) override; |
117 virtual void SetUseDragFrame(bool use_drag_frame) override; | 117 void RunShellDrag(View* view, |
118 virtual void FlashFrame(bool flash_frame) override; | 118 const ui::OSExchangeData& data, |
119 virtual void RunShellDrag(View* view, | 119 const gfx::Point& location, |
120 const ui::OSExchangeData& data, | 120 int operation, |
121 const gfx::Point& location, | 121 ui::DragDropTypes::DragEventSource source) override; |
122 int operation, | 122 void SchedulePaintInRect(const gfx::Rect& rect) override; |
123 ui::DragDropTypes::DragEventSource source) override; | 123 void SetCursor(gfx::NativeCursor cursor) override; |
124 virtual void SchedulePaintInRect(const gfx::Rect& rect) override; | 124 bool IsMouseEventsEnabled() const override; |
125 virtual void SetCursor(gfx::NativeCursor cursor) override; | 125 void ClearNativeFocus() override; |
126 virtual bool IsMouseEventsEnabled() const override; | 126 gfx::Rect GetWorkAreaBoundsInScreen() const override; |
127 virtual void ClearNativeFocus() override; | 127 Widget::MoveLoopResult RunMoveLoop( |
128 virtual gfx::Rect GetWorkAreaBoundsInScreen() const override; | |
129 virtual Widget::MoveLoopResult RunMoveLoop( | |
130 const gfx::Vector2d& drag_offset, | 128 const gfx::Vector2d& drag_offset, |
131 Widget::MoveLoopSource source, | 129 Widget::MoveLoopSource source, |
132 Widget::MoveLoopEscapeBehavior escape_behavior) override; | 130 Widget::MoveLoopEscapeBehavior escape_behavior) override; |
133 virtual void EndMoveLoop() override; | 131 void EndMoveLoop() override; |
134 virtual void SetVisibilityChangedAnimationsEnabled(bool value) override; | 132 void SetVisibilityChangedAnimationsEnabled(bool value) override; |
135 virtual ui::NativeTheme* GetNativeTheme() const override; | 133 ui::NativeTheme* GetNativeTheme() const override; |
136 virtual void OnRootViewLayout() override; | 134 void OnRootViewLayout() override; |
137 virtual bool IsTranslucentWindowOpacitySupported() const override; | 135 bool IsTranslucentWindowOpacitySupported() const override; |
138 virtual void OnSizeConstraintsChanged() override; | 136 void OnSizeConstraintsChanged() override; |
139 virtual void RepostNativeEvent(gfx::NativeEvent native_event) override; | 137 void RepostNativeEvent(gfx::NativeEvent native_event) override; |
140 | 138 |
141 // Overridden from views::InputMethodDelegate: | 139 // Overridden from views::InputMethodDelegate: |
142 virtual void DispatchKeyEventPostIME(const ui::KeyEvent& key) override; | 140 void DispatchKeyEventPostIME(const ui::KeyEvent& key) override; |
143 | 141 |
144 // Overridden from aura::WindowDelegate: | 142 // Overridden from aura::WindowDelegate: |
145 virtual gfx::Size GetMinimumSize() const override; | 143 gfx::Size GetMinimumSize() const override; |
146 virtual gfx::Size GetMaximumSize() const override; | 144 gfx::Size GetMaximumSize() const override; |
147 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, | 145 void OnBoundsChanged(const gfx::Rect& old_bounds, |
148 const gfx::Rect& new_bounds) override; | 146 const gfx::Rect& new_bounds) override; |
149 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) override; | 147 gfx::NativeCursor GetCursor(const gfx::Point& point) override; |
150 virtual int GetNonClientComponent(const gfx::Point& point) const override; | 148 int GetNonClientComponent(const gfx::Point& point) const override; |
151 virtual bool ShouldDescendIntoChildForEventHandling( | 149 bool ShouldDescendIntoChildForEventHandling( |
152 aura::Window* child, | 150 aura::Window* child, |
153 const gfx::Point& location) override; | 151 const gfx::Point& location) override; |
154 virtual bool CanFocus() override; | 152 bool CanFocus() override; |
155 virtual void OnCaptureLost() override; | 153 void OnCaptureLost() override; |
156 virtual void OnPaint(gfx::Canvas* canvas) override; | 154 void OnPaint(gfx::Canvas* canvas) override; |
157 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override; | 155 void OnDeviceScaleFactorChanged(float device_scale_factor) override; |
158 virtual void OnWindowDestroying(aura::Window* window) override; | 156 void OnWindowDestroying(aura::Window* window) override; |
159 virtual void OnWindowDestroyed(aura::Window* window) override; | 157 void OnWindowDestroyed(aura::Window* window) override; |
160 virtual void OnWindowTargetVisibilityChanged(bool visible) override; | 158 void OnWindowTargetVisibilityChanged(bool visible) override; |
161 virtual bool HasHitTestMask() const override; | 159 bool HasHitTestMask() const override; |
162 virtual void GetHitTestMask(gfx::Path* mask) const override; | 160 void GetHitTestMask(gfx::Path* mask) const override; |
163 | 161 |
164 // Overridden from aura::WindowObserver: | 162 // Overridden from aura::WindowObserver: |
165 virtual void OnWindowPropertyChanged(aura::Window* window, | 163 void OnWindowPropertyChanged(aura::Window* window, |
166 const void* key, | 164 const void* key, |
167 intptr_t old) override; | 165 intptr_t old) override; |
168 | 166 |
169 // Overridden from ui::EventHandler: | 167 // Overridden from ui::EventHandler: |
170 virtual void OnKeyEvent(ui::KeyEvent* event) override; | 168 void OnKeyEvent(ui::KeyEvent* event) override; |
171 virtual void OnMouseEvent(ui::MouseEvent* event) override; | 169 void OnMouseEvent(ui::MouseEvent* event) override; |
172 virtual void OnScrollEvent(ui::ScrollEvent* event) override; | 170 void OnScrollEvent(ui::ScrollEvent* event) override; |
173 virtual void OnGestureEvent(ui::GestureEvent* event) override; | 171 void OnGestureEvent(ui::GestureEvent* event) override; |
174 | 172 |
175 // Overridden from aura::client::ActivationDelegate: | 173 // Overridden from aura::client::ActivationDelegate: |
176 virtual bool ShouldActivate() const override; | 174 bool ShouldActivate() const override; |
177 | 175 |
178 // Overridden from aura::client::ActivationChangeObserver: | 176 // Overridden from aura::client::ActivationChangeObserver: |
179 virtual void OnWindowActivated(aura::Window* gained_active, | 177 void OnWindowActivated(aura::Window* gained_active, |
180 aura::Window* lost_active) override; | 178 aura::Window* lost_active) override; |
181 | 179 |
182 // Overridden from aura::client::FocusChangeObserver: | 180 // Overridden from aura::client::FocusChangeObserver: |
183 virtual void OnWindowFocused(aura::Window* gained_focus, | 181 void OnWindowFocused(aura::Window* gained_focus, |
184 aura::Window* lost_focus) override; | 182 aura::Window* lost_focus) override; |
185 | 183 |
186 // Overridden from aura::client::DragDropDelegate: | 184 // Overridden from aura::client::DragDropDelegate: |
187 virtual void OnDragEntered(const ui::DropTargetEvent& event) override; | 185 void OnDragEntered(const ui::DropTargetEvent& event) override; |
188 virtual int OnDragUpdated(const ui::DropTargetEvent& event) override; | 186 int OnDragUpdated(const ui::DropTargetEvent& event) override; |
189 virtual void OnDragExited() override; | 187 void OnDragExited() override; |
190 virtual int OnPerformDrop(const ui::DropTargetEvent& event) override; | 188 int OnPerformDrop(const ui::DropTargetEvent& event) override; |
191 | 189 |
192 protected: | 190 protected: |
193 virtual ~NativeWidgetAura(); | 191 ~NativeWidgetAura() override; |
194 | 192 |
195 internal::NativeWidgetDelegate* delegate() { return delegate_; } | 193 internal::NativeWidgetDelegate* delegate() { return delegate_; } |
196 | 194 |
197 private: | 195 private: |
198 class ActiveWindowObserver; | 196 class ActiveWindowObserver; |
199 | 197 |
200 void SetInitialFocus(ui::WindowShowState show_state); | 198 void SetInitialFocus(ui::WindowShowState show_state); |
201 | 199 |
202 internal::NativeWidgetDelegate* delegate_; | 200 internal::NativeWidgetDelegate* delegate_; |
203 | 201 |
(...skipping 25 matching lines...) Expand all Loading... |
229 // The following factory is used for calls to close the NativeWidgetAura | 227 // The following factory is used for calls to close the NativeWidgetAura |
230 // instance. | 228 // instance. |
231 base::WeakPtrFactory<NativeWidgetAura> close_widget_factory_; | 229 base::WeakPtrFactory<NativeWidgetAura> close_widget_factory_; |
232 | 230 |
233 DISALLOW_COPY_AND_ASSIGN(NativeWidgetAura); | 231 DISALLOW_COPY_AND_ASSIGN(NativeWidgetAura); |
234 }; | 232 }; |
235 | 233 |
236 } // namespace views | 234 } // namespace views |
237 | 235 |
238 #endif // UI_VIEWS_WIDGET_NATIVE_WIDGET_AURA_H_ | 236 #endif // UI_VIEWS_WIDGET_NATIVE_WIDGET_AURA_H_ |
OLD | NEW |