| 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/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
| 10 #include "ui/aura/client/cursor_client.h" | 10 #include "ui/aura/client/cursor_client.h" |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 new wm::WindowModalityController(host_->window())); | 430 new wm::WindowModalityController(host_->window())); |
| 431 | 431 |
| 432 // |root_window_event_filter_| must be created before | 432 // |root_window_event_filter_| must be created before |
| 433 // OnWindowTreeHostCreated() is invoked. | 433 // OnWindowTreeHostCreated() is invoked. |
| 434 | 434 |
| 435 // CEF sets focus to the window the user clicks down on. | 435 // CEF sets focus to the window the user clicks down on. |
| 436 // TODO(beng): see if we can't do this some other way. CEF seems a heavy- | 436 // TODO(beng): see if we can't do this some other way. CEF seems a heavy- |
| 437 // handed way of accomplishing focus. | 437 // handed way of accomplishing focus. |
| 438 // No event filter for aura::Env. Create CompoundEvnetFilter per | 438 // No event filter for aura::Env. Create CompoundEvnetFilter per |
| 439 // WindowEventDispatcher. | 439 // WindowEventDispatcher. |
| 440 root_window_event_filter_ = new wm::CompoundEventFilter; | 440 root_window_event_filter_.reset(new wm::CompoundEventFilter); |
| 441 // Pass ownership of the filter to the root_window. | 441 host_->window()->AddPreTargetHandler(root_window_event_filter_.get()); |
| 442 host_->window()->SetEventFilter(root_window_event_filter_); | |
| 443 | 442 |
| 444 // The host's dispatcher must be added to |native_cursor_manager_| before | 443 // The host's dispatcher must be added to |native_cursor_manager_| before |
| 445 // OnNativeWidgetCreated() is called. | 444 // OnNativeWidgetCreated() is called. |
| 446 cursor_reference_count_++; | 445 cursor_reference_count_++; |
| 447 if (!native_cursor_manager_) { | 446 if (!native_cursor_manager_) { |
| 448 native_cursor_manager_ = new DesktopNativeCursorManager( | 447 native_cursor_manager_ = new DesktopNativeCursorManager( |
| 449 DesktopCursorLoaderUpdater::Create()); | 448 DesktopCursorLoaderUpdater::Create()); |
| 450 } | 449 } |
| 451 if (!cursor_manager_) { | 450 if (!cursor_manager_) { |
| 452 cursor_manager_ = new wm::CursorManager( | 451 cursor_manager_ = new wm::CursorManager( |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1187 if (cursor_reference_count_ == 0) { | 1186 if (cursor_reference_count_ == 0) { |
| 1188 // We are the last DesktopNativeWidgetAura instance, and we are responsible | 1187 // We are the last DesktopNativeWidgetAura instance, and we are responsible |
| 1189 // for cleaning up |cursor_manager_|. | 1188 // for cleaning up |cursor_manager_|. |
| 1190 delete cursor_manager_; | 1189 delete cursor_manager_; |
| 1191 native_cursor_manager_ = NULL; | 1190 native_cursor_manager_ = NULL; |
| 1192 cursor_manager_ = NULL; | 1191 cursor_manager_ = NULL; |
| 1193 } | 1192 } |
| 1194 } | 1193 } |
| 1195 | 1194 |
| 1196 } // namespace views | 1195 } // namespace views |
| OLD | NEW |