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_DESKTOP_AURA_DESKTOP_NATIVE_WIDGET_AURA_H_ | 5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_NATIVE_WIDGET_AURA_H_ |
6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_NATIVE_WIDGET_AURA_H_ | 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_NATIVE_WIDGET_AURA_H_ |
7 | 7 |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "ui/aura/client/activation_delegate.h" | 9 #include "ui/aura/client/activation_delegate.h" |
| 10 #include "ui/aura/client/drag_drop_delegate.h" |
10 #include "ui/aura/window_delegate.h" | 11 #include "ui/aura/window_delegate.h" |
11 #include "ui/views/widget/native_widget_private.h" | 12 #include "ui/views/widget/native_widget_private.h" |
12 | 13 |
13 namespace aura { | 14 namespace aura { |
14 class RootWindow; | 15 class RootWindow; |
15 namespace client { | 16 namespace client { |
16 class StackingClient; | 17 class StackingClient; |
17 } | 18 } |
18 } | 19 } |
19 | 20 |
20 namespace views { | 21 namespace views { |
21 | 22 |
22 class DesktopRootWindowHost; | 23 class DesktopRootWindowHost; |
| 24 class DropHelper; |
23 class NativeWidgetAuraWindowObserver; | 25 class NativeWidgetAuraWindowObserver; |
24 | 26 |
25 // TODO(erg): May also need to be a DragDropDelegate | 27 // TODO(erg): May also need to be a DragDropDelegate |
26 class VIEWS_EXPORT DesktopNativeWidgetAura | 28 class VIEWS_EXPORT DesktopNativeWidgetAura |
27 : public internal::NativeWidgetPrivate, | 29 : public internal::NativeWidgetPrivate, |
28 public aura::WindowDelegate, | 30 public aura::WindowDelegate, |
29 public aura::client::ActivationDelegate { | 31 public aura::client::ActivationDelegate, |
| 32 public aura::client::DragDropDelegate { |
30 public: | 33 public: |
31 explicit DesktopNativeWidgetAura(internal::NativeWidgetDelegate* delegate); | 34 explicit DesktopNativeWidgetAura(internal::NativeWidgetDelegate* delegate); |
32 virtual ~DesktopNativeWidgetAura(); | 35 virtual ~DesktopNativeWidgetAura(); |
33 | 36 |
34 // Maps from window to DesktopNativeWidgetAura. | 37 // Maps from window to DesktopNativeWidgetAura. |
35 static DesktopNativeWidgetAura* ForWindow(aura::Window* window); | 38 static DesktopNativeWidgetAura* ForWindow(aura::Window* window); |
36 | 39 |
37 // Called by our DesktopRootWindowHost after it has deleted native resources; | 40 // Called by our DesktopRootWindowHost after it has deleted native resources; |
38 // this is the signal that we should start our shutdown. | 41 // this is the signal that we should start our shutdown. |
39 void OnHostClosed(); | 42 void OnHostClosed(); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE; | 156 virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE; |
154 virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; | 157 virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; |
155 virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE; | 158 virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE; |
156 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 159 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
157 | 160 |
158 // Overridden from aura::client::ActivationDelegate: | 161 // Overridden from aura::client::ActivationDelegate: |
159 virtual bool ShouldActivate() const OVERRIDE; | 162 virtual bool ShouldActivate() const OVERRIDE; |
160 virtual void OnActivated() OVERRIDE; | 163 virtual void OnActivated() OVERRIDE; |
161 virtual void OnLostActive() OVERRIDE; | 164 virtual void OnLostActive() OVERRIDE; |
162 | 165 |
| 166 // Overridden from aura::client::DragDropDelegate: |
| 167 virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE; |
| 168 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; |
| 169 virtual void OnDragExited() OVERRIDE; |
| 170 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; |
| 171 |
163 private: | 172 private: |
164 // See class documentation for Widget in widget.h for a note about ownership. | 173 // See class documentation for Widget in widget.h for a note about ownership. |
165 Widget::InitParams::Ownership ownership_; | 174 Widget::InitParams::Ownership ownership_; |
166 | 175 |
167 // The NativeWidget owns the RootWindow. Required because the RootWindow owns | 176 // The NativeWidget owns the RootWindow. Required because the RootWindow owns |
168 // its RootWindowHost, so DesktopRootWindowHost can't own it. | 177 // its RootWindowHost, so DesktopRootWindowHost can't own it. |
169 scoped_ptr<aura::RootWindow> root_window_; | 178 scoped_ptr<aura::RootWindow> root_window_; |
170 | 179 |
171 // The following factory is used for calls to close the NativeWidgetAura | 180 // The following factory is used for calls to close the NativeWidgetAura |
172 // instance. | 181 // instance. |
173 base::WeakPtrFactory<DesktopNativeWidgetAura> close_widget_factory_; | 182 base::WeakPtrFactory<DesktopNativeWidgetAura> close_widget_factory_; |
174 | 183 |
175 scoped_ptr<NativeWidgetAuraWindowObserver> active_window_observer_; | 184 scoped_ptr<NativeWidgetAuraWindowObserver> active_window_observer_; |
176 | 185 |
177 // Can we be made active? | 186 // Can we be made active? |
178 bool can_activate_; | 187 bool can_activate_; |
179 | 188 |
180 // Ownership passed to RootWindow on Init. | 189 // Ownership passed to RootWindow on Init. |
181 DesktopRootWindowHost* desktop_root_window_host_; | 190 DesktopRootWindowHost* desktop_root_window_host_; |
182 aura::Window* window_; | 191 aura::Window* window_; |
183 internal::NativeWidgetDelegate* native_widget_delegate_; | 192 internal::NativeWidgetDelegate* native_widget_delegate_; |
184 | 193 |
185 scoped_ptr<aura::client::StackingClient> stacking_client_; | 194 scoped_ptr<aura::client::StackingClient> stacking_client_; |
186 | 195 |
| 196 scoped_ptr<DropHelper> drop_helper_; |
| 197 int last_drop_operation_; |
| 198 |
187 DISALLOW_COPY_AND_ASSIGN(DesktopNativeWidgetAura); | 199 DISALLOW_COPY_AND_ASSIGN(DesktopNativeWidgetAura); |
188 }; | 200 }; |
189 | 201 |
190 } // namespace views | 202 } // namespace views |
191 | 203 |
192 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_NATIVE_WIDGET_AURA_H_ | 204 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_NATIVE_WIDGET_AURA_H_ |
OLD | NEW |