Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: ash/mus/bridge/wm_window_mus.cc

Issue 2320273002: Refactors DimWindow and moves to ash/common (Closed)
Patch Set: git add wm_window Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 : window_(window), 104 : window_(window),
105 // Matches aura, see aura::Window for details. 105 // Matches aura, see aura::Window for details.
106 observers_(base::ObserverList<WmWindowObserver>::NOTIFY_EXISTING_ONLY) { 106 observers_(base::ObserverList<WmWindowObserver>::NOTIFY_EXISTING_ONLY) {
107 window_->AddObserver(this); 107 window_->AddObserver(this);
108 window_->SetLocalProperty(kWmWindowKey, this); 108 window_->SetLocalProperty(kWmWindowKey, this);
109 window_state_.reset(new WindowStateMus(this)); 109 window_state_.reset(new WindowStateMus(this));
110 } 110 }
111 111
112 WmWindowMus::~WmWindowMus() { 112 WmWindowMus::~WmWindowMus() {
113 window_->RemoveObserver(this); 113 window_->RemoveObserver(this);
114
115 DestroyUserData();
114 } 116 }
115 117
116 // static 118 // static
117 WmWindowMus* WmWindowMus::Get(ui::Window* window) { 119 WmWindowMus* WmWindowMus::Get(ui::Window* window) {
118 if (!window) 120 if (!window)
119 return nullptr; 121 return nullptr;
120 122
121 WmWindowMus* wm_window = window->GetLocalProperty(kWmWindowKey); 123 WmWindowMus* wm_window = window->GetLocalProperty(kWmWindowKey);
122 if (wm_window) 124 if (wm_window)
123 return wm_window; 125 return wm_window;
(...skipping 27 matching lines...) Expand all
151 153
152 bool WmWindowMus::ShouldUseExtendedHitRegion() const { 154 bool WmWindowMus::ShouldUseExtendedHitRegion() const {
153 const WmWindowMus* parent = Get(window_->parent()); 155 const WmWindowMus* parent = Get(window_->parent());
154 return parent && parent->children_use_extended_hit_region_; 156 return parent && parent->children_use_extended_hit_region_;
155 } 157 }
156 158
157 bool WmWindowMus::IsContainer() const { 159 bool WmWindowMus::IsContainer() const {
158 return GetShellWindowId() != kShellWindowId_Invalid; 160 return GetShellWindowId() != kShellWindowId_Invalid;
159 } 161 }
160 162
163 void WmWindowMus::Destroy() {
164 window_->Destroy();
165 }
166
161 const WmWindow* WmWindowMus::GetRootWindow() const { 167 const WmWindow* WmWindowMus::GetRootWindow() const {
162 return Get(window_->GetRoot()); 168 return Get(window_->GetRoot());
163 } 169 }
164 170
165 WmRootWindowController* WmWindowMus::GetRootWindowController() { 171 WmRootWindowController* WmWindowMus::GetRootWindowController() {
166 return GetRootWindowControllerMus(); 172 return GetRootWindowControllerMus();
167 } 173 }
168 174
169 WmShell* WmWindowMus::GetShell() const { 175 WmShell* WmWindowMus::GetShell() const {
170 return WmShellMus::Get(); 176 return WmShellMus::Get();
(...skipping 21 matching lines...) Expand all
192 198
193 void WmWindowMus::SetShellWindowId(int id) { 199 void WmWindowMus::SetShellWindowId(int id) {
194 shell_window_id_ = id; 200 shell_window_id_ = id;
195 } 201 }
196 202
197 int WmWindowMus::GetShellWindowId() const { 203 int WmWindowMus::GetShellWindowId() const {
198 return shell_window_id_; 204 return shell_window_id_;
199 } 205 }
200 206
201 ui::wm::WindowType WmWindowMus::GetType() const { 207 ui::wm::WindowType WmWindowMus::GetType() const {
202 return GetWmWindowType(window_); 208 return is_wm_window_type_set_ ? wm_window_type_ : GetWmWindowType(window_);
James Cook 2016/09/09 00:03:36 Is it not sufficient to return wm_window_type_ if
sky 2016/09/09 03:50:04 Ya, sorry, this is mildly confusing. I added a com
203 } 209 }
204 210
205 bool WmWindowMus::IsBubble() { 211 bool WmWindowMus::IsBubble() {
206 return GetWindowType(window_) == ui::mojom::WindowType::BUBBLE; 212 return GetWindowType(window_) == ui::mojom::WindowType::BUBBLE;
207 } 213 }
208 214
209 ui::Layer* WmWindowMus::GetLayer() { 215 ui::Layer* WmWindowMus::GetLayer() {
210 // TODO(sky): this function should be nuked entirely. 216 // TODO(sky): this function should be nuked entirely.
211 NOTIMPLEMENTED(); 217 NOTIMPLEMENTED();
212 return widget_ ? widget_->GetLayer() : nullptr; 218 return widget_ ? widget_->GetLayer() : nullptr;
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 } else { 425 } else {
420 layout_manager_adapter_.reset(); 426 layout_manager_adapter_.reset();
421 } 427 }
422 } 428 }
423 429
424 WmLayoutManager* WmWindowMus::GetLayoutManager() { 430 WmLayoutManager* WmWindowMus::GetLayoutManager() {
425 return layout_manager_adapter_ ? layout_manager_adapter_->layout_manager() 431 return layout_manager_adapter_ ? layout_manager_adapter_->layout_manager()
426 : nullptr; 432 : nullptr;
427 } 433 }
428 434
435 void WmWindowMus::SetVisibilityChangesAnimated() {
436 // TODO: need animation support: http://crbug.com/615087.
437 NOTIMPLEMENTED();
438 }
439
429 void WmWindowMus::SetVisibilityAnimationType(int type) { 440 void WmWindowMus::SetVisibilityAnimationType(int type) {
430 // TODO: need animation support: http://crbug.com/615087. 441 // TODO: need animation support: http://crbug.com/615087.
431 NOTIMPLEMENTED(); 442 NOTIMPLEMENTED();
432 } 443 }
433 444
434 void WmWindowMus::SetVisibilityAnimationDuration(base::TimeDelta delta) { 445 void WmWindowMus::SetVisibilityAnimationDuration(base::TimeDelta delta) {
435 // TODO: need animation support: http://crbug.com/615087. 446 // TODO: need animation support: http://crbug.com/615087.
436 NOTIMPLEMENTED(); 447 NOTIMPLEMENTED();
437 } 448 }
438 449
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 } 881 }
871 882
872 void WmWindowMus::OnTransientChildRemoved(ui::Window* window, 883 void WmWindowMus::OnTransientChildRemoved(ui::Window* window,
873 ui::Window* transient) { 884 ui::Window* transient) {
874 FOR_EACH_OBSERVER(WmTransientWindowObserver, transient_observers_, 885 FOR_EACH_OBSERVER(WmTransientWindowObserver, transient_observers_,
875 OnTransientChildRemoved(this, Get(transient))); 886 OnTransientChildRemoved(this, Get(transient)));
876 } 887 }
877 888
878 } // namespace mus 889 } // namespace mus
879 } // namespace ash 890 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698