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