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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ui/aura/root_window_observer.h" | 9 #include "ui/aura/root_window_observer.h" |
10 #include "ui/gfx/rect.h" | 10 #include "ui/gfx/rect.h" |
11 #include "ui/views/views_export.h" | 11 #include "ui/views/views_export.h" |
12 #include "ui/views/widget/native_widget_helper_aura.h" | 12 #include "ui/views/widget/native_widget_helper_aura.h" |
13 #include "ui/views/widget/widget.h" | 13 #include "ui/views/widget/widget.h" |
14 | 14 |
15 namespace aura { | 15 namespace aura { |
16 class RootWindow; | 16 class RootWindow; |
| 17 namespace client { |
| 18 class ScreenPositionClient; |
| 19 } |
17 namespace shared { | 20 namespace shared { |
18 class InputMethodEventFilter; | 21 class InputMethodEventFilter; |
19 class RootWindowEventFilter; | 22 class RootWindowEventFilter; |
20 } | 23 } |
21 } | 24 } |
22 | 25 |
23 namespace ui { | 26 namespace ui { |
24 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
25 class HWNDSubclass; | 28 class HWNDSubclass; |
26 #endif | 29 #endif |
27 } | 30 } |
28 | 31 |
29 namespace views { | 32 namespace views { |
30 class NativeWidgetAura; | 33 class NativeWidgetAura; |
31 class WidgetMessageFilter; | 34 class WidgetMessageFilter; |
32 #if defined(USE_X11) | 35 #if defined(USE_X11) |
33 class X11WindowEventFilter; | 36 class X11WindowEventFilter; |
34 #endif | 37 #endif |
35 | 38 |
36 // Implementation of non-Ash desktop integration code, allowing | 39 // Implementation of non-Ash desktop integration code, allowing |
37 // NativeWidgetAuras to work in a traditional desktop environment. | 40 // NativeWidgetAuras to work in a traditional desktop environment. |
38 class VIEWS_EXPORT DesktopNativeWidgetHelperAura | 41 class VIEWS_EXPORT DesktopNativeWidgetHelperAura |
39 : public NativeWidgetHelperAura, | 42 : public NativeWidgetHelperAura, |
40 public aura::RootWindowObserver { | 43 public aura::RootWindowObserver { |
41 public: | 44 public: |
42 explicit DesktopNativeWidgetHelperAura(NativeWidgetAura* widget); | 45 explicit DesktopNativeWidgetHelperAura(NativeWidgetAura* widget); |
43 virtual ~DesktopNativeWidgetHelperAura(); | 46 virtual ~DesktopNativeWidgetHelperAura(); |
44 | 47 |
45 // Overridden from aura::NativeWidgetHelperAura: | 48 // Overridden from aura::NativeWidgetHelperAura: |
46 virtual void PreInitialize(const Widget::InitParams& params) OVERRIDE; | 49 virtual void PreInitialize(aura::Window* window, |
| 50 const Widget::InitParams& params) OVERRIDE; |
47 virtual void PostInitialize() OVERRIDE; | 51 virtual void PostInitialize() OVERRIDE; |
48 virtual void ShowRootWindow() OVERRIDE; | 52 virtual void ShowRootWindow() OVERRIDE; |
49 virtual aura::RootWindow* GetRootWindow() OVERRIDE; | 53 virtual aura::RootWindow* GetRootWindow() OVERRIDE; |
50 virtual gfx::Rect ModifyAndSetBounds(const gfx::Rect& bounds) OVERRIDE; | 54 virtual gfx::Rect ModifyAndSetBounds(const gfx::Rect& bounds) OVERRIDE; |
51 virtual gfx::Rect ChangeRootWindowBoundsToScreenBounds( | |
52 const gfx::Rect& bounds) OVERRIDE; | |
53 | 55 |
54 // Overridden from aura::RootWindowObserver: | 56 // Overridden from aura::RootWindowObserver: |
55 virtual void OnRootWindowResized(const aura::RootWindow* root, | 57 virtual void OnRootWindowResized(const aura::RootWindow* root, |
56 const gfx::Size& old_size) OVERRIDE; | 58 const gfx::Size& old_size) OVERRIDE; |
57 virtual void OnRootWindowHostClosed(const aura::RootWindow* root) OVERRIDE; | 59 virtual void OnRootWindowHostClosed(const aura::RootWindow* root) OVERRIDE; |
58 | 60 |
59 private: | 61 private: |
60 // A weak pointer back to our owning widget. | 62 // A weak pointer back to our owning widget. |
61 NativeWidgetAura* widget_; | 63 NativeWidgetAura* widget_; |
62 | 64 |
63 // Optionally, a RootWindow that we attach ourselves to. | 65 // Optionally, a RootWindow that we attach ourselves to. |
64 scoped_ptr<aura::RootWindow> root_window_; | 66 scoped_ptr<aura::RootWindow> root_window_; |
65 | 67 |
66 // Toplevel event filter which dispatches to other event filters. | 68 // Toplevel event filter which dispatches to other event filters. |
67 aura::shared::RootWindowEventFilter* root_window_event_filter_; | 69 aura::shared::RootWindowEventFilter* root_window_event_filter_; |
68 | 70 |
69 // An event filter that pre-handles all key events to send them to an IME. | 71 // An event filter that pre-handles all key events to send them to an IME. |
70 scoped_ptr<aura::shared::InputMethodEventFilter> input_method_filter_; | 72 scoped_ptr<aura::shared::InputMethodEventFilter> input_method_filter_; |
71 | 73 |
72 // We want some windows (omnibox, status bar) to have their own | 74 // We want some windows (omnibox, status bar) to have their own |
73 // NativeWidgetAura, but still act as if they're screen bounded toplevel | 75 // NativeWidgetAura, but still act as if they're screen bounded toplevel |
74 // windows. | 76 // windows. |
75 bool is_embedded_window_; | 77 bool is_embedded_window_; |
76 | 78 |
| 79 // In some cases, we set a screen position client on |root_window_|. If we |
| 80 // do, we're responsible for the lifetime. |
| 81 scoped_ptr<aura::client::ScreenPositionClient> position_client_; |
| 82 |
77 #if defined(OS_WIN) | 83 #if defined(OS_WIN) |
78 scoped_ptr<ui::HWNDSubclass> subclass_; | 84 scoped_ptr<ui::HWNDSubclass> subclass_; |
79 #elif defined(USE_X11) | 85 #elif defined(USE_X11) |
80 scoped_ptr<X11WindowEventFilter> x11_window_event_filter_; | 86 scoped_ptr<X11WindowEventFilter> x11_window_event_filter_; |
81 #endif | 87 #endif |
82 | 88 |
83 DISALLOW_COPY_AND_ASSIGN(DesktopNativeWidgetHelperAura); | 89 DISALLOW_COPY_AND_ASSIGN(DesktopNativeWidgetHelperAura); |
84 }; | 90 }; |
85 | 91 |
86 } // namespace views | 92 } // namespace views |
87 | 93 |
88 #endif // UI_VIEWS_WIDGET_DESKTOP_NATIVE_WIDGET_HELPER_AURA_H_ | 94 #endif // UI_VIEWS_WIDGET_DESKTOP_NATIVE_WIDGET_HELPER_AURA_H_ |
OLD | NEW |