| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" | |
| 12 #include "ui/aura/client/window_drag_drop_delegate.h" | 11 #include "ui/aura/client/window_drag_drop_delegate.h" |
| 13 #include "ui/aura/window_delegate.h" | 12 #include "ui/aura/window_delegate.h" |
| 14 #include "ui/base/events.h" | 13 #include "ui/base/events.h" |
| 15 #include "ui/views/views_export.h" | 14 #include "ui/views/views_export.h" |
| 16 #include "ui/views/widget/native_widget_private.h" | 15 #include "ui/views/widget/native_widget_private.h" |
| 17 | 16 |
| 18 namespace aura { | 17 namespace aura { |
| 19 class Window; | 18 class Window; |
| 20 } | 19 } |
| 21 namespace gfx { | 20 namespace gfx { |
| 22 class Font; | 21 class Font; |
| 23 } | 22 } |
| 24 | 23 |
| 25 namespace views { | 24 namespace views { |
| 26 | 25 |
| 27 class DropHelper; | 26 class DropHelper; |
| 28 class TooltipManagerAura; | 27 class TooltipManagerAura; |
| 29 | 28 |
| 30 class VIEWS_EXPORT NativeWidgetAura : public internal::NativeWidgetPrivate, | 29 class VIEWS_EXPORT NativeWidgetAura : public internal::NativeWidgetPrivate, |
| 31 public aura::WindowDelegate, | 30 public aura::WindowDelegate, |
| 32 public aura::ActivationDelegate, | |
| 33 public aura::WindowDragDropDelegate { | 31 public aura::WindowDragDropDelegate { |
| 34 public: | 32 public: |
| 35 explicit NativeWidgetAura(internal::NativeWidgetDelegate* delegate); | 33 explicit NativeWidgetAura(internal::NativeWidgetDelegate* delegate); |
| 36 virtual ~NativeWidgetAura(); | 34 virtual ~NativeWidgetAura(); |
| 37 | 35 |
| 38 // TODO(beng): Find a better place for this, and the similar method on | 36 // TODO(beng): Find a better place for this, and the similar method on |
| 39 // NativeWidgetWin. | 37 // NativeWidgetWin. |
| 40 static gfx::Font GetWindowTitleFont(); | 38 static gfx::Font GetWindowTitleFont(); |
| 41 | 39 |
| 42 // Overridden from internal::NativeWidgetPrivate: | 40 // Overridden from internal::NativeWidgetPrivate: |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, | 125 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, |
| 128 const gfx::Rect& new_bounds) OVERRIDE; | 126 const gfx::Rect& new_bounds) OVERRIDE; |
| 129 virtual void OnFocus() OVERRIDE; | 127 virtual void OnFocus() OVERRIDE; |
| 130 virtual void OnBlur() OVERRIDE; | 128 virtual void OnBlur() OVERRIDE; |
| 131 virtual bool OnKeyEvent(aura::KeyEvent* event) OVERRIDE; | 129 virtual bool OnKeyEvent(aura::KeyEvent* event) OVERRIDE; |
| 132 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE; | 130 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE; |
| 133 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; | 131 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; |
| 134 virtual bool OnMouseEvent(aura::MouseEvent* event) OVERRIDE; | 132 virtual bool OnMouseEvent(aura::MouseEvent* event) OVERRIDE; |
| 135 virtual ui::TouchStatus OnTouchEvent(aura::TouchEvent* event) OVERRIDE; | 133 virtual ui::TouchStatus OnTouchEvent(aura::TouchEvent* event) OVERRIDE; |
| 136 virtual bool CanFocus() OVERRIDE; | 134 virtual bool CanFocus() OVERRIDE; |
| 135 virtual bool ShouldActivate(aura::Event* event) OVERRIDE; |
| 136 virtual void OnActivated() OVERRIDE; |
| 137 virtual void OnLostActive() OVERRIDE; |
| 137 virtual void OnCaptureLost() OVERRIDE; | 138 virtual void OnCaptureLost() OVERRIDE; |
| 138 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 139 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 139 virtual void OnWindowDestroying() OVERRIDE; | 140 virtual void OnWindowDestroying() OVERRIDE; |
| 140 virtual void OnWindowDestroyed() OVERRIDE; | 141 virtual void OnWindowDestroyed() OVERRIDE; |
| 141 virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE; | 142 virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE; |
| 142 | 143 |
| 143 // Overridden from aura::ActivationDelegate: | |
| 144 virtual bool ShouldActivate(aura::Event* event) OVERRIDE; | |
| 145 virtual void OnActivated() OVERRIDE; | |
| 146 virtual void OnLostActive() OVERRIDE; | |
| 147 | |
| 148 // Overridden from aura::WindowDragDropDelegate: | 144 // Overridden from aura::WindowDragDropDelegate: |
| 149 virtual void OnDragEntered(const aura::DropTargetEvent& event) OVERRIDE; | 145 virtual void OnDragEntered(const aura::DropTargetEvent& event) OVERRIDE; |
| 150 virtual int OnDragUpdated(const aura::DropTargetEvent& event) OVERRIDE; | 146 virtual int OnDragUpdated(const aura::DropTargetEvent& event) OVERRIDE; |
| 151 virtual void OnDragExited() OVERRIDE; | 147 virtual void OnDragExited() OVERRIDE; |
| 152 virtual int OnPerformDrop(const aura::DropTargetEvent& event) OVERRIDE; | 148 virtual int OnPerformDrop(const aura::DropTargetEvent& event) OVERRIDE; |
| 153 | 149 |
| 154 protected: | 150 protected: |
| 155 internal::NativeWidgetDelegate* delegate() { return delegate_; } | 151 internal::NativeWidgetDelegate* delegate() { return delegate_; } |
| 156 | 152 |
| 157 private: | 153 private: |
| 158 class ActiveWindowObserver; | 154 class RootWindowObserverImpl; |
| 159 | 155 |
| 160 internal::NativeWidgetDelegate* delegate_; | 156 internal::NativeWidgetDelegate* delegate_; |
| 161 | 157 |
| 162 aura::Window* window_; | 158 aura::Window* window_; |
| 163 | 159 |
| 164 // See class documentation for Widget in widget.h for a note about ownership. | 160 // See class documentation for Widget in widget.h for a note about ownership. |
| 165 Widget::InitParams::Ownership ownership_; | 161 Widget::InitParams::Ownership ownership_; |
| 166 | 162 |
| 167 // The following factory is used for calls to close the NativeWidgetAura | 163 // The following factory is used for calls to close the NativeWidgetAura |
| 168 // instance. | 164 // instance. |
| 169 base::WeakPtrFactory<NativeWidgetAura> close_widget_factory_; | 165 base::WeakPtrFactory<NativeWidgetAura> close_widget_factory_; |
| 170 | 166 |
| 171 // Can we be made active? | 167 // Can we be made active? |
| 172 bool can_activate_; | 168 bool can_activate_; |
| 173 | 169 |
| 174 gfx::NativeCursor cursor_; | 170 gfx::NativeCursor cursor_; |
| 175 | 171 |
| 176 scoped_ptr<TooltipManagerAura> tooltip_manager_; | 172 scoped_ptr<TooltipManagerAura> tooltip_manager_; |
| 177 | 173 |
| 178 scoped_ptr<ActiveWindowObserver> active_window_observer_; | 174 scoped_ptr<RootWindowObserverImpl> root_window_observer_; |
| 179 | 175 |
| 180 scoped_ptr<DropHelper> drop_helper_; | 176 scoped_ptr<DropHelper> drop_helper_; |
| 181 | 177 |
| 182 DISALLOW_COPY_AND_ASSIGN(NativeWidgetAura); | 178 DISALLOW_COPY_AND_ASSIGN(NativeWidgetAura); |
| 183 }; | 179 }; |
| 184 | 180 |
| 185 } // namespace views | 181 } // namespace views |
| 186 | 182 |
| 187 #endif // UI_VIEWS_WIDGET_NATIVE_WIDGET_AURA_H_ | 183 #endif // UI_VIEWS_WIDGET_NATIVE_WIDGET_AURA_H_ |
| OLD | NEW |