| 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/activation_client.h" | 9 #include "ui/aura/client/activation_client.h" |
| 10 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 root_window_->window()->RemovePreTargetHandler(tooltip_controller_.get()); | 279 root_window_->window()->RemovePreTargetHandler(tooltip_controller_.get()); |
| 280 aura::client::SetTooltipClient(root_window_->window(), NULL); | 280 aura::client::SetTooltipClient(root_window_->window(), NULL); |
| 281 tooltip_controller_.reset(); | 281 tooltip_controller_.reset(); |
| 282 | 282 |
| 283 root_window_event_filter_->RemoveHandler(input_method_event_filter_.get()); | 283 root_window_event_filter_->RemoveHandler(input_method_event_filter_.get()); |
| 284 | 284 |
| 285 window_tree_client_.reset(); // Uses root_window_ at destruction. | 285 window_tree_client_.reset(); // Uses root_window_ at destruction. |
| 286 | 286 |
| 287 capture_client_.reset(); // Uses root_window_ at destruction. | 287 capture_client_.reset(); // Uses root_window_ at destruction. |
| 288 | 288 |
| 289 // FocusController uses |content_window_|. Destroy it now so that we don't |
| 290 // have to worry about the possibility of FocusController attempting to use |
| 291 // |content_window_| after it's been destroyed but before all child windows |
| 292 // have been destroyed. |
| 293 root_window_->window()->RemovePreTargetHandler(focus_client_.get()); |
| 294 aura::client::SetFocusClient(root_window_->window(), NULL); |
| 295 aura::client::SetActivationClient(root_window_->window(), NULL); |
| 296 focus_client_.reset(); |
| 297 |
| 289 root_window_->RemoveRootWindowObserver(this); | 298 root_window_->RemoveRootWindowObserver(this); |
| 290 root_window_.reset(); // Uses input_method_event_filter_ at destruction. | 299 root_window_.reset(); // Uses input_method_event_filter_ at destruction. |
| 291 // RootWindow owns |desktop_root_window_host_|. | 300 // RootWindow owns |desktop_root_window_host_|. |
| 292 desktop_root_window_host_ = NULL; | 301 desktop_root_window_host_ = NULL; |
| 293 content_window_ = NULL; | 302 content_window_ = NULL; |
| 294 | 303 |
| 295 native_widget_delegate_->OnNativeWidgetDestroyed(); | 304 native_widget_delegate_->OnNativeWidgetDestroyed(); |
| 296 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) | 305 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) |
| 297 delete this; | 306 delete this; |
| 298 } | 307 } |
| 299 | 308 |
| 300 void DesktopNativeWidgetAura::OnDesktopWindowTreeHostDestroyed( | 309 void DesktopNativeWidgetAura::OnDesktopWindowTreeHostDestroyed( |
| 301 aura::RootWindow* root) { | 310 aura::RootWindow* root) { |
| 302 // |root_window_| is still valid, but DesktopWindowTreeHost is nearly | 311 // |root_window_| is still valid, but DesktopWindowTreeHost is nearly |
| 303 // destroyed. Do cleanup here of members DesktopWindowTreeHost may also use. | 312 // destroyed. Do cleanup here of members DesktopWindowTreeHost may also use. |
| 304 aura::client::SetFocusClient(root->window(), NULL); | |
| 305 aura::client::SetActivationClient(root->window(), NULL); | |
| 306 focus_client_.reset(); | |
| 307 | |
| 308 aura::client::SetDispatcherClient(root->window(), NULL); | 313 aura::client::SetDispatcherClient(root->window(), NULL); |
| 309 dispatcher_client_.reset(); | 314 dispatcher_client_.reset(); |
| 310 | 315 |
| 311 aura::client::SetCursorClient(root->window(), NULL); | 316 aura::client::SetCursorClient(root->window(), NULL); |
| 312 native_cursor_manager_->RemoveRootWindow(root); | 317 native_cursor_manager_->RemoveRootWindow(root); |
| 313 | 318 |
| 314 cursor_reference_count_--; | 319 cursor_reference_count_--; |
| 315 if (cursor_reference_count_ == 0) { | 320 if (cursor_reference_count_ == 0) { |
| 316 // We are the last DesktopNativeWidgetAura instance, and we are responsible | 321 // We are the last DesktopNativeWidgetAura instance, and we are responsible |
| 317 // for cleaning up |cursor_manager_|. | 322 // for cleaning up |cursor_manager_|. |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 aura::client::SetScreenPositionClient(root_window_->window(), | 455 aura::client::SetScreenPositionClient(root_window_->window(), |
| 451 position_client_.get()); | 456 position_client_.get()); |
| 452 | 457 |
| 453 InstallInputMethodEventFilter(); | 458 InstallInputMethodEventFilter(); |
| 454 | 459 |
| 455 drag_drop_client_ = desktop_root_window_host_->CreateDragDropClient( | 460 drag_drop_client_ = desktop_root_window_host_->CreateDragDropClient( |
| 456 native_cursor_manager_); | 461 native_cursor_manager_); |
| 457 aura::client::SetDragDropClient(root_window_->window(), | 462 aura::client::SetDragDropClient(root_window_->window(), |
| 458 drag_drop_client_.get()); | 463 drag_drop_client_.get()); |
| 459 | 464 |
| 460 focus_client_->FocusWindow(content_window_); | 465 static_cast<aura::client::FocusClient*>(focus_client_.get())-> |
| 466 FocusWindow(content_window_); |
| 461 | 467 |
| 462 OnWindowTreeHostResized(root_window_.get()); | 468 OnWindowTreeHostResized(root_window_.get()); |
| 463 | 469 |
| 464 root_window_->AddRootWindowObserver(this); | 470 root_window_->AddRootWindowObserver(this); |
| 465 | 471 |
| 466 window_tree_client_.reset( | 472 window_tree_client_.reset( |
| 467 new DesktopNativeWidgetAuraWindowTreeClient(root_window_->window())); | 473 new DesktopNativeWidgetAuraWindowTreeClient(root_window_->window())); |
| 468 drop_helper_.reset(new DropHelper( | 474 drop_helper_.reset(new DropHelper( |
| 469 static_cast<internal::RootView*>(GetWidget()->GetRootView()))); | 475 static_cast<internal::RootView*>(GetWidget()->GetRootView()))); |
| 470 aura::client::SetDragDropDelegate(content_window_, this); | 476 aura::client::SetDragDropDelegate(content_window_, this); |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1143 input_method_event_filter_->SetInputMethodPropertyInRootWindow( | 1149 input_method_event_filter_->SetInputMethodPropertyInRootWindow( |
| 1144 root_window_->window()); | 1150 root_window_->window()); |
| 1145 root_window_event_filter_->AddHandler(input_method_event_filter_.get()); | 1151 root_window_event_filter_->AddHandler(input_method_event_filter_.get()); |
| 1146 } | 1152 } |
| 1147 | 1153 |
| 1148 void DesktopNativeWidgetAura::UpdateWindowTransparency() { | 1154 void DesktopNativeWidgetAura::UpdateWindowTransparency() { |
| 1149 content_window_->SetTransparent(ShouldUseNativeFrame()); | 1155 content_window_->SetTransparent(ShouldUseNativeFrame()); |
| 1150 } | 1156 } |
| 1151 | 1157 |
| 1152 } // namespace views | 1158 } // namespace views |
| OLD | NEW |