| 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_aura/desktop_native_widget_aura.h" | 5 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "ui/aura/client/activation_client.h" | 9 #include "ui/aura/client/activation_client.h" |
| 10 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 if (widget_type_ == Widget::InitParams::TYPE_WINDOW) | 369 if (widget_type_ == Widget::InitParams::TYPE_WINDOW) |
| 370 window_modality_controller_.reset( | 370 window_modality_controller_.reset( |
| 371 new views::corewm::WindowModalityController(root_window_->window())); | 371 new views::corewm::WindowModalityController(root_window_->window())); |
| 372 | 372 |
| 373 // |root_window_event_filter_| must be created before | 373 // |root_window_event_filter_| must be created before |
| 374 // OnRootWindowHostCreated() is invoked. | 374 // OnRootWindowHostCreated() is invoked. |
| 375 | 375 |
| 376 // CEF sets focus to the window the user clicks down on. | 376 // CEF sets focus to the window the user clicks down on. |
| 377 // TODO(beng): see if we can't do this some other way. CEF seems a heavy- | 377 // TODO(beng): see if we can't do this some other way. CEF seems a heavy- |
| 378 // handed way of accomplishing focus. | 378 // handed way of accomplishing focus. |
| 379 // No event filter for aura::Env. Create CompoundEvnetFilter per RootWindow. | 379 // No event filter for aura::Env. Create CompoundEventFilter per RootWindow. |
| 380 root_window_event_filter_ = new corewm::CompoundEventFilter; | 380 root_window_event_filter_ = new corewm::CompoundEventFilter; |
| 381 // Pass ownership of the filter to the root_window. | 381 // Pass ownership of the filter to the root_window. |
| 382 root_window_->window()->SetEventFilter(root_window_event_filter_); | 382 root_window_->window()->SetEventFilter(root_window_event_filter_); |
| 383 | 383 |
| 384 // SetCursorClient() must be called before OnRootWindowCreated(). |
| 385 // TODO(tdanderson): DesktopNativeCursorManager should be a singleton. |
| 386 DesktopNativeCursorManager* desktop_native_cursor_manager = |
| 387 new views::DesktopNativeCursorManager( |
| 388 root_window_.get(), |
| 389 DesktopCursorLoaderUpdater::Create()); |
| 390 cursor_client_.reset( |
| 391 new views::corewm::CursorManager( |
| 392 scoped_ptr<corewm::NativeCursorManager>( |
| 393 desktop_native_cursor_manager))); |
| 394 aura::client::SetCursorClient(root_window_->window(), cursor_client_.get()); |
| 395 |
| 384 desktop_root_window_host_->OnRootWindowCreated(root_window_.get(), params); | 396 desktop_root_window_host_->OnRootWindowCreated(root_window_.get(), params); |
| 385 | 397 |
| 386 UpdateWindowTransparency(); | 398 UpdateWindowTransparency(); |
| 387 | 399 |
| 388 capture_client_.reset(new DesktopCaptureClient(root_window_->window())); | 400 capture_client_.reset(new DesktopCaptureClient(root_window_->window())); |
| 389 | 401 |
| 390 corewm::FocusController* focus_controller = | 402 corewm::FocusController* focus_controller = |
| 391 new corewm::FocusController(new DesktopFocusRules(content_window_)); | 403 new corewm::FocusController(new DesktopFocusRules(content_window_)); |
| 392 focus_client_.reset(focus_controller); | 404 focus_client_.reset(focus_controller); |
| 393 aura::client::SetFocusClient(root_window_->window(), focus_controller); | 405 aura::client::SetFocusClient(root_window_->window(), focus_controller); |
| 394 aura::client::SetActivationClient(root_window_->window(), focus_controller); | 406 aura::client::SetActivationClient(root_window_->window(), focus_controller); |
| 395 root_window_->window()->AddPreTargetHandler(focus_controller); | 407 root_window_->window()->AddPreTargetHandler(focus_controller); |
| 396 | 408 |
| 397 dispatcher_client_.reset(new DesktopDispatcherClient); | 409 dispatcher_client_.reset(new DesktopDispatcherClient); |
| 398 aura::client::SetDispatcherClient(root_window_->window(), | 410 aura::client::SetDispatcherClient(root_window_->window(), |
| 399 dispatcher_client_.get()); | 411 dispatcher_client_.get()); |
| 400 | 412 |
| 401 DesktopNativeCursorManager* desktop_native_cursor_manager = | |
| 402 new views::DesktopNativeCursorManager( | |
| 403 root_window_.get(), | |
| 404 DesktopCursorLoaderUpdater::Create()); | |
| 405 cursor_client_.reset( | |
| 406 new views::corewm::CursorManager( | |
| 407 scoped_ptr<corewm::NativeCursorManager>( | |
| 408 desktop_native_cursor_manager))); | |
| 409 aura::client::SetCursorClient(root_window_->window(), cursor_client_.get()); | |
| 410 | |
| 411 position_client_.reset(new DesktopScreenPositionClient()); | 413 position_client_.reset(new DesktopScreenPositionClient()); |
| 412 aura::client::SetScreenPositionClient(root_window_->window(), | 414 aura::client::SetScreenPositionClient(root_window_->window(), |
| 413 position_client_.get()); | 415 position_client_.get()); |
| 414 | 416 |
| 415 InstallInputMethodEventFilter(); | 417 InstallInputMethodEventFilter(); |
| 416 | 418 |
| 417 drag_drop_client_ = desktop_root_window_host_->CreateDragDropClient( | 419 drag_drop_client_ = desktop_root_window_host_->CreateDragDropClient( |
| 418 desktop_native_cursor_manager); | 420 desktop_native_cursor_manager); |
| 419 aura::client::SetDragDropClient(root_window_->window(), | 421 aura::client::SetDragDropClient(root_window_->window(), |
| 420 drag_drop_client_.get()); | 422 drag_drop_client_.get()); |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1108 input_method_event_filter_->SetInputMethodPropertyInRootWindow( | 1110 input_method_event_filter_->SetInputMethodPropertyInRootWindow( |
| 1109 root_window_->window()); | 1111 root_window_->window()); |
| 1110 root_window_event_filter_->AddHandler(input_method_event_filter_.get()); | 1112 root_window_event_filter_->AddHandler(input_method_event_filter_.get()); |
| 1111 } | 1113 } |
| 1112 | 1114 |
| 1113 void DesktopNativeWidgetAura::UpdateWindowTransparency() { | 1115 void DesktopNativeWidgetAura::UpdateWindowTransparency() { |
| 1114 content_window_->SetTransparent(ShouldUseNativeFrame()); | 1116 content_window_->SetTransparent(ShouldUseNativeFrame()); |
| 1115 } | 1117 } |
| 1116 | 1118 |
| 1117 } // namespace views | 1119 } // namespace views |
| OLD | NEW |