| 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_state.h" | 8 #include "ash/common/wm/window_state.h" |
| 9 #include "ash/common/wm_layout_manager.h" | 9 #include "ash/common/wm_layout_manager.h" |
| 10 #include "ash/common/wm_transient_window_observer.h" | 10 #include "ash/common/wm_transient_window_observer.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 bool WmWindowMus::ShouldUseExtendedHitRegion() const { | 152 bool WmWindowMus::ShouldUseExtendedHitRegion() const { |
| 153 const WmWindowMus* parent = Get(window_->parent()); | 153 const WmWindowMus* parent = Get(window_->parent()); |
| 154 return parent && parent->children_use_extended_hit_region_; | 154 return parent && parent->children_use_extended_hit_region_; |
| 155 } | 155 } |
| 156 | 156 |
| 157 bool WmWindowMus::IsContainer() const { | 157 bool WmWindowMus::IsContainer() const { |
| 158 return GetShellWindowId() != kShellWindowId_Invalid; | 158 return GetShellWindowId() != kShellWindowId_Invalid; |
| 159 } | 159 } |
| 160 | 160 |
| 161 void WmWindowMus::Destroy() { |
| 162 window_->Destroy(); |
| 163 // WARNING: this has been deleted. |
| 164 } |
| 165 |
| 161 const WmWindow* WmWindowMus::GetRootWindow() const { | 166 const WmWindow* WmWindowMus::GetRootWindow() const { |
| 162 return Get(window_->GetRoot()); | 167 return Get(window_->GetRoot()); |
| 163 } | 168 } |
| 164 | 169 |
| 165 WmRootWindowController* WmWindowMus::GetRootWindowController() { | 170 WmRootWindowController* WmWindowMus::GetRootWindowController() { |
| 166 return GetRootWindowControllerMus(); | 171 return GetRootWindowControllerMus(); |
| 167 } | 172 } |
| 168 | 173 |
| 169 WmShell* WmWindowMus::GetShell() const { | 174 WmShell* WmWindowMus::GetShell() const { |
| 170 return WmShellMus::Get(); | 175 return WmShellMus::Get(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 192 | 197 |
| 193 void WmWindowMus::SetShellWindowId(int id) { | 198 void WmWindowMus::SetShellWindowId(int id) { |
| 194 shell_window_id_ = id; | 199 shell_window_id_ = id; |
| 195 } | 200 } |
| 196 | 201 |
| 197 int WmWindowMus::GetShellWindowId() const { | 202 int WmWindowMus::GetShellWindowId() const { |
| 198 return shell_window_id_; | 203 return shell_window_id_; |
| 199 } | 204 } |
| 200 | 205 |
| 201 ui::wm::WindowType WmWindowMus::GetType() const { | 206 ui::wm::WindowType WmWindowMus::GetType() const { |
| 202 return GetWmWindowType(window_); | 207 // If the WindowType was expicitly set, then it means |window_| was created |
| 208 // by way of WmShellMus::NewWindow() and the type is locally defined. For |
| 209 // windows created in other ways, say from the client, then we need to get |
| 210 // the type from |window_| directly. |
| 211 return is_wm_window_type_set_ ? wm_window_type_ : GetWmWindowType(window_); |
| 203 } | 212 } |
| 204 | 213 |
| 205 bool WmWindowMus::IsBubble() { | 214 bool WmWindowMus::IsBubble() { |
| 206 return GetWindowType(window_) == ui::mojom::WindowType::BUBBLE; | 215 return GetWindowType(window_) == ui::mojom::WindowType::BUBBLE; |
| 207 } | 216 } |
| 208 | 217 |
| 209 ui::Layer* WmWindowMus::GetLayer() { | 218 ui::Layer* WmWindowMus::GetLayer() { |
| 210 // TODO(sky): this function should be nuked entirely. | 219 // TODO(sky): this function should be nuked entirely. |
| 211 NOTIMPLEMENTED(); | 220 NOTIMPLEMENTED(); |
| 212 return widget_ ? widget_->GetLayer() : nullptr; | 221 return widget_ ? widget_->GetLayer() : nullptr; |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 } else { | 428 } else { |
| 420 layout_manager_adapter_.reset(); | 429 layout_manager_adapter_.reset(); |
| 421 } | 430 } |
| 422 } | 431 } |
| 423 | 432 |
| 424 WmLayoutManager* WmWindowMus::GetLayoutManager() { | 433 WmLayoutManager* WmWindowMus::GetLayoutManager() { |
| 425 return layout_manager_adapter_ ? layout_manager_adapter_->layout_manager() | 434 return layout_manager_adapter_ ? layout_manager_adapter_->layout_manager() |
| 426 : nullptr; | 435 : nullptr; |
| 427 } | 436 } |
| 428 | 437 |
| 438 void WmWindowMus::SetVisibilityChangesAnimated() { |
| 439 // TODO: need animation support: http://crbug.com/615087. |
| 440 NOTIMPLEMENTED(); |
| 441 } |
| 442 |
| 429 void WmWindowMus::SetVisibilityAnimationType(int type) { | 443 void WmWindowMus::SetVisibilityAnimationType(int type) { |
| 430 // TODO: need animation support: http://crbug.com/615087. | 444 // TODO: need animation support: http://crbug.com/615087. |
| 431 NOTIMPLEMENTED(); | 445 NOTIMPLEMENTED(); |
| 432 } | 446 } |
| 433 | 447 |
| 434 void WmWindowMus::SetVisibilityAnimationDuration(base::TimeDelta delta) { | 448 void WmWindowMus::SetVisibilityAnimationDuration(base::TimeDelta delta) { |
| 435 // TODO: need animation support: http://crbug.com/615087. | 449 // TODO: need animation support: http://crbug.com/615087. |
| 436 NOTIMPLEMENTED(); | 450 NOTIMPLEMENTED(); |
| 437 } | 451 } |
| 438 | 452 |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 } | 884 } |
| 871 | 885 |
| 872 void WmWindowMus::OnTransientChildRemoved(ui::Window* window, | 886 void WmWindowMus::OnTransientChildRemoved(ui::Window* window, |
| 873 ui::Window* transient) { | 887 ui::Window* transient) { |
| 874 FOR_EACH_OBSERVER(WmTransientWindowObserver, transient_observers_, | 888 FOR_EACH_OBSERVER(WmTransientWindowObserver, transient_observers_, |
| 875 OnTransientChildRemoved(this, Get(transient))); | 889 OnTransientChildRemoved(this, Get(transient))); |
| 876 } | 890 } |
| 877 | 891 |
| 878 } // namespace mus | 892 } // namespace mus |
| 879 } // namespace ash | 893 } // namespace ash |
| OLD | NEW |