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