| 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/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "ui/gfx/canvas.h" | 24 #include "ui/gfx/canvas.h" |
| 25 #include "ui/gfx/geometry/point_conversions.h" | 25 #include "ui/gfx/geometry/point_conversions.h" |
| 26 #include "ui/gfx/geometry/rect.h" | 26 #include "ui/gfx/geometry/rect.h" |
| 27 #include "ui/gfx/geometry/size_conversions.h" | 27 #include "ui/gfx/geometry/size_conversions.h" |
| 28 #include "ui/native_theme/native_theme.h" | 28 #include "ui/native_theme/native_theme.h" |
| 29 #include "ui/views/corewm/tooltip.h" | 29 #include "ui/views/corewm/tooltip.h" |
| 30 #include "ui/views/corewm/tooltip_controller.h" | 30 #include "ui/views/corewm/tooltip_controller.h" |
| 31 #include "ui/views/drag_utils.h" | 31 #include "ui/views/drag_utils.h" |
| 32 #include "ui/views/view_constants_aura.h" | 32 #include "ui/views/view_constants_aura.h" |
| 33 #include "ui/views/widget/desktop_aura/desktop_capture_client.h" | 33 #include "ui/views/widget/desktop_aura/desktop_capture_client.h" |
| 34 #include "ui/views/widget/desktop_aura/desktop_cursor_loader_updater.h" | |
| 35 #include "ui/views/widget/desktop_aura/desktop_event_client.h" | 34 #include "ui/views/widget/desktop_aura/desktop_event_client.h" |
| 36 #include "ui/views/widget/desktop_aura/desktop_focus_rules.h" | 35 #include "ui/views/widget/desktop_aura/desktop_focus_rules.h" |
| 37 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h" | 36 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h" |
| 38 #include "ui/views/widget/desktop_aura/desktop_screen_position_client.h" | 37 #include "ui/views/widget/desktop_aura/desktop_screen_position_client.h" |
| 39 #include "ui/views/widget/desktop_aura/desktop_window_tree_host.h" | 38 #include "ui/views/widget/desktop_aura/desktop_window_tree_host.h" |
| 40 #include "ui/views/widget/drop_helper.h" | 39 #include "ui/views/widget/drop_helper.h" |
| 41 #include "ui/views/widget/focus_manager_event_handler.h" | 40 #include "ui/views/widget/focus_manager_event_handler.h" |
| 42 #include "ui/views/widget/native_widget_aura.h" | 41 #include "ui/views/widget/native_widget_aura.h" |
| 43 #include "ui/views/widget/root_view.h" | 42 #include "ui/views/widget/root_view.h" |
| 44 #include "ui/views/widget/tooltip_manager_aura.h" | 43 #include "ui/views/widget/tooltip_manager_aura.h" |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 // TODO(beng): see if we can't do this some other way. CEF seems a heavy- | 437 // TODO(beng): see if we can't do this some other way. CEF seems a heavy- |
| 439 // handed way of accomplishing focus. | 438 // handed way of accomplishing focus. |
| 440 // No event filter for aura::Env. Create CompoundEventFilter per | 439 // No event filter for aura::Env. Create CompoundEventFilter per |
| 441 // WindowEventDispatcher. | 440 // WindowEventDispatcher. |
| 442 root_window_event_filter_.reset(new wm::CompoundEventFilter); | 441 root_window_event_filter_.reset(new wm::CompoundEventFilter); |
| 443 host_->window()->AddPreTargetHandler(root_window_event_filter_.get()); | 442 host_->window()->AddPreTargetHandler(root_window_event_filter_.get()); |
| 444 | 443 |
| 445 // The host's dispatcher must be added to |native_cursor_manager_| before | 444 // The host's dispatcher must be added to |native_cursor_manager_| before |
| 446 // OnNativeWidgetCreated() is called. | 445 // OnNativeWidgetCreated() is called. |
| 447 cursor_reference_count_++; | 446 cursor_reference_count_++; |
| 448 if (!native_cursor_manager_) { | 447 if (!native_cursor_manager_) |
| 449 native_cursor_manager_ = new DesktopNativeCursorManager( | 448 native_cursor_manager_ = new DesktopNativeCursorManager(); |
| 450 DesktopCursorLoaderUpdater::Create()); | |
| 451 } | |
| 452 if (!cursor_manager_) { | 449 if (!cursor_manager_) { |
| 453 cursor_manager_ = new wm::CursorManager( | 450 cursor_manager_ = new wm::CursorManager( |
| 454 std::unique_ptr<wm::NativeCursorManager>(native_cursor_manager_)); | 451 std::unique_ptr<wm::NativeCursorManager>(native_cursor_manager_)); |
| 455 } | 452 } |
| 456 native_cursor_manager_->AddHost(host()); | 453 native_cursor_manager_->AddHost(host()); |
| 457 aura::client::SetCursorClient(host_->window(), cursor_manager_); | 454 aura::client::SetCursorClient(host_->window(), cursor_manager_); |
| 458 | 455 |
| 459 desktop_window_tree_host_->OnNativeWidgetCreated(params); | 456 desktop_window_tree_host_->OnNativeWidgetCreated(params); |
| 460 | 457 |
| 461 UpdateWindowTransparency(); | 458 UpdateWindowTransparency(); |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1191 if (cursor_reference_count_ == 0) { | 1188 if (cursor_reference_count_ == 0) { |
| 1192 // We are the last DesktopNativeWidgetAura instance, and we are responsible | 1189 // We are the last DesktopNativeWidgetAura instance, and we are responsible |
| 1193 // for cleaning up |cursor_manager_|. | 1190 // for cleaning up |cursor_manager_|. |
| 1194 delete cursor_manager_; | 1191 delete cursor_manager_; |
| 1195 native_cursor_manager_ = NULL; | 1192 native_cursor_manager_ = NULL; |
| 1196 cursor_manager_ = NULL; | 1193 cursor_manager_ = NULL; |
| 1197 } | 1194 } |
| 1198 } | 1195 } |
| 1199 | 1196 |
| 1200 } // namespace views | 1197 } // namespace views |
| OLD | NEW |