| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ANDROID_NATIVE_WIDGET_ANDROID_H_ |
| 6 #define UI_VIEWS_WIDGET_NATIVE_WIDGET_AURA_H_ | 6 #define UI_VIEWS_WIDGET_ANDROID_NATIVE_WIDGET_ANDROID_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 9 #include "ui/aura/client/focus_change_observer.h" | 11 #include "ui/aura/client/focus_change_observer.h" |
| 10 #include "ui/aura/window_delegate.h" | 12 #include "ui/aura/window_delegate.h" |
| 11 #include "ui/aura/window_observer.h" | 13 #include "ui/aura/window_observer.h" |
| 12 #include "ui/base/cursor/cursor.h" | 14 #include "ui/base/cursor/cursor.h" |
| 13 #include "ui/events/event_constants.h" | 15 #include "ui/events/event_constants.h" |
| 14 #include "ui/views/views_export.h" | 16 #include "ui/views/views_export.h" |
| 15 #include "ui/views/widget/native_widget_private.h" | 17 #include "ui/views/widget/native_widget_private.h" |
| 16 #include "ui/wm/public/activation_change_observer.h" | 18 #include "ui/wm/public/activation_change_observer.h" |
| 17 #include "ui/wm/public/activation_delegate.h" | 19 #include "ui/wm/public/activation_delegate.h" |
| 18 #include "ui/wm/public/drag_drop_delegate.h" | 20 #include "ui/wm/public/drag_drop_delegate.h" |
| 19 | 21 |
| 20 namespace aura { | 22 namespace aura { |
| 21 class Window; | 23 class Window; |
| 24 class WindowTreeHost; |
| 25 namespace client { |
| 26 class DefaultCaptureClient; |
| 27 class DispatcherClient; |
| 28 class ScreenPositionClient; |
| 29 class WindowTreeClient; |
| 30 } |
| 22 } | 31 } |
| 23 namespace gfx { | 32 namespace gfx { |
| 24 class FontList; | 33 class FontList; |
| 25 } | 34 } |
| 35 namespace wm { |
| 36 class FocusController; |
| 37 } |
| 26 | 38 |
| 27 namespace views { | 39 namespace views { |
| 28 | 40 |
| 29 class DropHelper; | 41 class DropHelper; |
| 30 class TooltipManagerAura; | 42 class TooltipManagerAura; |
| 31 class WindowReorderer; | 43 class WindowReorderer; |
| 32 | 44 |
| 33 class VIEWS_EXPORT NativeWidgetAura | 45 class VIEWS_EXPORT NativeWidgetAndroid |
| 34 : public internal::NativeWidgetPrivate, | 46 : public internal::NativeWidgetPrivate, |
| 35 public aura::WindowDelegate, | 47 public aura::WindowDelegate, |
| 36 public aura::WindowObserver, | 48 public aura::WindowObserver, |
| 37 public aura::client::ActivationDelegate, | 49 public aura::client::ActivationDelegate, |
| 38 public aura::client::ActivationChangeObserver, | 50 public aura::client::ActivationChangeObserver, |
| 39 public aura::client::FocusChangeObserver, | 51 public aura::client::FocusChangeObserver, |
| 40 public aura::client::DragDropDelegate { | 52 public aura::client::DragDropDelegate { |
| 41 public: | 53 public: |
| 42 explicit NativeWidgetAura(internal::NativeWidgetDelegate* delegate); | 54 explicit NativeWidgetAndroid(internal::NativeWidgetDelegate* delegate); |
| 43 | 55 |
| 44 // Called internally by NativeWidgetAura and DesktopNativeWidgetAura to | 56 aura::WindowTreeHost* host() { return host_.get(); } |
| 45 // associate |native_widget| with |window|. | |
| 46 static void RegisterNativeWidgetForWindow( | |
| 47 internal::NativeWidgetPrivate* native_widget, | |
| 48 aura::Window* window); | |
| 49 | 57 |
| 50 // Overridden from internal::NativeWidgetPrivate: | 58 // Overridden from internal::NativeWidgetPrivate: |
| 51 void InitNativeWidget(const Widget::InitParams& params) override; | 59 void InitNativeWidget(const Widget::InitParams& params) override; |
| 52 NonClientFrameView* CreateNonClientFrameView() override; | 60 NonClientFrameView* CreateNonClientFrameView() override; |
| 53 bool ShouldUseNativeFrame() const override; | 61 bool ShouldUseNativeFrame() const override; |
| 54 bool ShouldWindowContentsBeTransparent() const override; | 62 bool ShouldWindowContentsBeTransparent() const override; |
| 55 void FrameTypeChanged() override; | 63 void FrameTypeChanged() override; |
| 56 Widget* GetWidget() override; | 64 Widget* GetWidget() override; |
| 57 const Widget* GetWidget() const override; | 65 const Widget* GetWidget() const override; |
| 58 gfx::NativeView GetNativeView() const override; | 66 gfx::NativeView GetNativeView() const override; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 void OnWindowFocused(aura::Window* gained_focus, | 185 void OnWindowFocused(aura::Window* gained_focus, |
| 178 aura::Window* lost_focus) override; | 186 aura::Window* lost_focus) override; |
| 179 | 187 |
| 180 // Overridden from aura::client::DragDropDelegate: | 188 // Overridden from aura::client::DragDropDelegate: |
| 181 void OnDragEntered(const ui::DropTargetEvent& event) override; | 189 void OnDragEntered(const ui::DropTargetEvent& event) override; |
| 182 int OnDragUpdated(const ui::DropTargetEvent& event) override; | 190 int OnDragUpdated(const ui::DropTargetEvent& event) override; |
| 183 void OnDragExited() override; | 191 void OnDragExited() override; |
| 184 int OnPerformDrop(const ui::DropTargetEvent& event) override; | 192 int OnPerformDrop(const ui::DropTargetEvent& event) override; |
| 185 | 193 |
| 186 protected: | 194 protected: |
| 187 ~NativeWidgetAura() override; | 195 ~NativeWidgetAndroid() override; |
| 188 | 196 |
| 189 internal::NativeWidgetDelegate* delegate() { return delegate_; } | 197 internal::NativeWidgetDelegate* delegate() { return delegate_; } |
| 190 | 198 |
| 191 private: | 199 private: |
| 192 class ActiveWindowObserver; | 200 class ActiveWindowObserver; |
| 193 | 201 |
| 194 bool IsDocked() const; | 202 bool IsDocked() const; |
| 195 void SetInitialFocus(ui::WindowShowState show_state); | 203 void SetInitialFocus(ui::WindowShowState show_state); |
| 196 | 204 |
| 197 internal::NativeWidgetDelegate* delegate_; | 205 internal::NativeWidgetDelegate* delegate_; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 214 | 222 |
| 215 scoped_ptr<TooltipManagerAura> tooltip_manager_; | 223 scoped_ptr<TooltipManagerAura> tooltip_manager_; |
| 216 | 224 |
| 217 // Reorders child windows of |window_| associated with a view based on the | 225 // Reorders child windows of |window_| associated with a view based on the |
| 218 // order of the associated views in the widget's view hierarchy. | 226 // order of the associated views in the widget's view hierarchy. |
| 219 scoped_ptr<WindowReorderer> window_reorderer_; | 227 scoped_ptr<WindowReorderer> window_reorderer_; |
| 220 | 228 |
| 221 scoped_ptr<DropHelper> drop_helper_; | 229 scoped_ptr<DropHelper> drop_helper_; |
| 222 int last_drop_operation_; | 230 int last_drop_operation_; |
| 223 | 231 |
| 224 // The following factory is used for calls to close the NativeWidgetAura | 232 scoped_ptr<aura::WindowTreeHost> host_; |
| 233 scoped_ptr<wm::FocusController> focus_client_; |
| 234 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_; |
| 235 scoped_ptr<aura::client::WindowTreeClient> window_tree_client_; |
| 236 scoped_ptr<aura::client::ScreenPositionClient> screen_position_client_; |
| 237 scoped_ptr<aura::client::DispatcherClient> dispatcher_client_; |
| 238 |
| 239 // The following factory is used for calls to close the NativeWidgetAndroid |
| 225 // instance. | 240 // instance. |
| 226 base::WeakPtrFactory<NativeWidgetAura> close_widget_factory_; | 241 base::WeakPtrFactory<NativeWidgetAndroid> close_widget_factory_; |
| 227 | 242 |
| 228 DISALLOW_COPY_AND_ASSIGN(NativeWidgetAura); | 243 DISALLOW_COPY_AND_ASSIGN(NativeWidgetAndroid); |
| 229 }; | 244 }; |
| 230 | 245 |
| 231 } // namespace views | 246 } // namespace views |
| 232 | 247 |
| 233 #endif // UI_VIEWS_WIDGET_NATIVE_WIDGET_AURA_H_ | 248 #endif // UI_VIEWS_WIDGET_ANDROID_NATIVE_WIDGET_ANDROID_H_ |
| OLD | NEW |