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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 { | 292 { |
293 aura::Window* capture_window = capture_client_->GetCaptureWindow(); | 293 aura::Window* capture_window = capture_client_->GetCaptureWindow(); |
294 if (capture_window && host_->window()->Contains(capture_window)) | 294 if (capture_window && host_->window()->Contains(capture_window)) |
295 capture_window->ReleaseCapture(); | 295 capture_window->ReleaseCapture(); |
296 } | 296 } |
297 | 297 |
298 // DesktopWindowTreeHost owns the ActivationController which ShadowController | 298 // DesktopWindowTreeHost owns the ActivationController which ShadowController |
299 // references. Make sure we destroy ShadowController early on. | 299 // references. Make sure we destroy ShadowController early on. |
300 shadow_controller_.reset(); | 300 shadow_controller_.reset(); |
301 tooltip_manager_.reset(); | 301 tooltip_manager_.reset(); |
302 host_->window()->RemovePreTargetHandler(tooltip_controller_.get()); | 302 if (tooltip_controller_.get()) { |
303 aura::client::SetTooltipClient(host_->window(), NULL); | 303 host_->window()->RemovePreTargetHandler(tooltip_controller_.get()); |
304 tooltip_controller_.reset(); | 304 aura::client::SetTooltipClient(host_->window(), NULL); |
| 305 tooltip_controller_.reset(); |
| 306 } |
305 | 307 |
306 root_window_event_filter_->RemoveHandler(input_method_event_filter_.get()); | 308 root_window_event_filter_->RemoveHandler(input_method_event_filter_.get()); |
307 | 309 |
308 window_tree_client_.reset(); // Uses host_->dispatcher() at destruction. | 310 window_tree_client_.reset(); // Uses host_->dispatcher() at destruction. |
309 | 311 |
310 capture_client_.reset(); // Uses host_->dispatcher() at destruction. | 312 capture_client_.reset(); // Uses host_->dispatcher() at destruction. |
311 | 313 |
312 // FocusController uses |content_window_|. Destroy it now so that we don't | 314 // FocusController uses |content_window_|. Destroy it now so that we don't |
313 // have to worry about the possibility of FocusController attempting to use | 315 // have to worry about the possibility of FocusController attempting to use |
314 // |content_window_| after it's been destroyed but before all child windows | 316 // |content_window_| after it's been destroyed but before all child windows |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 | 491 |
490 OnHostResized(host()); | 492 OnHostResized(host()); |
491 | 493 |
492 host_->AddObserver(this); | 494 host_->AddObserver(this); |
493 | 495 |
494 window_tree_client_.reset( | 496 window_tree_client_.reset( |
495 new DesktopNativeWidgetAuraWindowTreeClient(host_->window())); | 497 new DesktopNativeWidgetAuraWindowTreeClient(host_->window())); |
496 drop_helper_.reset(new DropHelper(GetWidget()->GetRootView())); | 498 drop_helper_.reset(new DropHelper(GetWidget()->GetRootView())); |
497 aura::client::SetDragDropDelegate(content_window_, this); | 499 aura::client::SetDragDropDelegate(content_window_, this); |
498 | 500 |
499 tooltip_manager_.reset(new TooltipManagerAura(GetWidget())); | 501 if (params.type != Widget::InitParams::TYPE_TOOLTIP) { |
500 | 502 tooltip_manager_.reset(new TooltipManagerAura(GetWidget())); |
501 tooltip_controller_.reset( | 503 tooltip_controller_.reset( |
502 new corewm::TooltipController( | 504 new corewm::TooltipController( |
503 desktop_window_tree_host_->CreateTooltip())); | 505 desktop_window_tree_host_->CreateTooltip())); |
504 aura::client::SetTooltipClient(host_->window(), | 506 aura::client::SetTooltipClient(host_->window(), |
505 tooltip_controller_.get()); | 507 tooltip_controller_.get()); |
506 host_->window()->AddPreTargetHandler(tooltip_controller_.get()); | 508 host_->window()->AddPreTargetHandler(tooltip_controller_.get()); |
| 509 } |
507 | 510 |
508 if (params.opacity == Widget::InitParams::TRANSLUCENT_WINDOW) { | 511 if (params.opacity == Widget::InitParams::TRANSLUCENT_WINDOW) { |
509 visibility_controller_.reset(new wm::VisibilityController); | 512 visibility_controller_.reset(new wm::VisibilityController); |
510 aura::client::SetVisibilityClient(host_->window(), | 513 aura::client::SetVisibilityClient(host_->window(), |
511 visibility_controller_.get()); | 514 visibility_controller_.get()); |
512 wm::SetChildWindowVisibilityChangesAnimated(host_->window()); | 515 wm::SetChildWindowVisibilityChangesAnimated(host_->window()); |
513 wm::SetChildWindowVisibilityChangesAnimated( | 516 wm::SetChildWindowVisibilityChangesAnimated( |
514 content_window_container_); | 517 content_window_container_); |
515 } | 518 } |
516 | 519 |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1205 if (cursor_reference_count_ == 0) { | 1208 if (cursor_reference_count_ == 0) { |
1206 // We are the last DesktopNativeWidgetAura instance, and we are responsible | 1209 // We are the last DesktopNativeWidgetAura instance, and we are responsible |
1207 // for cleaning up |cursor_manager_|. | 1210 // for cleaning up |cursor_manager_|. |
1208 delete cursor_manager_; | 1211 delete cursor_manager_; |
1209 native_cursor_manager_ = NULL; | 1212 native_cursor_manager_ = NULL; |
1210 cursor_manager_ = NULL; | 1213 cursor_manager_ = NULL; |
1211 } | 1214 } |
1212 } | 1215 } |
1213 | 1216 |
1214 } // namespace views | 1217 } // namespace views |
OLD | NEW |