| 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_NATIVE_WIDGET_HELPER_AURA_H_ | 5 #ifndef UI_VIEWS_WIDGET_DESKTOP_NATIVE_WIDGET_HELPER_AURA_H_ |
| 6 #define UI_VIEWS_WIDGET_DESKTOP_NATIVE_WIDGET_HELPER_AURA_H_ | 6 #define UI_VIEWS_WIDGET_DESKTOP_NATIVE_WIDGET_HELPER_AURA_H_ |
| 7 | 7 |
| 8 #include "ui/aura/root_window_observer.h" | 8 #include "ui/aura/root_window_observer.h" |
| 9 #include "ui/aura/window_observer.h" |
| 9 #include "ui/gfx/rect.h" | 10 #include "ui/gfx/rect.h" |
| 10 #include "ui/views/views_export.h" | 11 #include "ui/views/views_export.h" |
| 11 #include "ui/views/widget/native_widget_helper_aura.h" | 12 #include "ui/views/widget/native_widget_helper_aura.h" |
| 12 #include "ui/views/widget/widget.h" | 13 #include "ui/views/widget/widget.h" |
| 13 | 14 |
| 14 namespace aura { | 15 namespace aura { |
| 15 class RootWindow; | 16 class RootWindow; |
| 16 class DesktopCursorClient; | 17 class DesktopCursorClient; |
| 18 class DesktopWindowMoveClient; |
| 17 namespace client { | 19 namespace client { |
| 18 class ScreenPositionClient; | 20 class ScreenPositionClient; |
| 19 } | 21 } |
| 20 namespace shared { | 22 namespace shared { |
| 21 class CompoundEventFilter; | 23 class CompoundEventFilter; |
| 22 class InputMethodEventFilter; | 24 class InputMethodEventFilter; |
| 23 class RootWindowCaptureClient; | 25 class RootWindowCaptureClient; |
| 24 } | 26 } |
| 25 } | 27 } |
| 26 | 28 |
| 27 namespace ui { | 29 namespace ui { |
| 28 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
| 29 class HWNDMessageFilter; | 31 class HWNDMessageFilter; |
| 30 #endif | 32 #endif |
| 31 } | 33 } |
| 32 | 34 |
| 33 namespace views { | 35 namespace views { |
| 34 class NativeWidgetAura; | 36 class NativeWidgetAura; |
| 35 class WidgetMessageFilter; | 37 class WidgetMessageFilter; |
| 36 #if defined(USE_X11) | 38 #if defined(USE_X11) |
| 39 class X11DesktopWindowMoveClient; |
| 37 class X11WindowEventFilter; | 40 class X11WindowEventFilter; |
| 38 #endif | 41 #endif |
| 39 | 42 |
| 40 // Implementation of non-Ash desktop integration code, allowing | 43 // Implementation of non-Ash desktop integration code, allowing |
| 41 // NativeWidgetAuras to work in a traditional desktop environment. | 44 // NativeWidgetAuras to work in a traditional desktop environment. |
| 42 class VIEWS_EXPORT DesktopNativeWidgetHelperAura | 45 class VIEWS_EXPORT DesktopNativeWidgetHelperAura |
| 43 : public NativeWidgetHelperAura, | 46 : public NativeWidgetHelperAura, |
| 47 public aura::WindowObserver, |
| 44 public aura::RootWindowObserver { | 48 public aura::RootWindowObserver { |
| 45 public: | 49 public: |
| 46 explicit DesktopNativeWidgetHelperAura(NativeWidgetAura* widget); | 50 explicit DesktopNativeWidgetHelperAura(NativeWidgetAura* widget); |
| 47 virtual ~DesktopNativeWidgetHelperAura(); | 51 virtual ~DesktopNativeWidgetHelperAura(); |
| 48 | 52 |
| 49 // In general, views/ does not care about the aura::RootWindow, even though | 53 // In general, views/ does not care about the aura::RootWindow, even though |
| 50 // at any join point with the native OS, we're going to be dealing in | 54 // at any join point with the native OS, we're going to be dealing in |
| 51 // RootWindows. | 55 // RootWindows. |
| 52 static aura::Window* GetViewsWindowForRootWindow(aura::RootWindow* root); | 56 static aura::Window* GetViewsWindowForRootWindow(aura::RootWindow* root); |
| 53 | 57 |
| 54 // Overridden from aura::NativeWidgetHelperAura: | 58 // Overridden from aura::NativeWidgetHelperAura: |
| 55 virtual void PreInitialize(aura::Window* window, | 59 virtual void PreInitialize(aura::Window* window, |
| 56 const Widget::InitParams& params) OVERRIDE; | 60 const Widget::InitParams& params) OVERRIDE; |
| 57 virtual void PostInitialize() OVERRIDE; | 61 virtual void PostInitialize() OVERRIDE; |
| 58 virtual void ShowRootWindow() OVERRIDE; | |
| 59 virtual aura::RootWindow* GetRootWindow() OVERRIDE; | 62 virtual aura::RootWindow* GetRootWindow() OVERRIDE; |
| 60 virtual gfx::Rect ModifyAndSetBounds(const gfx::Rect& bounds) OVERRIDE; | 63 virtual gfx::Rect ModifyAndSetBounds(const gfx::Rect& bounds) OVERRIDE; |
| 61 | 64 |
| 62 // Overridden from aura::RootWindowObserver: | 65 // Overridden from aura::RootWindowObserver: |
| 63 virtual void OnRootWindowResized(const aura::RootWindow* root, | 66 virtual void OnRootWindowResized(const aura::RootWindow* root, |
| 64 const gfx::Size& old_size) OVERRIDE; | 67 const gfx::Size& old_size) OVERRIDE; |
| 68 virtual void OnRootWindowMoved(const aura::RootWindow* root, |
| 69 const gfx::Point& new_origin) OVERRIDE; |
| 70 virtual void OnWindowVisibilityChanged(aura::Window* window, |
| 71 bool visible) OVERRIDE; |
| 65 virtual void OnRootWindowHostCloseRequested( | 72 virtual void OnRootWindowHostCloseRequested( |
| 66 const aura::RootWindow* root) OVERRIDE; | 73 const aura::RootWindow* root) OVERRIDE; |
| 67 | 74 |
| 68 private: | 75 private: |
| 69 // A weak pointer back to our owning widget. | 76 // A weak pointer back to our owning widget. |
| 70 NativeWidgetAura* widget_; | 77 NativeWidgetAura* widget_; |
| 71 | 78 |
| 79 // The window from the NativeWidgetAura. We observe events on it, and proxy |
| 80 // visibility stuff to it. |
| 81 aura::Window* window_; |
| 82 |
| 72 // Optionally, a RootWindow that we attach ourselves to. | 83 // Optionally, a RootWindow that we attach ourselves to. |
| 73 scoped_ptr<aura::RootWindow> root_window_; | 84 scoped_ptr<aura::RootWindow> root_window_; |
| 74 | 85 |
| 75 // Toplevel event filter which dispatches to other event filters. | 86 // Toplevel event filter which dispatches to other event filters. |
| 76 aura::shared::CompoundEventFilter* root_window_event_filter_; | 87 aura::shared::CompoundEventFilter* root_window_event_filter_; |
| 77 | 88 |
| 78 // An event filter that pre-handles all key events to send them to an IME. | 89 // An event filter that pre-handles all key events to send them to an IME. |
| 79 scoped_ptr<aura::shared::InputMethodEventFilter> input_method_filter_; | 90 scoped_ptr<aura::shared::InputMethodEventFilter> input_method_filter_; |
| 80 | 91 |
| 81 // TODO(erg): This is temporary. Find out what needs to be done for desktop | 92 // TODO(erg): This is temporary. Find out what needs to be done for desktop |
| 82 // environment. | 93 // environment. |
| 83 scoped_ptr<aura::shared::RootWindowCaptureClient> capture_client_; | 94 scoped_ptr<aura::shared::RootWindowCaptureClient> capture_client_; |
| 84 | 95 |
| 85 // We want some windows (omnibox, status bar) to have their own | 96 // We want some windows (omnibox, status bar) to have their own |
| 86 // NativeWidgetAura, but still act as if they're screen bounded toplevel | 97 // NativeWidgetAura, but still act as if they're screen bounded toplevel |
| 87 // windows. | 98 // windows. |
| 88 bool is_embedded_window_; | 99 bool is_embedded_window_; |
| 89 | 100 |
| 90 // In some cases, we set a screen position client on |root_window_|. If we | 101 // In some cases, we set a screen position client on |root_window_|. If we |
| 91 // do, we're responsible for the lifetime. | 102 // do, we're responsible for the lifetime. |
| 92 scoped_ptr<aura::client::ScreenPositionClient> position_client_; | 103 scoped_ptr<aura::client::ScreenPositionClient> position_client_; |
| 93 | 104 |
| 94 // A simple cursor client which just forwards events to the RootWindow. | 105 // A simple cursor client which just forwards events to the RootWindow. |
| 95 scoped_ptr<aura::DesktopCursorClient> cursor_client_; | 106 scoped_ptr<aura::DesktopCursorClient> cursor_client_; |
| 96 | 107 |
| 108 // Handles spinning up the nested run loop for tab dragging. |
| 109 |
| 97 #if defined(OS_WIN) | 110 #if defined(OS_WIN) |
| 98 scoped_ptr<ui::HWNDMessageFilter> hwnd_message_filter_; | 111 scoped_ptr<ui::HWNDMessageFilter> hwnd_message_filter_; |
| 99 #elif defined(USE_X11) | 112 #elif defined(USE_X11) |
| 100 scoped_ptr<X11WindowEventFilter> x11_window_event_filter_; | 113 scoped_ptr<X11WindowEventFilter> x11_window_event_filter_; |
| 114 scoped_ptr<X11DesktopWindowMoveClient> x11_window_move_client_; |
| 101 #endif | 115 #endif |
| 102 | 116 |
| 103 DISALLOW_COPY_AND_ASSIGN(DesktopNativeWidgetHelperAura); | 117 DISALLOW_COPY_AND_ASSIGN(DesktopNativeWidgetHelperAura); |
| 104 }; | 118 }; |
| 105 | 119 |
| 106 } // namespace views | 120 } // namespace views |
| 107 | 121 |
| 108 #endif // UI_VIEWS_WIDGET_DESKTOP_NATIVE_WIDGET_HELPER_AURA_H_ | 122 #endif // UI_VIEWS_WIDGET_DESKTOP_NATIVE_WIDGET_HELPER_AURA_H_ |
| OLD | NEW |