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/trace_event/trace_event.h" | 8 #include "base/trace_event/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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 #include "ui/views/widget/window_reorderer.h" | 49 #include "ui/views/widget/window_reorderer.h" |
50 #include "ui/views/window/native_frame_view.h" | 50 #include "ui/views/window/native_frame_view.h" |
51 #include "ui/wm/core/compound_event_filter.h" | 51 #include "ui/wm/core/compound_event_filter.h" |
52 #include "ui/wm/core/cursor_manager.h" | 52 #include "ui/wm/core/cursor_manager.h" |
53 #include "ui/wm/core/focus_controller.h" | 53 #include "ui/wm/core/focus_controller.h" |
54 #include "ui/wm/core/input_method_event_filter.h" | 54 #include "ui/wm/core/input_method_event_filter.h" |
55 #include "ui/wm/core/native_cursor_manager.h" | 55 #include "ui/wm/core/native_cursor_manager.h" |
56 #include "ui/wm/core/shadow_controller.h" | 56 #include "ui/wm/core/shadow_controller.h" |
57 #include "ui/wm/core/shadow_types.h" | 57 #include "ui/wm/core/shadow_types.h" |
58 #include "ui/wm/core/visibility_controller.h" | 58 #include "ui/wm/core/visibility_controller.h" |
59 #include "ui/wm/core/window_activation_pre_target_handler.h" | |
59 #include "ui/wm/core/window_animations.h" | 60 #include "ui/wm/core/window_animations.h" |
60 #include "ui/wm/core/window_modality_controller.h" | 61 #include "ui/wm/core/window_modality_controller.h" |
61 #include "ui/wm/public/activation_client.h" | 62 #include "ui/wm/public/activation_client.h" |
62 #include "ui/wm/public/drag_drop_client.h" | 63 #include "ui/wm/public/drag_drop_client.h" |
63 | 64 |
64 #if defined(OS_WIN) | 65 #if defined(OS_WIN) |
65 #include "ui/base/win/shell.h" | 66 #include "ui/base/win/shell.h" |
66 #include "ui/gfx/win/dpi.h" | 67 #include "ui/gfx/win/dpi.h" |
67 #endif | 68 #endif |
68 | 69 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
313 root_window_event_filter_->RemoveHandler(input_method_event_filter_.get()); | 314 root_window_event_filter_->RemoveHandler(input_method_event_filter_.get()); |
314 | 315 |
315 window_tree_client_.reset(); // Uses host_->dispatcher() at destruction. | 316 window_tree_client_.reset(); // Uses host_->dispatcher() at destruction. |
316 | 317 |
317 capture_client_.reset(); // Uses host_->dispatcher() at destruction. | 318 capture_client_.reset(); // Uses host_->dispatcher() at destruction. |
318 | 319 |
319 // FocusController uses |content_window_|. Destroy it now so that we don't | 320 // FocusController uses |content_window_|. Destroy it now so that we don't |
320 // have to worry about the possibility of FocusController attempting to use | 321 // have to worry about the possibility of FocusController attempting to use |
321 // |content_window_| after it's been destroyed but before all child windows | 322 // |content_window_| after it's been destroyed but before all child windows |
322 // have been destroyed. | 323 // have been destroyed. |
323 host_->window()->RemovePreTargetHandler(focus_client_.get()); | 324 host_->window()->RemovePreTargetHandler( |
325 window_activation_pretarget_handler_.get()); | |
326 window_activation_pretarget_handler_.reset(); | |
324 aura::client::SetFocusClient(host_->window(), NULL); | 327 aura::client::SetFocusClient(host_->window(), NULL); |
325 aura::client::SetActivationClient(host_->window(), NULL); | 328 aura::client::SetActivationClient(host_->window(), NULL); |
326 focus_client_.reset(); | 329 focus_client_.reset(); |
327 | 330 |
328 host_->RemoveObserver(this); | 331 host_->RemoveObserver(this); |
329 host_.reset(); // Uses input_method_event_filter_ at destruction. | 332 host_.reset(); // Uses input_method_event_filter_ at destruction. |
330 // WindowEventDispatcher owns |desktop_window_tree_host_|. | 333 // WindowEventDispatcher owns |desktop_window_tree_host_|. |
331 desktop_window_tree_host_ = NULL; | 334 desktop_window_tree_host_ = NULL; |
332 content_window_ = NULL; | 335 content_window_ = NULL; |
333 | 336 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
471 | 474 |
472 UpdateWindowTransparency(); | 475 UpdateWindowTransparency(); |
473 | 476 |
474 capture_client_.reset(new DesktopCaptureClient(host_->window())); | 477 capture_client_.reset(new DesktopCaptureClient(host_->window())); |
475 | 478 |
476 wm::FocusController* focus_controller = | 479 wm::FocusController* focus_controller = |
477 new wm::FocusController(new DesktopFocusRules(content_window_)); | 480 new wm::FocusController(new DesktopFocusRules(content_window_)); |
478 focus_client_.reset(focus_controller); | 481 focus_client_.reset(focus_controller); |
479 aura::client::SetFocusClient(host_->window(), focus_controller); | 482 aura::client::SetFocusClient(host_->window(), focus_controller); |
480 aura::client::SetActivationClient(host_->window(), focus_controller); | 483 aura::client::SetActivationClient(host_->window(), focus_controller); |
481 host_->window()->AddPreTargetHandler(focus_controller); | 484 window_activation_pretarget_handler_.reset( |
sky
2015/05/27 15:37:52
I don't like separating out activation from the fo
| |
485 new ::wm::WindowActivationPreTargetHandler(focus_client_.get())); | |
486 host_->window()->AddPreTargetHandler( | |
487 window_activation_pretarget_handler_.get()); | |
482 | 488 |
483 dispatcher_client_.reset(new DesktopDispatcherClient); | 489 dispatcher_client_.reset(new DesktopDispatcherClient); |
484 aura::client::SetDispatcherClient(host_->window(), | 490 aura::client::SetDispatcherClient(host_->window(), |
485 dispatcher_client_.get()); | 491 dispatcher_client_.get()); |
486 | 492 |
487 position_client_.reset(new DesktopScreenPositionClient(host_->window())); | 493 position_client_.reset(new DesktopScreenPositionClient(host_->window())); |
488 | 494 |
489 InstallInputMethodEventFilter(); | 495 InstallInputMethodEventFilter(); |
490 | 496 |
491 drag_drop_client_ = desktop_window_tree_host_->CreateDragDropClient( | 497 drag_drop_client_ = desktop_window_tree_host_->CreateDragDropClient( |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1245 if (cursor_reference_count_ == 0) { | 1251 if (cursor_reference_count_ == 0) { |
1246 // We are the last DesktopNativeWidgetAura instance, and we are responsible | 1252 // We are the last DesktopNativeWidgetAura instance, and we are responsible |
1247 // for cleaning up |cursor_manager_|. | 1253 // for cleaning up |cursor_manager_|. |
1248 delete cursor_manager_; | 1254 delete cursor_manager_; |
1249 native_cursor_manager_ = NULL; | 1255 native_cursor_manager_ = NULL; |
1250 cursor_manager_ = NULL; | 1256 cursor_manager_ = NULL; |
1251 } | 1257 } |
1252 } | 1258 } |
1253 | 1259 |
1254 } // namespace views | 1260 } // namespace views |
OLD | NEW |