| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ash/aura/wm_window_aura.h" | 5 #include "ash/aura/wm_window_aura.h" |
| 6 | 6 |
| 7 #include "ash/aura/aura_layout_manager_adapter.h" | 7 #include "ash/aura/aura_layout_manager_adapter.h" |
| 8 #include "ash/aura/wm_root_window_controller_aura.h" | 8 #include "ash/aura/wm_root_window_controller_aura.h" |
| 9 #include "ash/aura/wm_shell_aura.h" | 9 #include "ash/aura/wm_shell_aura.h" |
| 10 #include "ash/common/ash_constants.h" | 10 #include "ash/common/ash_constants.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 observers_(base::ObserverList<WmWindowObserver>::NOTIFY_EXISTING_ONLY) { | 89 observers_(base::ObserverList<WmWindowObserver>::NOTIFY_EXISTING_ONLY) { |
| 90 window_->AddObserver(this); | 90 window_->AddObserver(this); |
| 91 window_->SetProperty(kWmWindowKey, this); | 91 window_->SetProperty(kWmWindowKey, this); |
| 92 } | 92 } |
| 93 | 93 |
| 94 WmWindowAura::~WmWindowAura() { | 94 WmWindowAura::~WmWindowAura() { |
| 95 if (added_transient_observer_) | 95 if (added_transient_observer_) |
| 96 ::wm::TransientWindowManager::Get(window_)->RemoveObserver(this); | 96 ::wm::TransientWindowManager::Get(window_)->RemoveObserver(this); |
| 97 | 97 |
| 98 window_->RemoveObserver(this); | 98 window_->RemoveObserver(this); |
| 99 |
| 100 DestroyUserData(); |
| 99 } | 101 } |
| 100 | 102 |
| 101 // static | 103 // static |
| 102 const WmWindow* WmWindowAura::Get(const aura::Window* window) { | 104 const WmWindow* WmWindowAura::Get(const aura::Window* window) { |
| 103 if (!window) | 105 if (!window) |
| 104 return nullptr; | 106 return nullptr; |
| 105 | 107 |
| 106 const WmWindow* wm_window = window->GetProperty(kWmWindowKey); | 108 const WmWindow* wm_window = window->GetProperty(kWmWindowKey); |
| 107 if (wm_window) | 109 if (wm_window) |
| 108 return wm_window; | 110 return wm_window; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 128 result[i] = WmWindowAura::GetAuraWindow(windows[i]); | 130 result[i] = WmWindowAura::GetAuraWindow(windows[i]); |
| 129 return result; | 131 return result; |
| 130 } | 132 } |
| 131 | 133 |
| 132 // static | 134 // static |
| 133 const aura::Window* WmWindowAura::GetAuraWindow(const WmWindow* wm_window) { | 135 const aura::Window* WmWindowAura::GetAuraWindow(const WmWindow* wm_window) { |
| 134 return wm_window ? static_cast<const WmWindowAura*>(wm_window)->aura_window() | 136 return wm_window ? static_cast<const WmWindowAura*>(wm_window)->aura_window() |
| 135 : nullptr; | 137 : nullptr; |
| 136 } | 138 } |
| 137 | 139 |
| 140 void WmWindowAura::Destroy() { |
| 141 delete window_; |
| 142 } |
| 143 |
| 138 const WmWindow* WmWindowAura::GetRootWindow() const { | 144 const WmWindow* WmWindowAura::GetRootWindow() const { |
| 139 return Get(window_->GetRootWindow()); | 145 return Get(window_->GetRootWindow()); |
| 140 } | 146 } |
| 141 | 147 |
| 142 WmRootWindowController* WmWindowAura::GetRootWindowController() { | 148 WmRootWindowController* WmWindowAura::GetRootWindowController() { |
| 143 aura::Window* root = window_->GetRootWindow(); | 149 aura::Window* root = window_->GetRootWindow(); |
| 144 return root ? WmRootWindowControllerAura::Get(root) : nullptr; | 150 return root ? WmRootWindowControllerAura::Get(root) : nullptr; |
| 145 } | 151 } |
| 146 | 152 |
| 147 WmShell* WmWindowAura::GetShell() const { | 153 WmShell* WmWindowAura::GetShell() const { |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 layout_manager ? new AuraLayoutManagerAdapter(std::move(layout_manager)) | 364 layout_manager ? new AuraLayoutManagerAdapter(std::move(layout_manager)) |
| 359 : nullptr); | 365 : nullptr); |
| 360 } | 366 } |
| 361 | 367 |
| 362 WmLayoutManager* WmWindowAura::GetLayoutManager() { | 368 WmLayoutManager* WmWindowAura::GetLayoutManager() { |
| 363 AuraLayoutManagerAdapter* adapter = | 369 AuraLayoutManagerAdapter* adapter = |
| 364 static_cast<AuraLayoutManagerAdapter*>(window_->layout_manager()); | 370 static_cast<AuraLayoutManagerAdapter*>(window_->layout_manager()); |
| 365 return adapter ? adapter->wm_layout_manager() : nullptr; | 371 return adapter ? adapter->wm_layout_manager() : nullptr; |
| 366 } | 372 } |
| 367 | 373 |
| 374 void WmWindowAura::SetVisibilityChangesAnimated() { |
| 375 ::wm::SetWindowVisibilityChangesAnimated(window_); |
| 376 } |
| 377 |
| 368 void WmWindowAura::SetVisibilityAnimationType(int type) { | 378 void WmWindowAura::SetVisibilityAnimationType(int type) { |
| 369 ::wm::SetWindowVisibilityAnimationType(window_, type); | 379 ::wm::SetWindowVisibilityAnimationType(window_, type); |
| 370 } | 380 } |
| 371 | 381 |
| 372 void WmWindowAura::SetVisibilityAnimationDuration(base::TimeDelta delta) { | 382 void WmWindowAura::SetVisibilityAnimationDuration(base::TimeDelta delta) { |
| 373 ::wm::SetWindowVisibilityAnimationDuration(window_, delta); | 383 ::wm::SetWindowVisibilityAnimationDuration(window_, delta); |
| 374 } | 384 } |
| 375 | 385 |
| 376 void WmWindowAura::SetVisibilityAnimationTransition( | 386 void WmWindowAura::SetVisibilityAnimationTransition( |
| 377 ::wm::WindowVisibilityAnimationTransition transition) { | 387 ::wm::WindowVisibilityAnimationTransition transition) { |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 OnTransientChildAdded(this, Get(transient))); | 834 OnTransientChildAdded(this, Get(transient))); |
| 825 } | 835 } |
| 826 | 836 |
| 827 void WmWindowAura::OnTransientChildRemoved(aura::Window* window, | 837 void WmWindowAura::OnTransientChildRemoved(aura::Window* window, |
| 828 aura::Window* transient) { | 838 aura::Window* transient) { |
| 829 FOR_EACH_OBSERVER(WmTransientWindowObserver, transient_observers_, | 839 FOR_EACH_OBSERVER(WmTransientWindowObserver, transient_observers_, |
| 830 OnTransientChildRemoved(this, Get(transient))); | 840 OnTransientChildRemoved(this, Get(transient))); |
| 831 } | 841 } |
| 832 | 842 |
| 833 } // namespace ash | 843 } // namespace ash |
| OLD | NEW |