| 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_change_observer.h" | 9 #include "ui/aura/client/activation_change_observer.h" |
| 10 #include "ui/aura/client/activation_delegate.h" | 10 #include "ui/aura/client/activation_delegate.h" |
| 11 #include "ui/aura/client/drag_drop_delegate.h" | 11 #include "ui/aura/client/drag_drop_delegate.h" |
| 12 #include "ui/aura/client/focus_change_observer.h" | 12 #include "ui/aura/client/focus_change_observer.h" |
| 13 #include "ui/aura/root_window_observer.h" | 13 #include "ui/aura/root_window_observer.h" |
| 14 #include "ui/aura/window_delegate.h" | 14 #include "ui/aura/window_delegate.h" |
| 15 #include "ui/base/cursor/cursor.h" | 15 #include "ui/base/cursor/cursor.h" |
| 16 #include "ui/views/ime/input_method_delegate.h" | 16 #include "ui/views/ime/input_method_delegate.h" |
| 17 #include "ui/views/widget/native_widget_private.h" | 17 #include "ui/views/widget/native_widget_private.h" |
| 18 | 18 |
| 19 namespace aura { | 19 namespace aura { |
| 20 class RootWindow; | 20 class RootWindow; |
| 21 namespace client { | 21 namespace client { |
| 22 class DragDropClient; |
| 23 class FocusClient; |
| 24 class ScreenPositionClient; |
| 22 class WindowTreeClient; | 25 class WindowTreeClient; |
| 23 } | 26 } |
| 24 } | 27 } |
| 25 | 28 |
| 26 namespace views { | 29 namespace views { |
| 27 | 30 |
| 28 namespace corewm { | 31 namespace corewm { |
| 29 class CompoundEventFilter; | 32 class CompoundEventFilter; |
| 33 class CursorManager; |
| 30 class InputMethodEventFilter; | 34 class InputMethodEventFilter; |
| 31 class ShadowController; | 35 class ShadowController; |
| 32 class TooltipController; | 36 class TooltipController; |
| 33 class VisibilityController; | 37 class VisibilityController; |
| 34 class WindowModalityController; | 38 class WindowModalityController; |
| 35 } | 39 } |
| 36 | 40 |
| 37 class DesktopCaptureClient; | 41 class DesktopCaptureClient; |
| 42 class DesktopDispatcherClient; |
| 38 class DesktopRootWindowHost; | 43 class DesktopRootWindowHost; |
| 39 class DropHelper; | 44 class DropHelper; |
| 40 class TooltipManagerAura; | 45 class TooltipManagerAura; |
| 41 class WindowReorderer; | 46 class WindowReorderer; |
| 42 | 47 |
| 43 class VIEWS_EXPORT DesktopNativeWidgetAura | 48 class VIEWS_EXPORT DesktopNativeWidgetAura |
| 44 : public internal::NativeWidgetPrivate, | 49 : public internal::NativeWidgetPrivate, |
| 45 public aura::WindowDelegate, | 50 public aura::WindowDelegate, |
| 46 public aura::client::ActivationDelegate, | 51 public aura::client::ActivationDelegate, |
| 47 public aura::client::ActivationChangeObserver, | 52 public aura::client::ActivationChangeObserver, |
| 48 public aura::client::FocusChangeObserver, | 53 public aura::client::FocusChangeObserver, |
| 49 public views::internal::InputMethodDelegate, | 54 public views::internal::InputMethodDelegate, |
| 50 public aura::client::DragDropDelegate, | 55 public aura::client::DragDropDelegate, |
| 51 public aura::RootWindowObserver { | 56 public aura::RootWindowObserver { |
| 52 public: | 57 public: |
| 53 explicit DesktopNativeWidgetAura(internal::NativeWidgetDelegate* delegate); | 58 explicit DesktopNativeWidgetAura(internal::NativeWidgetDelegate* delegate); |
| 54 virtual ~DesktopNativeWidgetAura(); | 59 virtual ~DesktopNativeWidgetAura(); |
| 55 | 60 |
| 56 // Maps from window to DesktopNativeWidgetAura. | 61 // Maps from window to DesktopNativeWidgetAura. |
| 57 static DesktopNativeWidgetAura* ForWindow(aura::Window* window); | 62 static DesktopNativeWidgetAura* ForWindow(aura::Window* window); |
| 58 | 63 |
| 59 // Called by our DesktopRootWindowHost after it has deleted native resources; | 64 // Called by our DesktopRootWindowHost after it has deleted native resources; |
| 60 // this is the signal that we should start our shutdown. | 65 // this is the signal that we should start our shutdown. |
| 61 virtual void OnHostClosed(); | 66 virtual void OnHostClosed(); |
| 62 | 67 |
| 63 // Installs the input method filter on |root|. This is intended to be invoked | 68 // Called from ~DesktopRootWindowHost. This takes the RootWindow as by the |
| 64 // by the DesktopRootWindowHost implementation during Init(). | 69 // time we get here |root_window_| is NULL. |
| 65 void InstallInputMethodEventFilter(aura::RootWindow* root); | 70 virtual void OnDesktopRootWindowHostDestroyed(aura::RootWindow* root); |
| 71 |
| 66 corewm::InputMethodEventFilter* input_method_event_filter() { | 72 corewm::InputMethodEventFilter* input_method_event_filter() { |
| 67 return input_method_event_filter_.get(); | 73 return input_method_event_filter_.get(); |
| 68 } | 74 } |
| 69 corewm::CompoundEventFilter* root_window_event_filter() { | 75 corewm::CompoundEventFilter* root_window_event_filter() { |
| 70 return root_window_event_filter_; | 76 return root_window_event_filter_; |
| 71 } | 77 } |
| 72 | 78 |
| 73 // Invoked from DesktopRootWindowHost creation to create the CaptureClient. | |
| 74 void CreateCaptureClient(aura::RootWindow* root); | |
| 75 | |
| 76 // Overridden from NativeWidget: | 79 // Overridden from NativeWidget: |
| 77 virtual ui::EventHandler* GetEventHandler() OVERRIDE; | 80 virtual ui::EventHandler* GetEventHandler() OVERRIDE; |
| 78 | 81 |
| 79 // Ensures that the correct window is activated/deactivated based on whether | 82 // Ensures that the correct window is activated/deactivated based on whether |
| 80 // we are being activated/deactivated. | 83 // we are being activated/deactivated. |
| 81 void HandleActivationChanged(bool active); | 84 void HandleActivationChanged(bool active); |
| 82 | 85 |
| 83 // Installs the window modality controller event filter on the |root|. This | |
| 84 // should be invoked by the DesktopRootWindowHost implementation immediately | |
| 85 // after creation of the RootWindow. | |
| 86 void InstallWindowModalityController(aura::RootWindow* root); | |
| 87 | |
| 88 protected: | 86 protected: |
| 89 // Overridden from internal::NativeWidgetPrivate: | 87 // Overridden from internal::NativeWidgetPrivate: |
| 90 virtual void InitNativeWidget(const Widget::InitParams& params) OVERRIDE; | 88 virtual void InitNativeWidget(const Widget::InitParams& params) OVERRIDE; |
| 91 virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE; | 89 virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE; |
| 92 virtual bool ShouldUseNativeFrame() const OVERRIDE; | 90 virtual bool ShouldUseNativeFrame() const OVERRIDE; |
| 93 virtual void FrameTypeChanged() OVERRIDE; | 91 virtual void FrameTypeChanged() OVERRIDE; |
| 94 virtual Widget* GetWidget() OVERRIDE; | 92 virtual Widget* GetWidget() OVERRIDE; |
| 95 virtual const Widget* GetWidget() const OVERRIDE; | 93 virtual const Widget* GetWidget() const OVERRIDE; |
| 96 virtual gfx::NativeView GetNativeView() const OVERRIDE; | 94 virtual gfx::NativeView GetNativeView() const OVERRIDE; |
| 97 virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE; | 95 virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; | 216 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; |
| 219 | 217 |
| 220 // Overridden from aura::RootWindowObserver: | 218 // Overridden from aura::RootWindowObserver: |
| 221 virtual void OnRootWindowHostCloseRequested( | 219 virtual void OnRootWindowHostCloseRequested( |
| 222 const aura::RootWindow* root) OVERRIDE; | 220 const aura::RootWindow* root) OVERRIDE; |
| 223 virtual void OnRootWindowHostResized(const aura::RootWindow* root) OVERRIDE; | 221 virtual void OnRootWindowHostResized(const aura::RootWindow* root) OVERRIDE; |
| 224 virtual void OnRootWindowHostMoved(const aura::RootWindow* root, | 222 virtual void OnRootWindowHostMoved(const aura::RootWindow* root, |
| 225 const gfx::Point& new_origin) OVERRIDE; | 223 const gfx::Point& new_origin) OVERRIDE; |
| 226 | 224 |
| 227 private: | 225 private: |
| 226 // Installs the input method filter. |
| 227 void InstallInputMethodEventFilter(); |
| 228 |
| 228 // To save a clear on platforms where the window is never transparent, the | 229 // To save a clear on platforms where the window is never transparent, the |
| 229 // window is only set as transparent when the glass frame is in use. | 230 // window is only set as transparent when the glass frame is in use. |
| 230 void UpdateWindowTransparency(); | 231 void UpdateWindowTransparency(); |
| 231 | 232 |
| 232 // See class documentation for Widget in widget.h for a note about ownership. | 233 // See class documentation for Widget in widget.h for a note about ownership. |
| 233 Widget::InitParams::Ownership ownership_; | 234 Widget::InitParams::Ownership ownership_; |
| 234 | 235 |
| 235 scoped_ptr<DesktopCaptureClient> capture_client_; | 236 scoped_ptr<DesktopCaptureClient> capture_client_; |
| 236 | 237 |
| 237 // The NativeWidget owns the RootWindow. Required because the RootWindow owns | 238 // The NativeWidget owns the RootWindow. Required because the RootWindow owns |
| (...skipping 13 matching lines...) Expand all Loading... |
| 251 // Child of the root, contains |content_window_|. | 252 // Child of the root, contains |content_window_|. |
| 252 aura::Window* content_window_container_; | 253 aura::Window* content_window_container_; |
| 253 | 254 |
| 254 // Child of |content_window_container_|. This is the return value from | 255 // Child of |content_window_container_|. This is the return value from |
| 255 // GetNativeView(). | 256 // GetNativeView(). |
| 256 // WARNING: this may be NULL, in particular during shutdown it becomes NULL. | 257 // WARNING: this may be NULL, in particular during shutdown it becomes NULL. |
| 257 aura::Window* content_window_; | 258 aura::Window* content_window_; |
| 258 | 259 |
| 259 internal::NativeWidgetDelegate* native_widget_delegate_; | 260 internal::NativeWidgetDelegate* native_widget_delegate_; |
| 260 | 261 |
| 262 scoped_ptr<aura::client::FocusClient> focus_client_; |
| 263 scoped_ptr<DesktopDispatcherClient> dispatcher_client_; |
| 264 scoped_ptr<views::corewm::CursorManager> cursor_client_; |
| 265 scoped_ptr<aura::client::ScreenPositionClient> position_client_; |
| 266 scoped_ptr<aura::client::DragDropClient> drag_drop_client_; |
| 261 scoped_ptr<aura::client::WindowTreeClient> window_tree_client_; | 267 scoped_ptr<aura::client::WindowTreeClient> window_tree_client_; |
| 262 | 268 |
| 263 // Toplevel event filter which dispatches to other event filters. | 269 // Toplevel event filter which dispatches to other event filters. |
| 264 corewm::CompoundEventFilter* root_window_event_filter_; | 270 corewm::CompoundEventFilter* root_window_event_filter_; |
| 265 | 271 |
| 266 scoped_ptr<corewm::InputMethodEventFilter> input_method_event_filter_; | 272 scoped_ptr<corewm::InputMethodEventFilter> input_method_event_filter_; |
| 267 | 273 |
| 268 scoped_ptr<DropHelper> drop_helper_; | 274 scoped_ptr<DropHelper> drop_helper_; |
| 269 int last_drop_operation_; | 275 int last_drop_operation_; |
| 270 | 276 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 289 | 295 |
| 290 // See class documentation for Widget in widget.h for a note about type. | 296 // See class documentation for Widget in widget.h for a note about type. |
| 291 Widget::InitParams::Type widget_type_; | 297 Widget::InitParams::Type widget_type_; |
| 292 | 298 |
| 293 DISALLOW_COPY_AND_ASSIGN(DesktopNativeWidgetAura); | 299 DISALLOW_COPY_AND_ASSIGN(DesktopNativeWidgetAura); |
| 294 }; | 300 }; |
| 295 | 301 |
| 296 } // namespace views | 302 } // namespace views |
| 297 | 303 |
| 298 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_NATIVE_WIDGET_AURA_H_ | 304 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_NATIVE_WIDGET_AURA_H_ |
| OLD | NEW |