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/ime/input_method_delegate.h" | 12 #include "ui/views/ime/input_method_delegate.h" |
12 #include "ui/views/widget/native_widget_private.h" | 13 #include "ui/views/widget/native_widget_private.h" |
13 | 14 |
14 namespace aura { | 15 namespace aura { |
15 class RootWindow; | 16 class RootWindow; |
16 namespace client { | 17 namespace client { |
17 class StackingClient; | 18 class StackingClient; |
18 } | 19 } |
19 } | 20 } |
20 | 21 |
21 namespace views { | 22 namespace views { |
22 | 23 |
23 namespace corewm { | 24 namespace corewm { |
24 class CompoundEventFilter; | 25 class CompoundEventFilter; |
25 class InputMethodEventFilter; | 26 class InputMethodEventFilter; |
26 } | 27 } |
27 | 28 |
28 class DesktopRootWindowHost; | 29 class DesktopRootWindowHost; |
| 30 class DropHelper; |
29 class NativeWidgetAuraWindowObserver; | 31 class NativeWidgetAuraWindowObserver; |
30 | 32 |
31 // TODO(erg): May also need to be a DragDropDelegate | 33 // TODO(erg): May also need to be a DragDropDelegate |
32 class VIEWS_EXPORT DesktopNativeWidgetAura | 34 class VIEWS_EXPORT DesktopNativeWidgetAura |
33 : public internal::NativeWidgetPrivate, | 35 : public internal::NativeWidgetPrivate, |
34 public aura::WindowDelegate, | 36 public aura::WindowDelegate, |
35 public aura::client::ActivationDelegate, | 37 public aura::client::ActivationDelegate, |
36 public views::internal::InputMethodDelegate { | 38 public views::internal::InputMethodDelegate, |
| 39 public aura::client::DragDropDelegate { |
37 public: | 40 public: |
38 explicit DesktopNativeWidgetAura(internal::NativeWidgetDelegate* delegate); | 41 explicit DesktopNativeWidgetAura(internal::NativeWidgetDelegate* delegate); |
39 virtual ~DesktopNativeWidgetAura(); | 42 virtual ~DesktopNativeWidgetAura(); |
40 | 43 |
41 // Maps from window to DesktopNativeWidgetAura. | 44 // Maps from window to DesktopNativeWidgetAura. |
42 static DesktopNativeWidgetAura* ForWindow(aura::Window* window); | 45 static DesktopNativeWidgetAura* ForWindow(aura::Window* window); |
43 | 46 |
44 // Called by our DesktopRootWindowHost after it has deleted native resources; | 47 // Called by our DesktopRootWindowHost after it has deleted native resources; |
45 // this is the signal that we should start our shutdown. | 48 // this is the signal that we should start our shutdown. |
46 void OnHostClosed(); | 49 void OnHostClosed(); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 176 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
174 | 177 |
175 // Overridden from aura::client::ActivationDelegate: | 178 // Overridden from aura::client::ActivationDelegate: |
176 virtual bool ShouldActivate() const OVERRIDE; | 179 virtual bool ShouldActivate() const OVERRIDE; |
177 virtual void OnActivated() OVERRIDE; | 180 virtual void OnActivated() OVERRIDE; |
178 virtual void OnLostActive() OVERRIDE; | 181 virtual void OnLostActive() OVERRIDE; |
179 | 182 |
180 // Overridden from views::internal::InputMethodDelegate: | 183 // Overridden from views::internal::InputMethodDelegate: |
181 virtual void DispatchKeyEventPostIME(const ui::KeyEvent& key) OVERRIDE; | 184 virtual void DispatchKeyEventPostIME(const ui::KeyEvent& key) OVERRIDE; |
182 | 185 |
| 186 // Overridden from aura::client::DragDropDelegate: |
| 187 virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE; |
| 188 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; |
| 189 virtual void OnDragExited() OVERRIDE; |
| 190 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; |
| 191 |
183 private: | 192 private: |
184 // See class documentation for Widget in widget.h for a note about ownership. | 193 // See class documentation for Widget in widget.h for a note about ownership. |
185 Widget::InitParams::Ownership ownership_; | 194 Widget::InitParams::Ownership ownership_; |
186 | 195 |
187 // The NativeWidget owns the RootWindow. Required because the RootWindow owns | 196 // The NativeWidget owns the RootWindow. Required because the RootWindow owns |
188 // its RootWindowHost, so DesktopRootWindowHost can't own it. | 197 // its RootWindowHost, so DesktopRootWindowHost can't own it. |
189 scoped_ptr<aura::RootWindow> root_window_; | 198 scoped_ptr<aura::RootWindow> root_window_; |
190 | 199 |
191 // The following factory is used for calls to close the NativeWidgetAura | 200 // The following factory is used for calls to close the NativeWidgetAura |
192 // instance. | 201 // instance. |
193 base::WeakPtrFactory<DesktopNativeWidgetAura> close_widget_factory_; | 202 base::WeakPtrFactory<DesktopNativeWidgetAura> close_widget_factory_; |
194 | 203 |
195 scoped_ptr<NativeWidgetAuraWindowObserver> active_window_observer_; | 204 scoped_ptr<NativeWidgetAuraWindowObserver> active_window_observer_; |
196 | 205 |
197 // Can we be made active? | 206 // Can we be made active? |
198 bool can_activate_; | 207 bool can_activate_; |
199 | 208 |
200 // Ownership passed to RootWindow on Init. | 209 // Ownership passed to RootWindow on Init. |
201 DesktopRootWindowHost* desktop_root_window_host_; | 210 DesktopRootWindowHost* desktop_root_window_host_; |
202 aura::Window* window_; | 211 aura::Window* window_; |
203 internal::NativeWidgetDelegate* native_widget_delegate_; | 212 internal::NativeWidgetDelegate* native_widget_delegate_; |
204 | 213 |
205 scoped_ptr<aura::client::StackingClient> stacking_client_; | 214 scoped_ptr<aura::client::StackingClient> stacking_client_; |
206 | 215 |
207 // Toplevel event filter which dispatches to other event filters. | 216 // Toplevel event filter which dispatches to other event filters. |
208 corewm::CompoundEventFilter* root_window_event_filter_; | 217 corewm::CompoundEventFilter* root_window_event_filter_; |
209 | 218 |
210 scoped_ptr<corewm::InputMethodEventFilter> input_method_event_filter_; | 219 scoped_ptr<corewm::InputMethodEventFilter> input_method_event_filter_; |
211 | 220 |
| 221 scoped_ptr<DropHelper> drop_helper_; |
| 222 int last_drop_operation_; |
| 223 |
212 DISALLOW_COPY_AND_ASSIGN(DesktopNativeWidgetAura); | 224 DISALLOW_COPY_AND_ASSIGN(DesktopNativeWidgetAura); |
213 }; | 225 }; |
214 | 226 |
215 } // namespace views | 227 } // namespace views |
216 | 228 |
217 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_NATIVE_WIDGET_AURA_H_ | 229 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_NATIVE_WIDGET_AURA_H_ |
OLD | NEW |