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