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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "ui/aura/client/activation_delegate.h" | 11 #include "ui/aura/client/activation_delegate.h" |
12 #include "ui/aura/client/drag_drop_delegate.h" | 12 #include "ui/aura/client/drag_drop_delegate.h" |
13 #include "ui/aura/root_window_observer.h" | |
14 #include "ui/aura/window_delegate.h" | 13 #include "ui/aura/window_delegate.h" |
15 #include "ui/base/events.h" | 14 #include "ui/base/events.h" |
16 #include "ui/views/views_export.h" | 15 #include "ui/views/views_export.h" |
17 #include "ui/views/widget/native_widget_private.h" | 16 #include "ui/views/widget/native_widget_private.h" |
18 | 17 |
19 namespace aura { | 18 namespace aura { |
20 class Monitor; | 19 class Monitor; |
21 class RootWindow; | |
22 class Window; | 20 class Window; |
23 } | 21 } |
24 namespace gfx { | 22 namespace gfx { |
25 class Font; | 23 class Font; |
26 } | 24 } |
27 | 25 |
28 namespace views { | 26 namespace views { |
29 | 27 |
30 class DropHelper; | 28 class DropHelper; |
| 29 class NativeWidgetHelperAura; |
31 class TooltipManagerAura; | 30 class TooltipManagerAura; |
32 | 31 |
33 class VIEWS_EXPORT NativeWidgetAura : public internal::NativeWidgetPrivate, | 32 class VIEWS_EXPORT NativeWidgetAura : public internal::NativeWidgetPrivate, |
34 public aura::WindowDelegate, | 33 public aura::WindowDelegate, |
35 public aura::RootWindowObserver, | |
36 public aura::client::ActivationDelegate, | 34 public aura::client::ActivationDelegate, |
37 public aura::client::DragDropDelegate { | 35 public aura::client::DragDropDelegate { |
38 public: | 36 public: |
39 explicit NativeWidgetAura(internal::NativeWidgetDelegate* delegate); | 37 explicit NativeWidgetAura(internal::NativeWidgetDelegate* delegate); |
40 virtual ~NativeWidgetAura(); | 38 virtual ~NativeWidgetAura(); |
41 | 39 |
42 static void set_aura_desktop_hax() { g_aura_desktop_hax = true; } | |
43 | |
44 // TODO(beng): Find a better place for this, and the similar method on | 40 // TODO(beng): Find a better place for this, and the similar method on |
45 // NativeWidgetWin. | 41 // NativeWidgetWin. |
46 static gfx::Font GetWindowTitleFont(); | 42 static gfx::Font GetWindowTitleFont(); |
47 | 43 |
48 // Overridden from internal::NativeWidgetPrivate: | 44 // Overridden from internal::NativeWidgetPrivate: |
49 virtual void InitNativeWidget(const Widget::InitParams& params) OVERRIDE; | 45 virtual void InitNativeWidget(const Widget::InitParams& params) OVERRIDE; |
50 virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE; | 46 virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE; |
51 virtual void UpdateFrameAfterFrameChange() OVERRIDE; | 47 virtual void UpdateFrameAfterFrameChange() OVERRIDE; |
52 virtual bool ShouldUseNativeFrame() const OVERRIDE; | 48 virtual bool ShouldUseNativeFrame() const OVERRIDE; |
53 virtual void FrameTypeChanged() OVERRIDE; | 49 virtual void FrameTypeChanged() OVERRIDE; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 virtual bool OnMouseEvent(aura::MouseEvent* event) OVERRIDE; | 141 virtual bool OnMouseEvent(aura::MouseEvent* event) OVERRIDE; |
146 virtual ui::TouchStatus OnTouchEvent(aura::TouchEvent* event) OVERRIDE; | 142 virtual ui::TouchStatus OnTouchEvent(aura::TouchEvent* event) OVERRIDE; |
147 virtual ui::GestureStatus OnGestureEvent(aura::GestureEvent* event) OVERRIDE; | 143 virtual ui::GestureStatus OnGestureEvent(aura::GestureEvent* event) OVERRIDE; |
148 virtual bool CanFocus() OVERRIDE; | 144 virtual bool CanFocus() OVERRIDE; |
149 virtual void OnCaptureLost() OVERRIDE; | 145 virtual void OnCaptureLost() OVERRIDE; |
150 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 146 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
151 virtual void OnWindowDestroying() OVERRIDE; | 147 virtual void OnWindowDestroying() OVERRIDE; |
152 virtual void OnWindowDestroyed() OVERRIDE; | 148 virtual void OnWindowDestroyed() OVERRIDE; |
153 virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE; | 149 virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE; |
154 | 150 |
155 // Overridden from aura::RootWindowObserver: | |
156 virtual void OnRootWindowResized(const aura::RootWindow* root, | |
157 const gfx::Size& old_size) OVERRIDE; | |
158 virtual void OnRootWindowHostClosed(const aura::RootWindow* root) OVERRIDE; | |
159 | |
160 // Overridden from aura::client::ActivationDelegate: | 151 // Overridden from aura::client::ActivationDelegate: |
161 virtual bool ShouldActivate(const aura::Event* event) OVERRIDE; | 152 virtual bool ShouldActivate(const aura::Event* event) OVERRIDE; |
162 virtual void OnActivated() OVERRIDE; | 153 virtual void OnActivated() OVERRIDE; |
163 virtual void OnLostActive() OVERRIDE; | 154 virtual void OnLostActive() OVERRIDE; |
164 | 155 |
165 // Overridden from aura::client::DragDropDelegate: | 156 // Overridden from aura::client::DragDropDelegate: |
166 virtual void OnDragEntered(const aura::DropTargetEvent& event) OVERRIDE; | 157 virtual void OnDragEntered(const aura::DropTargetEvent& event) OVERRIDE; |
167 virtual int OnDragUpdated(const aura::DropTargetEvent& event) OVERRIDE; | 158 virtual int OnDragUpdated(const aura::DropTargetEvent& event) OVERRIDE; |
168 virtual void OnDragExited() OVERRIDE; | 159 virtual void OnDragExited() OVERRIDE; |
169 virtual int OnPerformDrop(const aura::DropTargetEvent& event) OVERRIDE; | 160 virtual int OnPerformDrop(const aura::DropTargetEvent& event) OVERRIDE; |
(...skipping 14 matching lines...) Expand all Loading... |
184 // the monitor's coordinate system and the widget's coordinate system. | 175 // the monitor's coordinate system and the widget's coordinate system. |
185 gfx::Point ConvertPointFromMonitor(const gfx::Point& point) const; | 176 gfx::Point ConvertPointFromMonitor(const gfx::Point& point) const; |
186 gfx::Size ConvertSizeFromMonitor(const gfx::Size& size) const; | 177 gfx::Size ConvertSizeFromMonitor(const gfx::Size& size) const; |
187 gfx::Rect ConvertRectFromMonitor(const gfx::Rect& rect) const; | 178 gfx::Rect ConvertRectFromMonitor(const gfx::Rect& rect) const; |
188 gfx::Size ConvertSizeToMonitor(const gfx::Size& size) const; | 179 gfx::Size ConvertSizeToMonitor(const gfx::Size& size) const; |
189 gfx::Rect ConvertRectToMonitor(const gfx::Rect& rect) const; | 180 gfx::Rect ConvertRectToMonitor(const gfx::Rect& rect) const; |
190 #endif | 181 #endif |
191 | 182 |
192 internal::NativeWidgetDelegate* delegate_; | 183 internal::NativeWidgetDelegate* delegate_; |
193 | 184 |
194 scoped_ptr<aura::RootWindow> root_window_; | 185 scoped_ptr<NativeWidgetHelperAura> desktop_helper_; |
| 186 |
195 aura::Window* window_; | 187 aura::Window* window_; |
196 | 188 |
197 // See class documentation for Widget in widget.h for a note about ownership. | 189 // See class documentation for Widget in widget.h for a note about ownership. |
198 Widget::InitParams::Ownership ownership_; | 190 Widget::InitParams::Ownership ownership_; |
199 | 191 |
200 // The following factory is used for calls to close the NativeWidgetAura | 192 // The following factory is used for calls to close the NativeWidgetAura |
201 // instance. | 193 // instance. |
202 base::WeakPtrFactory<NativeWidgetAura> close_widget_factory_; | 194 base::WeakPtrFactory<NativeWidgetAura> close_widget_factory_; |
203 | 195 |
204 // Can we be made active? | 196 // Can we be made active? |
205 bool can_activate_; | 197 bool can_activate_; |
206 | 198 |
207 gfx::NativeCursor cursor_; | 199 gfx::NativeCursor cursor_; |
208 | 200 |
209 // The saved window state for exiting full screen state. | 201 // The saved window state for exiting full screen state. |
210 ui::WindowShowState saved_window_state_; | 202 ui::WindowShowState saved_window_state_; |
211 | 203 |
212 scoped_ptr<TooltipManagerAura> tooltip_manager_; | 204 scoped_ptr<TooltipManagerAura> tooltip_manager_; |
213 | 205 |
214 scoped_ptr<ActiveWindowObserver> active_window_observer_; | 206 scoped_ptr<ActiveWindowObserver> active_window_observer_; |
215 | 207 |
216 scoped_ptr<DropHelper> drop_helper_; | 208 scoped_ptr<DropHelper> drop_helper_; |
217 int last_drop_operation_; | 209 int last_drop_operation_; |
218 | 210 |
219 static bool g_aura_desktop_hax; | |
220 | |
221 DISALLOW_COPY_AND_ASSIGN(NativeWidgetAura); | 211 DISALLOW_COPY_AND_ASSIGN(NativeWidgetAura); |
222 }; | 212 }; |
223 | 213 |
224 } // namespace views | 214 } // namespace views |
225 | 215 |
226 #endif // UI_VIEWS_WIDGET_NATIVE_WIDGET_AURA_H_ | 216 #endif // UI_VIEWS_WIDGET_NATIVE_WIDGET_AURA_H_ |
OLD | NEW |