| 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 #include "ui/views/widget/desktop_native_widget_helper_aura.h" | 5 #include "ui/views/widget/desktop_native_widget_helper_aura.h" |
| 6 | 6 |
| 7 #include "ui/aura/root_window.h" | 7 #include "ui/aura/root_window.h" |
| 8 #include "ui/aura/desktop/desktop_activation_client.h" | 8 #include "ui/aura/desktop/desktop_activation_client.h" |
| 9 #include "ui/aura/desktop/desktop_dispatcher_client.h" | 9 #include "ui/aura/desktop/desktop_dispatcher_client.h" |
| 10 #include "ui/aura/client/dispatcher_client.h" | 10 #include "ui/aura/client/dispatcher_client.h" |
| 11 #include "ui/aura/shared/input_method_event_filter.h" | 11 #include "ui/aura/shared/input_method_event_filter.h" |
| 12 #include "ui/aura/shared/root_window_event_filter.h" | 12 #include "ui/aura/shared/root_window_event_filter.h" |
| 13 #include "ui/views/widget/native_widget_aura.h" | 13 #include "ui/views/widget/native_widget_aura.h" |
| 14 | 14 |
| 15 #if defined(OS_WIN) | 15 #if defined(OS_WIN) |
| 16 #include "ui/base/win/hwnd_subclass.h" | 16 #include "ui/base/win/hwnd_subclass.h" |
| 17 #include "ui/views/widget/widget_message_filter.h" | 17 #include "ui/views/widget/widget_message_filter.h" |
| 18 #elif defined(USE_X11) |
| 19 #include "ui/views/widget/x11_window_event_filter.h" |
| 18 #endif | 20 #endif |
| 19 | 21 |
| 20 namespace views { | 22 namespace views { |
| 21 | 23 |
| 22 DesktopNativeWidgetHelperAura::DesktopNativeWidgetHelperAura( | 24 DesktopNativeWidgetHelperAura::DesktopNativeWidgetHelperAura( |
| 23 NativeWidgetAura* widget) | 25 NativeWidgetAura* widget) |
| 24 : widget_(widget), | 26 : widget_(widget), |
| 25 root_window_event_filter_(NULL), | 27 root_window_event_filter_(NULL), |
| 26 is_embedded_window_(false) { | 28 is_embedded_window_(false) { |
| 27 } | 29 } |
| 28 | 30 |
| 29 DesktopNativeWidgetHelperAura::~DesktopNativeWidgetHelperAura() { | 31 DesktopNativeWidgetHelperAura::~DesktopNativeWidgetHelperAura() { |
| 30 if (root_window_event_filter_) | 32 if (root_window_event_filter_) { |
| 33 #if defined(USE_X11) |
| 34 root_window_event_filter_->RemoveFilter(x11_window_event_filter_.get()); |
| 35 #endif |
| 36 |
| 31 root_window_event_filter_->RemoveFilter(input_method_filter_.get()); | 37 root_window_event_filter_->RemoveFilter(input_method_filter_.get()); |
| 38 } |
| 32 } | 39 } |
| 33 | 40 |
| 34 void DesktopNativeWidgetHelperAura::PreInitialize( | 41 void DesktopNativeWidgetHelperAura::PreInitialize( |
| 35 const Widget::InitParams& params) { | 42 const Widget::InitParams& params) { |
| 36 // We don't want the status bubble or the omnibox to get their own root | 43 // We don't want the status bubble or the omnibox to get their own root |
| 37 // window on the desktop; on Linux | 44 // window on the desktop; on Linux |
| 38 // | 45 // |
| 39 // TODO(erg): This doesn't map perfectly to what I want to do. TYPE_POPUP is | 46 // TODO(erg): This doesn't map perfectly to what I want to do. TYPE_POPUP is |
| 40 // used for lots of stuff, like dragged tabs, and I only want this to trigger | 47 // used for lots of stuff, like dragged tabs, and I only want this to trigger |
| 41 // for the status bubble and the omnibox. | 48 // for the status bubble and the omnibox. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 56 root_window_->Init(); | 63 root_window_->Init(); |
| 57 | 64 |
| 58 root_window_event_filter_ = | 65 root_window_event_filter_ = |
| 59 new aura::shared::RootWindowEventFilter(root_window_.get()); | 66 new aura::shared::RootWindowEventFilter(root_window_.get()); |
| 60 root_window_->SetEventFilter(root_window_event_filter_); | 67 root_window_->SetEventFilter(root_window_event_filter_); |
| 61 | 68 |
| 62 input_method_filter_.reset( | 69 input_method_filter_.reset( |
| 63 new aura::shared::InputMethodEventFilter(root_window_.get())); | 70 new aura::shared::InputMethodEventFilter(root_window_.get())); |
| 64 root_window_event_filter_->AddFilter(input_method_filter_.get()); | 71 root_window_event_filter_->AddFilter(input_method_filter_.get()); |
| 65 | 72 |
| 73 #if defined(USE_X11) |
| 74 x11_window_event_filter_.reset(new X11WindowEventFilter(root_window_.get())); |
| 75 x11_window_event_filter_->SetUseHostWindowBorders(false); |
| 76 root_window_event_filter_->AddFilter(x11_window_event_filter_.get()); |
| 77 #endif |
| 78 |
| 66 root_window_->AddRootWindowObserver(this); | 79 root_window_->AddRootWindowObserver(this); |
| 67 | 80 |
| 68 aura::client::SetActivationClient( | 81 aura::client::SetActivationClient( |
| 69 root_window_.get(), | 82 root_window_.get(), |
| 70 new aura::DesktopActivationClient(root_window_.get())); | 83 new aura::DesktopActivationClient(root_window_.get())); |
| 71 aura::client::SetDispatcherClient(root_window_.get(), | 84 aura::client::SetDispatcherClient(root_window_.get(), |
| 72 new aura::DesktopDispatcherClient); | 85 new aura::DesktopDispatcherClient); |
| 73 } | 86 } |
| 74 | 87 |
| 75 void DesktopNativeWidgetHelperAura::PostInitialize() { | 88 void DesktopNativeWidgetHelperAura::PostInitialize() { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 root->GetHostSize())); | 147 root->GetHostSize())); |
| 135 } | 148 } |
| 136 | 149 |
| 137 void DesktopNativeWidgetHelperAura::OnRootWindowHostClosed( | 150 void DesktopNativeWidgetHelperAura::OnRootWindowHostClosed( |
| 138 const aura::RootWindow* root) { | 151 const aura::RootWindow* root) { |
| 139 DCHECK_EQ(root, root_window_.get()); | 152 DCHECK_EQ(root, root_window_.get()); |
| 140 widget_->GetWidget()->Close(); | 153 widget_->GetWidget()->Close(); |
| 141 } | 154 } |
| 142 | 155 |
| 143 } // namespace views | 156 } // namespace views |
| OLD | NEW |