Chromium Code Reviews| 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/mus/bridge/wm_window_mus.h" | 5 #include "ash/mus/bridge/wm_window_mus.h" |
| 6 | 6 |
| 7 #include "ash/common/wm/container_finder.h" | 7 #include "ash/common/wm/container_finder.h" |
| 8 #include "ash/common/wm/window_positioning_utils.h" | 8 #include "ash/common/wm/window_positioning_utils.h" |
| 9 #include "ash/common/wm/window_state.h" | 9 #include "ash/common/wm/window_state.h" |
| 10 #include "ash/common/wm_layout_manager.h" | 10 #include "ash/common/wm_layout_manager.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 bool WmWindowMus::ShouldUseExtendedHitRegion() const { | 154 bool WmWindowMus::ShouldUseExtendedHitRegion() const { |
| 155 const WmWindowMus* parent = Get(window_->parent()); | 155 const WmWindowMus* parent = Get(window_->parent()); |
| 156 return parent && parent->children_use_extended_hit_region_; | 156 return parent && parent->children_use_extended_hit_region_; |
| 157 } | 157 } |
| 158 | 158 |
| 159 bool WmWindowMus::IsContainer() const { | 159 bool WmWindowMus::IsContainer() const { |
| 160 return GetShellWindowId() != kShellWindowId_Invalid; | 160 return GetShellWindowId() != kShellWindowId_Invalid; |
| 161 } | 161 } |
| 162 | 162 |
| 163 void WmWindowMus::Destroy() { | 163 void WmWindowMus::Destroy() { |
| 164 // TODO(sky): to match aura behavior this should delete children. | |
|
James Cook
2016/09/21 22:03:19
Are we going to leak windows at shutdown until thi
sky
2016/09/21 22:47:49
Indeed. Added pointer to bug.
| |
| 164 window_->Destroy(); | 165 window_->Destroy(); |
| 165 // WARNING: this has been deleted. | 166 // WARNING: this has been deleted. |
| 166 } | 167 } |
| 167 | 168 |
| 168 const WmWindow* WmWindowMus::GetRootWindow() const { | 169 const WmWindow* WmWindowMus::GetRootWindow() const { |
| 169 return Get(window_->GetRoot()); | 170 return Get(window_->GetRoot()); |
| 170 } | 171 } |
| 171 | 172 |
| 172 WmRootWindowController* WmWindowMus::GetRootWindowController() { | 173 WmRootWindowController* WmWindowMus::GetRootWindowController() { |
| 173 return GetRootWindowControllerMus(); | 174 return GetRootWindowControllerMus(); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 437 | 438 |
| 438 void WmWindowMus::SetParentUsingContext(WmWindow* context, | 439 void WmWindowMus::SetParentUsingContext(WmWindow* context, |
| 439 const gfx::Rect& screen_bounds) { | 440 const gfx::Rect& screen_bounds) { |
| 440 wm::GetDefaultParent(context, this, screen_bounds)->AddChild(this); | 441 wm::GetDefaultParent(context, this, screen_bounds)->AddChild(this); |
| 441 } | 442 } |
| 442 | 443 |
| 443 void WmWindowMus::AddChild(WmWindow* window) { | 444 void WmWindowMus::AddChild(WmWindow* window) { |
| 444 window_->AddChild(GetMusWindow(window)); | 445 window_->AddChild(GetMusWindow(window)); |
| 445 } | 446 } |
| 446 | 447 |
| 448 void WmWindowMus::RemoveChild(WmWindow* child) { | |
| 449 window_->RemoveChild(GetMusWindow(child)); | |
| 450 } | |
| 451 | |
| 447 const WmWindow* WmWindowMus::GetParent() const { | 452 const WmWindow* WmWindowMus::GetParent() const { |
| 448 return Get(window_->parent()); | 453 return Get(window_->parent()); |
| 449 } | 454 } |
| 450 | 455 |
| 451 const WmWindow* WmWindowMus::GetTransientParent() const { | 456 const WmWindow* WmWindowMus::GetTransientParent() const { |
| 452 return Get(window_->transient_parent()); | 457 return Get(window_->transient_parent()); |
| 453 } | 458 } |
| 454 | 459 |
| 455 std::vector<WmWindow*> WmWindowMus::GetTransientChildren() { | 460 std::vector<WmWindow*> WmWindowMus::GetTransientChildren() { |
| 456 return FromMusWindows(window_->transient_children()); | 461 return FromMusWindows(window_->transient_children()); |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 923 } | 928 } |
| 924 | 929 |
| 925 void WmWindowMus::OnTransientChildRemoved(ui::Window* window, | 930 void WmWindowMus::OnTransientChildRemoved(ui::Window* window, |
| 926 ui::Window* transient) { | 931 ui::Window* transient) { |
| 927 FOR_EACH_OBSERVER(WmTransientWindowObserver, transient_observers_, | 932 FOR_EACH_OBSERVER(WmTransientWindowObserver, transient_observers_, |
| 928 OnTransientChildRemoved(this, Get(transient))); | 933 OnTransientChildRemoved(this, Get(transient))); |
| 929 } | 934 } |
| 930 | 935 |
| 931 } // namespace mus | 936 } // namespace mus |
| 932 } // namespace ash | 937 } // namespace ash |
| OLD | NEW |