| 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/client/dispatcher_client.h" | 7 #include "ui/aura/client/dispatcher_client.h" |
| 8 #include "ui/aura/client/screen_position_client.h" | 8 #include "ui/aura/client/screen_position_client.h" |
| 9 #include "ui/aura/cursor_manager.h" | |
| 10 #include "ui/aura/desktop/desktop_activation_client.h" | 9 #include "ui/aura/desktop/desktop_activation_client.h" |
| 10 #include "ui/aura/desktop/desktop_cursor_client.h" |
| 11 #include "ui/aura/desktop/desktop_dispatcher_client.h" | 11 #include "ui/aura/desktop/desktop_dispatcher_client.h" |
| 12 #include "ui/aura/focus_manager.h" | 12 #include "ui/aura/focus_manager.h" |
| 13 #include "ui/aura/root_window.h" | 13 #include "ui/aura/root_window.h" |
| 14 #include "ui/aura/shared/compound_event_filter.h" | 14 #include "ui/aura/shared/compound_event_filter.h" |
| 15 #include "ui/aura/shared/input_method_event_filter.h" | 15 #include "ui/aura/shared/input_method_event_filter.h" |
| 16 #include "ui/aura/shared/root_window_capture_client.h" | 16 #include "ui/aura/shared/root_window_capture_client.h" |
| 17 #include "ui/aura/window_property.h" | 17 #include "ui/aura/window_property.h" |
| 18 #include "ui/views/widget/native_widget_aura.h" | 18 #include "ui/views/widget/native_widget_aura.h" |
| 19 | 19 |
| 20 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 return; | 118 return; |
| 119 } | 119 } |
| 120 #endif | 120 #endif |
| 121 | 121 |
| 122 gfx::Rect bounds = params.bounds; | 122 gfx::Rect bounds = params.bounds; |
| 123 if (bounds.IsEmpty()) { | 123 if (bounds.IsEmpty()) { |
| 124 // We must pass some non-zero value when we initialize a RootWindow. This | 124 // We must pass some non-zero value when we initialize a RootWindow. This |
| 125 // will probably be SetBounds()ed soon. | 125 // will probably be SetBounds()ed soon. |
| 126 bounds.set_size(gfx::Size(100, 100)); | 126 bounds.set_size(gfx::Size(100, 100)); |
| 127 } | 127 } |
| 128 // TODO(erg): Implement aura::CursorManager::Delegate to control | |
| 129 // cursor's shape and visibility. | |
| 130 | 128 |
| 131 aura::FocusManager* focus_manager = NULL; | 129 aura::FocusManager* focus_manager = NULL; |
| 132 aura::DesktopActivationClient* activation_client = NULL; | 130 aura::DesktopActivationClient* activation_client = NULL; |
| 133 #if defined(USE_X11) | 131 #if defined(USE_X11) |
| 134 focus_manager = X11DesktopHandler::get()->get_focus_manager(); | 132 focus_manager = X11DesktopHandler::get()->get_focus_manager(); |
| 135 activation_client = X11DesktopHandler::get()->get_activation_client(); | 133 activation_client = X11DesktopHandler::get()->get_activation_client(); |
| 136 #else | 134 #else |
| 137 // TODO(ben): This is almost certainly wrong; I suspect that the windows | 135 // TODO(ben): This is almost certainly wrong; I suspect that the windows |
| 138 // build will need a singleton like above. | 136 // build will need a singleton like above. |
| 139 focus_manager = new aura::FocusManager; | 137 focus_manager = new aura::FocusManager; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 150 // Pass ownership of the filter to the root_window. | 148 // Pass ownership of the filter to the root_window. |
| 151 root_window_->SetEventFilter(root_window_event_filter_); | 149 root_window_->SetEventFilter(root_window_event_filter_); |
| 152 | 150 |
| 153 input_method_filter_.reset(new aura::shared::InputMethodEventFilter()); | 151 input_method_filter_.reset(new aura::shared::InputMethodEventFilter()); |
| 154 input_method_filter_->SetInputMethodPropertyInRootWindow(root_window_.get()); | 152 input_method_filter_->SetInputMethodPropertyInRootWindow(root_window_.get()); |
| 155 root_window_event_filter_->AddFilter(input_method_filter_.get()); | 153 root_window_event_filter_->AddFilter(input_method_filter_.get()); |
| 156 | 154 |
| 157 capture_client_.reset( | 155 capture_client_.reset( |
| 158 new aura::shared::RootWindowCaptureClient(root_window_.get())); | 156 new aura::shared::RootWindowCaptureClient(root_window_.get())); |
| 159 | 157 |
| 158 cursor_client_.reset(new aura::DesktopCursorClient(root_window_.get())); |
| 159 aura::client::SetCursorClient(root_window_.get(), cursor_client_.get()); |
| 160 |
| 160 #if defined(USE_X11) | 161 #if defined(USE_X11) |
| 161 x11_window_event_filter_.reset( | 162 x11_window_event_filter_.reset( |
| 162 new X11WindowEventFilter(root_window_.get(), activation_client, widget_)); | 163 new X11WindowEventFilter(root_window_.get(), activation_client, widget_)); |
| 163 x11_window_event_filter_->SetUseHostWindowBorders(false); | 164 x11_window_event_filter_->SetUseHostWindowBorders(false); |
| 164 root_window_event_filter_->AddFilter(x11_window_event_filter_.get()); | 165 root_window_event_filter_->AddFilter(x11_window_event_filter_.get()); |
| 165 #endif | 166 #endif |
| 166 | 167 |
| 167 root_window_->AddRootWindowObserver(this); | 168 root_window_->AddRootWindowObserver(this); |
| 168 | 169 |
| 169 aura::client::SetActivationClient(root_window_.get(), activation_client); | 170 aura::client::SetActivationClient(root_window_.get(), activation_client); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 root->GetHostSize())); | 227 root->GetHostSize())); |
| 227 } | 228 } |
| 228 | 229 |
| 229 void DesktopNativeWidgetHelperAura::OnRootWindowHostClosed( | 230 void DesktopNativeWidgetHelperAura::OnRootWindowHostClosed( |
| 230 const aura::RootWindow* root) { | 231 const aura::RootWindow* root) { |
| 231 DCHECK_EQ(root, root_window_.get()); | 232 DCHECK_EQ(root, root_window_.get()); |
| 232 widget_->GetWidget()->Close(); | 233 widget_->GetWidget()->Close(); |
| 233 } | 234 } |
| 234 | 235 |
| 235 } // namespace views | 236 } // namespace views |
| OLD | NEW |