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 |
| 65 // Overridden from aura::WindowObserver: |
| 66 virtual void OnWindowVisibilityChanged(aura::Window* window, |
| 67 bool visible) OVERRIDE; |
| 68 |
62 // Overridden from aura::RootWindowObserver: | 69 // Overridden from aura::RootWindowObserver: |
63 virtual void OnRootWindowResized(const aura::RootWindow* root, | 70 virtual void OnRootWindowResized(const aura::RootWindow* root, |
64 const gfx::Size& old_size) OVERRIDE; | 71 const gfx::Size& old_size) OVERRIDE; |
| 72 virtual void OnRootWindowMoved(const aura::RootWindow* root, |
| 73 const gfx::Point& new_origin) OVERRIDE; |
65 virtual void OnRootWindowHostClosed(const aura::RootWindow* root) OVERRIDE; | 74 virtual void OnRootWindowHostClosed(const aura::RootWindow* root) OVERRIDE; |
66 | 75 |
67 private: | 76 private: |
68 // A weak pointer back to our owning widget. | 77 // A weak pointer back to our owning widget. |
69 NativeWidgetAura* widget_; | 78 NativeWidgetAura* widget_; |
70 | 79 |
| 80 // The window from the NativeWidgetAura. We observe events on it, and proxy |
| 81 // visibility stuff to |
| 82 aura::Window* window_; |
| 83 |
71 // Optionally, a RootWindow that we attach ourselves to. | 84 // Optionally, a RootWindow that we attach ourselves to. |
72 scoped_ptr<aura::RootWindow> root_window_; | 85 scoped_ptr<aura::RootWindow> root_window_; |
73 | 86 |
74 // Toplevel event filter which dispatches to other event filters. | 87 // Toplevel event filter which dispatches to other event filters. |
75 aura::shared::CompoundEventFilter* root_window_event_filter_; | 88 aura::shared::CompoundEventFilter* root_window_event_filter_; |
76 | 89 |
77 // An event filter that pre-handles all key events to send them to an IME. | 90 // An event filter that pre-handles all key events to send them to an IME. |
78 scoped_ptr<aura::shared::InputMethodEventFilter> input_method_filter_; | 91 scoped_ptr<aura::shared::InputMethodEventFilter> input_method_filter_; |
79 | 92 |
80 // TODO(erg): This is temporary. Find out what needs to be done for desktop | 93 // TODO(erg): This is temporary. Find out what needs to be done for desktop |
81 // environment. | 94 // environment. |
82 scoped_ptr<aura::shared::RootWindowCaptureClient> capture_client_; | 95 scoped_ptr<aura::shared::RootWindowCaptureClient> capture_client_; |
83 | 96 |
84 // We want some windows (omnibox, status bar) to have their own | 97 // We want some windows (omnibox, status bar) to have their own |
85 // NativeWidgetAura, but still act as if they're screen bounded toplevel | 98 // NativeWidgetAura, but still act as if they're screen bounded toplevel |
86 // windows. | 99 // windows. |
87 bool is_embedded_window_; | 100 bool is_embedded_window_; |
88 | 101 |
89 // In some cases, we set a screen position client on |root_window_|. If we | 102 // In some cases, we set a screen position client on |root_window_|. If we |
90 // do, we're responsible for the lifetime. | 103 // do, we're responsible for the lifetime. |
91 scoped_ptr<aura::client::ScreenPositionClient> position_client_; | 104 scoped_ptr<aura::client::ScreenPositionClient> position_client_; |
92 | 105 |
93 // A simple cursor client which just forwards events to the RootWindow. | 106 // A simple cursor client which just forwards events to the RootWindow. |
94 scoped_ptr<aura::DesktopCursorClient> cursor_client_; | 107 scoped_ptr<aura::DesktopCursorClient> cursor_client_; |
95 | 108 |
| 109 // Handles spinning up the nested run loop for tab dragging. |
| 110 |
96 #if defined(OS_WIN) | 111 #if defined(OS_WIN) |
97 scoped_ptr<ui::HWNDMessageFilter> hwnd_message_filter_; | 112 scoped_ptr<ui::HWNDMessageFilter> hwnd_message_filter_; |
98 #elif defined(USE_X11) | 113 #elif defined(USE_X11) |
99 scoped_ptr<X11WindowEventFilter> x11_window_event_filter_; | 114 scoped_ptr<X11WindowEventFilter> x11_window_event_filter_; |
| 115 scoped_ptr<X11DesktopWindowMoveClient> x11_window_move_client_; |
100 #endif | 116 #endif |
101 | 117 |
102 DISALLOW_COPY_AND_ASSIGN(DesktopNativeWidgetHelperAura); | 118 DISALLOW_COPY_AND_ASSIGN(DesktopNativeWidgetHelperAura); |
103 }; | 119 }; |
104 | 120 |
105 } // namespace views | 121 } // namespace views |
106 | 122 |
107 #endif // UI_VIEWS_WIDGET_DESKTOP_NATIVE_WIDGET_HELPER_AURA_H_ | 123 #endif // UI_VIEWS_WIDGET_DESKTOP_NATIVE_WIDGET_HELPER_AURA_H_ |
OLD | NEW |