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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 return; | 127 return; |
128 } | 128 } |
129 #endif | 129 #endif |
130 | 130 |
131 gfx::Rect bounds = params.bounds; | 131 gfx::Rect bounds = params.bounds; |
132 if (bounds.IsEmpty()) { | 132 if (bounds.IsEmpty()) { |
133 // We must pass some non-zero value when we initialize a RootWindow. This | 133 // We must pass some non-zero value when we initialize a RootWindow. This |
134 // will probably be SetBounds()ed soon. | 134 // will probably be SetBounds()ed soon. |
135 bounds.set_size(gfx::Size(100, 100)); | 135 bounds.set_size(gfx::Size(100, 100)); |
136 } | 136 } |
137 // TODO(erg): Implement aura::CursorManager::Delegate to control | |
138 // cursor's shape and visibility. | |
139 | 137 |
140 aura::FocusManager* focus_manager = NULL; | 138 aura::FocusManager* focus_manager = NULL; |
141 aura::DesktopActivationClient* activation_client = NULL; | 139 aura::DesktopActivationClient* activation_client = NULL; |
142 #if defined(USE_X11) | 140 #if defined(USE_X11) |
143 focus_manager = X11DesktopHandler::get()->get_focus_manager(); | 141 focus_manager = X11DesktopHandler::get()->get_focus_manager(); |
144 activation_client = X11DesktopHandler::get()->get_activation_client(); | 142 activation_client = X11DesktopHandler::get()->get_activation_client(); |
145 #else | 143 #else |
146 // TODO(ben): This is almost certainly wrong; I suspect that the windows | 144 // TODO(ben): This is almost certainly wrong; I suspect that the windows |
147 // build will need a singleton like above. | 145 // build will need a singleton like above. |
148 focus_manager = new aura::FocusManager; | 146 focus_manager = new aura::FocusManager; |
(...skipping 10 matching lines...) Expand all Loading... |
159 // Pass ownership of the filter to the root_window. | 157 // Pass ownership of the filter to the root_window. |
160 root_window_->SetEventFilter(root_window_event_filter_); | 158 root_window_->SetEventFilter(root_window_event_filter_); |
161 | 159 |
162 input_method_filter_.reset(new aura::shared::InputMethodEventFilter()); | 160 input_method_filter_.reset(new aura::shared::InputMethodEventFilter()); |
163 input_method_filter_->SetInputMethodPropertyInRootWindow(root_window_.get()); | 161 input_method_filter_->SetInputMethodPropertyInRootWindow(root_window_.get()); |
164 root_window_event_filter_->AddFilter(input_method_filter_.get()); | 162 root_window_event_filter_->AddFilter(input_method_filter_.get()); |
165 | 163 |
166 capture_client_.reset( | 164 capture_client_.reset( |
167 new aura::shared::RootWindowCaptureClient(root_window_.get())); | 165 new aura::shared::RootWindowCaptureClient(root_window_.get())); |
168 | 166 |
| 167 cursor_client_.reset(new aura::DesktopCursorClient(root_window_.get())); |
| 168 aura::client::SetCursorClient(root_window_.get(), cursor_client_.get()); |
| 169 |
169 #if defined(USE_X11) | 170 #if defined(USE_X11) |
170 x11_window_event_filter_.reset( | 171 x11_window_event_filter_.reset( |
171 new X11WindowEventFilter(root_window_.get(), activation_client, widget_)); | 172 new X11WindowEventFilter(root_window_.get(), activation_client, widget_)); |
172 x11_window_event_filter_->SetUseHostWindowBorders(false); | 173 x11_window_event_filter_->SetUseHostWindowBorders(false); |
173 root_window_event_filter_->AddFilter(x11_window_event_filter_.get()); | 174 root_window_event_filter_->AddFilter(x11_window_event_filter_.get()); |
174 #endif | 175 #endif |
175 | 176 |
176 root_window_->AddRootWindowObserver(this); | 177 root_window_->AddRootWindowObserver(this); |
177 | 178 |
178 aura::client::SetActivationClient(root_window_.get(), activation_client); | 179 aura::client::SetActivationClient(root_window_.get(), activation_client); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 root->GetHostSize())); | 240 root->GetHostSize())); |
240 } | 241 } |
241 | 242 |
242 void DesktopNativeWidgetHelperAura::OnRootWindowHostClosed( | 243 void DesktopNativeWidgetHelperAura::OnRootWindowHostClosed( |
243 const aura::RootWindow* root) { | 244 const aura::RootWindow* root) { |
244 DCHECK_EQ(root, root_window_.get()); | 245 DCHECK_EQ(root, root_window_.get()); |
245 widget_->GetWidget()->Close(); | 246 widget_->GetWidget()->Close(); |
246 } | 247 } |
247 | 248 |
248 } // namespace views | 249 } // namespace views |
OLD | NEW |