| 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 "ui/aura/client/activation_client.h" | 8 #include "ui/aura/client/activation_client.h" |
| 9 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
| 10 #include "ui/aura/client/stacking_client.h" | 10 #include "ui/aura/client/stacking_client.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 aura::client::SetActivationChangeObserver(window_, this); | 171 aura::client::SetActivationChangeObserver(window_, this); |
| 172 } | 172 } |
| 173 | 173 |
| 174 DesktopNativeWidgetAura::~DesktopNativeWidgetAura() { | 174 DesktopNativeWidgetAura::~DesktopNativeWidgetAura() { |
| 175 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) | 175 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) |
| 176 delete native_widget_delegate_; | 176 delete native_widget_delegate_; |
| 177 else | 177 else |
| 178 CloseNow(); | 178 CloseNow(); |
| 179 | 179 |
| 180 stacking_client_.reset(); // Uses root_window_ at destruction. | 180 stacking_client_.reset(); // Uses root_window_ at destruction. |
| 181 |
| 182 root_window_->RemoveRootWindowObserver(this); |
| 181 root_window_.reset(); // Uses input_method_event_filter_ at destruction. | 183 root_window_.reset(); // Uses input_method_event_filter_ at destruction. |
| 182 input_method_event_filter_.reset(); | 184 input_method_event_filter_.reset(); |
| 183 } | 185 } |
| 184 | 186 |
| 185 // static | 187 // static |
| 186 DesktopNativeWidgetAura* DesktopNativeWidgetAura::ForWindow( | 188 DesktopNativeWidgetAura* DesktopNativeWidgetAura::ForWindow( |
| 187 aura::Window* window) { | 189 aura::Window* window) { |
| 188 return window->GetProperty(kDesktopNativeWidgetAuraKey); | 190 return window->GetProperty(kDesktopNativeWidgetAuraKey); |
| 189 } | 191 } |
| 190 | 192 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 #if defined(OS_LINUX) // TODO(scottmg): http://crbug.com/180071 | 230 #if defined(OS_LINUX) // TODO(scottmg): http://crbug.com/180071 |
| 229 window_->Show(); | 231 window_->Show(); |
| 230 #endif | 232 #endif |
| 231 | 233 |
| 232 desktop_root_window_host_ = params.desktop_root_window_host ? | 234 desktop_root_window_host_ = params.desktop_root_window_host ? |
| 233 params.desktop_root_window_host : | 235 params.desktop_root_window_host : |
| 234 DesktopRootWindowHost::Create(native_widget_delegate_, | 236 DesktopRootWindowHost::Create(native_widget_delegate_, |
| 235 this, params.bounds); | 237 this, params.bounds); |
| 236 root_window_.reset( | 238 root_window_.reset( |
| 237 desktop_root_window_host_->Init(window_, params)); | 239 desktop_root_window_host_->Init(window_, params)); |
| 240 root_window_->AddRootWindowObserver(this); |
| 241 |
| 238 stacking_client_.reset( | 242 stacking_client_.reset( |
| 239 new DesktopNativeWidgetAuraStackingClient(root_window_.get())); | 243 new DesktopNativeWidgetAuraStackingClient(root_window_.get())); |
| 240 drop_helper_.reset(new DropHelper( | 244 drop_helper_.reset(new DropHelper( |
| 241 static_cast<internal::RootView*>(GetWidget()->GetRootView()))); | 245 static_cast<internal::RootView*>(GetWidget()->GetRootView()))); |
| 242 aura::client::SetDragDropDelegate(window_, this); | 246 aura::client::SetDragDropDelegate(window_, this); |
| 243 | 247 |
| 244 tooltip_manager_.reset(new views::TooltipManagerAura(window_, GetWidget())); | 248 tooltip_manager_.reset(new views::TooltipManagerAura(window_, GetWidget())); |
| 245 tooltip_controller_.reset( | 249 tooltip_controller_.reset( |
| 246 new corewm::TooltipController(gfx::SCREEN_TYPE_NATIVE)); | 250 new corewm::TooltipController(gfx::SCREEN_TYPE_NATIVE)); |
| 247 aura::client::SetTooltipClient(root_window_.get(), | 251 aura::client::SetTooltipClient(root_window_.get(), |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 DCHECK(drop_helper_.get() != NULL); | 839 DCHECK(drop_helper_.get() != NULL); |
| 836 drop_helper_->OnDragExit(); | 840 drop_helper_->OnDragExit(); |
| 837 } | 841 } |
| 838 | 842 |
| 839 int DesktopNativeWidgetAura::OnPerformDrop(const ui::DropTargetEvent& event) { | 843 int DesktopNativeWidgetAura::OnPerformDrop(const ui::DropTargetEvent& event) { |
| 840 DCHECK(drop_helper_.get() != NULL); | 844 DCHECK(drop_helper_.get() != NULL); |
| 841 return drop_helper_->OnDrop(event.data(), event.location(), | 845 return drop_helper_->OnDrop(event.data(), event.location(), |
| 842 last_drop_operation_); | 846 last_drop_operation_); |
| 843 } | 847 } |
| 844 | 848 |
| 849 //////////////////////////////////////////////////////////////////////////////// |
| 850 // DesktopNativeWidgetAura, aura::RootWindowObserver implementation: |
| 851 |
| 852 void DesktopNativeWidgetAura::OnRootWindowHostCloseRequested( |
| 853 const aura::RootWindow* root) { |
| 854 Close(); |
| 855 } |
| 856 |
| 845 } // namespace views | 857 } // namespace views |
| OLD | NEW |