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

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

Issue 2539363005: Converts ash to use aura-mus (Closed)
Patch Set: feedback2 Created 4 years 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/shelf/shelf_item_types.h" 7 #include "ash/common/shelf/shelf_item_types.h"
8 #include "ash/common/wm/container_finder.h" 8 #include "ash/common/wm/container_finder.h"
9 #include "ash/common/wm/window_positioning_utils.h" 9 #include "ash/common/wm/window_positioning_utils.h"
10 #include "ash/common/wm/window_state.h" 10 #include "ash/common/wm/window_state.h"
11 #include "ash/common/wm_layout_manager.h" 11 #include "ash/common/wm_layout_manager.h"
12 #include "ash/common/wm_lookup.h" 12 #include "ash/common/wm_lookup.h"
13 #include "ash/common/wm_transient_window_observer.h" 13 #include "ash/common/wm_transient_window_observer.h"
14 #include "ash/common/wm_window_observer.h" 14 #include "ash/common/wm_window_observer.h"
15 #include "ash/common/wm_window_property.h" 15 #include "ash/common/wm_window_property.h"
16 #include "ash/mus/bridge/mus_layout_manager_adapter.h" 16 #include "ash/mus/bridge/mus_layout_manager_adapter.h"
17 #include "ash/mus/bridge/wm_root_window_controller_mus.h" 17 #include "ash/mus/bridge/wm_root_window_controller_mus.h"
18 #include "ash/mus/bridge/wm_shell_mus.h" 18 #include "ash/mus/bridge/wm_shell_mus.h"
19 #include "ash/mus/property_util.h" 19 #include "ash/mus/property_util.h"
20 #include "services/ui/public/cpp/property_type_converters.h" 20 #include "ash/mus/window_manager.h"
21 #include "services/ui/public/cpp/window.h" 21 #include "ash/public/cpp/shell_window_ids.h"
22 #include "services/ui/public/cpp/window_property.h" 22 #include "ash/wm/window_properties.h"
23 #include "services/ui/public/cpp/window_tree_client.h"
24 #include "services/ui/public/interfaces/window_manager.mojom.h" 23 #include "services/ui/public/interfaces/window_manager.mojom.h"
25 #include "ui/aura/mus/mus_util.h" 24 #include "ui/aura/client/aura_constants.h"
25 #include "ui/aura/mus/window_manager_delegate.h"
26 #include "ui/aura/mus/window_mus.h"
27 #include "ui/aura/mus/window_tree_client.h"
26 #include "ui/aura/window.h" 28 #include "ui/aura/window.h"
27 #include "ui/base/hit_test.h" 29 #include "ui/base/hit_test.h"
28 #include "ui/display/display.h" 30 #include "ui/display/display.h"
29 #include "ui/resources/grit/ui_resources.h" 31 #include "ui/resources/grit/ui_resources.h"
30 #include "ui/views/view.h" 32 #include "ui/views/view.h"
31 #include "ui/views/widget/widget.h" 33 #include "ui/views/widget/widget.h"
32 #include "ui/views/widget/widget_delegate.h" 34 #include "ui/views/widget/widget_delegate.h"
33 35
34 MUS_DECLARE_WINDOW_PROPERTY_TYPE(ash::mus::WmWindowMus*);
35
36 namespace {
37
38 MUS_DEFINE_OWNED_WINDOW_PROPERTY_KEY(ash::mus::WmWindowMus,
39 kWmWindowKey,
40 nullptr);
41
42 } // namespace
43
44 namespace ash { 36 namespace ash {
45 namespace mus { 37 namespace mus {
46 38
47 namespace { 39 // static
40 bool WmWindowMus::default_use_empty_minimum_size_for_testing_ = false;
48 41
49 // This class is used so that the WindowState constructor can be made protected. 42 WmWindowMus::WmWindowMus(aura::Window* window)
50 // GetWindowState() is the only place that should be creating WindowState. 43 : WmWindowAura(window),
51 class WindowStateMus : public wm::WindowState { 44 use_empty_minimum_size_for_testing_(
52 public: 45 default_use_empty_minimum_size_for_testing_) {}
53 explicit WindowStateMus(WmWindow* window) : wm::WindowState(window) {}
54 ~WindowStateMus() override {}
55 46
56 private: 47 WmWindowMus::~WmWindowMus() {}
57 DISALLOW_COPY_AND_ASSIGN(WindowStateMus);
58 };
59
60 ui::WindowShowState UIWindowShowStateFromMojom(ui::mojom::ShowState state) {
61 switch (state) {
62 case ui::mojom::ShowState::DEFAULT:
63 return ui::SHOW_STATE_DEFAULT;
64 case ui::mojom::ShowState::NORMAL:
65 return ui::SHOW_STATE_NORMAL;
66 case ui::mojom::ShowState::MINIMIZED:
67 return ui::SHOW_STATE_MINIMIZED;
68 case ui::mojom::ShowState::MAXIMIZED:
69 return ui::SHOW_STATE_MAXIMIZED;
70 case ui::mojom::ShowState::INACTIVE:
71 return ui::SHOW_STATE_INACTIVE;
72 case ui::mojom::ShowState::FULLSCREEN:
73 return ui::SHOW_STATE_FULLSCREEN;
74 case ui::mojom::ShowState::DOCKED:
75 return ui::SHOW_STATE_DOCKED;
76 default:
77 break;
78 }
79 return ui::SHOW_STATE_DEFAULT;
80 }
81
82 ui::mojom::ShowState MojomWindowShowStateFromUI(ui::WindowShowState state) {
83 switch (state) {
84 case ui::SHOW_STATE_DEFAULT:
85 return ui::mojom::ShowState::DEFAULT;
86 case ui::SHOW_STATE_NORMAL:
87 return ui::mojom::ShowState::NORMAL;
88 case ui::SHOW_STATE_MINIMIZED:
89 return ui::mojom::ShowState::MINIMIZED;
90 case ui::SHOW_STATE_MAXIMIZED:
91 return ui::mojom::ShowState::MAXIMIZED;
92 case ui::SHOW_STATE_INACTIVE:
93 return ui::mojom::ShowState::INACTIVE;
94 case ui::SHOW_STATE_FULLSCREEN:
95 return ui::mojom::ShowState::FULLSCREEN;
96 case ui::SHOW_STATE_DOCKED:
97 return ui::mojom::ShowState::DOCKED;
98 default:
99 break;
100 }
101 return ui::mojom::ShowState::DEFAULT;
102 }
103
104 // Returns the WmWindowProperty enum value for the given ui::Window key name.
105 WmWindowProperty WmWindowPropertyFromUI(const std::string& ui_window_key) {
106 if (ui_window_key == ui::mojom::WindowManager::kAlwaysOnTop_Property)
107 return WmWindowProperty::ALWAYS_ON_TOP;
108 if (ui_window_key == ui::mojom::WindowManager::kExcludeFromMru_Property)
109 return WmWindowProperty::EXCLUDE_FROM_MRU;
110 if (ui_window_key == ui::mojom::WindowManager::kShelfItemType_Property)
111 return WmWindowProperty::SHELF_ITEM_TYPE;
112 return WmWindowProperty::INVALID_PROPERTY;
113 }
114
115 } // namespace
116
117 WmWindowMus::WmWindowMus(ui::Window* window)
118 : window_(window),
119 // Matches aura, see aura::Window for details.
120 observers_(base::ObserverList<WmWindowObserver>::NOTIFY_EXISTING_ONLY) {
121 window_->AddObserver(this);
122 window_->SetLocalProperty(kWmWindowKey, this);
123 window_state_.reset(new WindowStateMus(this));
124 }
125
126 WmWindowMus::~WmWindowMus() {
127 window_->RemoveObserver(this);
128 }
129 48
130 // static 49 // static
131 const WmWindowMus* WmWindowMus::Get(const ui::Window* window) { 50 const WmWindowMus* WmWindowMus::Get(const aura::Window* window) {
132 if (!window) 51 if (!window)
133 return nullptr; 52 return nullptr;
134 53
135 const WmWindowMus* wm_window = window->GetLocalProperty(kWmWindowKey); 54 if (HasInstance(window))
136 if (wm_window) 55 return static_cast<const WmWindowMus*>(WmWindowAura::Get(window));
137 return wm_window; 56
138 // WmWindowMus is owned by the ui::Window. 57 // WmWindowMus is owned by the aura::Window.
139 // Unfortunately there isn't a good way to avoid the cast here. 58 // Unfortunately there isn't a good way to avoid the cast here.
140 return new WmWindowMus(const_cast<ui::Window*>(window)); 59 return new WmWindowMus(const_cast<aura::Window*>(window));
141 } 60 }
142 61
143 // static 62 // static
144 WmWindowMus* WmWindowMus::Get(views::Widget* widget) { 63 WmWindowMus* WmWindowMus::Get(views::Widget* widget) {
145 return WmWindowMus::Get(aura::GetMusWindow(widget->GetNativeView())); 64 return WmWindowMus::Get(widget->GetNativeView());
146 }
147
148 // static
149 const ui::Window* WmWindowMus::GetMusWindow(const WmWindow* wm_window) {
150 return static_cast<const WmWindowMus*>(wm_window)->mus_window();
151 }
152
153 // static
154 std::vector<WmWindow*> WmWindowMus::FromMusWindows(
155 const std::vector<ui::Window*>& mus_windows) {
156 std::vector<WmWindow*> result(mus_windows.size());
157 for (size_t i = 0; i < mus_windows.size(); ++i)
158 result[i] = Get(mus_windows[i]);
159 return result;
160 } 65 }
161 66
162 const WmRootWindowControllerMus* WmWindowMus::GetRootWindowControllerMus() 67 const WmRootWindowControllerMus* WmWindowMus::GetRootWindowControllerMus()
163 const { 68 const {
164 return WmRootWindowControllerMus::Get(window_->GetRoot()); 69 return WmRootWindowControllerMus::Get(aura_window()->GetRootWindow());
165 } 70 }
166 71
167 bool WmWindowMus::ShouldUseExtendedHitRegion() const { 72 bool WmWindowMus::ShouldUseExtendedHitRegion() const {
168 const WmWindowMus* parent = Get(window_->parent()); 73 const WmWindowMus* parent = Get(aura_window()->parent());
169 return parent && parent->children_use_extended_hit_region_; 74 return parent && parent->children_use_extended_hit_region_;
170 } 75 }
171 76
172 bool WmWindowMus::IsContainer() const { 77 bool WmWindowMus::IsContainer() const {
173 return GetShellWindowId() != kShellWindowId_Invalid; 78 return GetShellWindowId() != kShellWindowId_Invalid;
174 } 79 }
175 80
176 void WmWindowMus::Destroy() {
177 // TODO(sky): to match aura behavior this should delete children.
178 // http://crbug.com/647513.
179 window_->Destroy();
180 // WARNING: this has been deleted.
181 }
182
183 const WmWindow* WmWindowMus::GetRootWindow() const { 81 const WmWindow* WmWindowMus::GetRootWindow() const {
184 return Get(window_->GetRoot()); 82 return Get(aura_window()->GetRootWindow());
185 } 83 }
186 84
187 WmRootWindowController* WmWindowMus::GetRootWindowController() { 85 WmRootWindowController* WmWindowMus::GetRootWindowController() {
188 return GetRootWindowControllerMus(); 86 return GetRootWindowControllerMus();
189 } 87 }
190 88
191 WmShell* WmWindowMus::GetShell() const { 89 WmShell* WmWindowMus::GetShell() const {
192 return WmShellMus::Get(); 90 return WmShellMus::Get();
193 } 91 }
194 92
195 void WmWindowMus::SetName(const char* name) {
196 if (name) {
197 window_->SetSharedProperty<std::string>(
198 ui::mojom::WindowManager::kName_Property, std::string(name));
199 } else {
200 window_->ClearSharedProperty(ui::mojom::WindowManager::kName_Property);
201 }
202 }
203
204 std::string WmWindowMus::GetName() const {
205 return window_->HasSharedProperty(ui::mojom::WindowManager::kName_Property)
206 ? window_->GetSharedProperty<std::string>(
207 ui::mojom::WindowManager::kName_Property)
208 : std::string();
209 }
210
211 void WmWindowMus::SetTitle(const base::string16& title) {
212 SetWindowTitle(window_, title);
213 }
214
215 base::string16 WmWindowMus::GetTitle() const {
216 return GetWindowTitle(window_);
217 }
218
219 void WmWindowMus::SetShellWindowId(int id) {
220 shell_window_id_ = id;
221 }
222
223 int WmWindowMus::GetShellWindowId() const {
224 return shell_window_id_;
225 }
226
227 ui::wm::WindowType WmWindowMus::GetType() const {
228 // If the WindowType was expicitly set, then it means |window_| was created
229 // by way of WmShellMus::NewWindow() and the type is locally defined. For
230 // windows created in other ways, say from the client, then we need to get
231 // the type from |window_| directly.
232 return is_wm_window_type_set_ ? wm_window_type_ : GetWmWindowType(window_);
233 }
234
235 int WmWindowMus::GetAppType() const {
236 // TODO: Need support for window property kAppType: http://crbug.com/651206.
237 NOTIMPLEMENTED();
238 return 0;
239 }
240
241 void WmWindowMus::SetAppType(int app_type) const {
242 // TODO: Need support for window property kAppType: http://crbug.com/651206.
243 NOTIMPLEMENTED();
244 }
245
246 bool WmWindowMus::IsBubble() { 93 bool WmWindowMus::IsBubble() {
247 return GetWindowType(window_) == ui::mojom::WindowType::BUBBLE; 94 return aura_window()->GetProperty(aura::client::kWindowTypeKey) ==
248 } 95 ui::mojom::WindowType::BUBBLE;
249
250 ui::Layer* WmWindowMus::GetLayer() {
251 // TODO: http://crbug.com/652877.
252 NOTIMPLEMENTED();
253 return widget_ ? widget_->GetLayer() : nullptr;
254 }
255
256 bool WmWindowMus::GetLayerTargetVisibility() {
257 // TODO: http://crbug.com/652877.
258 NOTIMPLEMENTED();
259 return GetTargetVisibility();
260 }
261
262 bool WmWindowMus::GetLayerVisible() {
263 // TODO: http://crbug.com/652877.
264 NOTIMPLEMENTED();
265 return IsVisible();
266 }
267
268 display::Display WmWindowMus::GetDisplayNearestWindow() {
269 // TODO(sky): deal with null rwc.
270 return GetRootWindowControllerMus()->GetDisplay();
271 } 96 }
272 97
273 bool WmWindowMus::HasNonClientArea() { 98 bool WmWindowMus::HasNonClientArea() {
274 return widget_ ? true : false; 99 return widget_ ? true : false;
275 } 100 }
276 101
277 int WmWindowMus::GetNonClientComponent(const gfx::Point& location) { 102 int WmWindowMus::GetNonClientComponent(const gfx::Point& location) {
278 return widget_ ? widget_->GetNonClientComponent(location) : HTNOWHERE; 103 return widget_ ? widget_->GetNonClientComponent(location) : HTNOWHERE;
279 } 104 }
280 105
281 gfx::Point WmWindowMus::ConvertPointToTarget(const WmWindow* target,
282 const gfx::Point& point) const {
283 const ui::Window* target_window = GetMusWindow(target);
284 if (target_window->Contains(window_)) {
285 gfx::Point result(point);
286 const ui::Window* window = window_;
287 while (window != target_window) {
288 result += window->bounds().origin().OffsetFromOrigin();
289 window = window->parent();
290 }
291 return result;
292 }
293 if (window_->Contains(target_window)) {
294 gfx::Point result(point);
295 result -=
296 target->ConvertPointToTarget(this, gfx::Point()).OffsetFromOrigin();
297 return result;
298 }
299 // Different roots.
300 gfx::Point point_in_screen =
301 GetRootWindowControllerMus()->ConvertPointToScreen(this, point);
302 return AsWmWindowMus(target)
303 ->GetRootWindowControllerMus()
304 ->ConvertPointFromScreen(AsWmWindowMus(target), point_in_screen);
305 }
306
307 gfx::Point WmWindowMus::ConvertPointToScreen(const gfx::Point& point) const {
308 return GetRootWindowControllerMus()->ConvertPointToScreen(this, point);
309 }
310
311 gfx::Point WmWindowMus::ConvertPointFromScreen(const gfx::Point& point) const {
312 return GetRootWindowControllerMus()->ConvertPointFromScreen(this, point);
313 }
314
315 gfx::Rect WmWindowMus::ConvertRectToScreen(const gfx::Rect& rect) const {
316 return gfx::Rect(ConvertPointToScreen(rect.origin()), rect.size());
317 }
318
319 gfx::Rect WmWindowMus::ConvertRectFromScreen(const gfx::Rect& rect) const {
320 return gfx::Rect(ConvertPointFromScreen(rect.origin()), rect.size());
321 }
322
323 gfx::Size WmWindowMus::GetMinimumSize() const { 106 gfx::Size WmWindowMus::GetMinimumSize() const {
324 return widget_ && !use_empty_minimum_size_for_testing_ 107 return widget_ && !use_empty_minimum_size_for_testing_
325 ? widget_->GetMinimumSize() 108 ? widget_->GetMinimumSize()
326 : gfx::Size(); 109 : gfx::Size();
327 } 110 }
328 111
329 gfx::Size WmWindowMus::GetMaximumSize() const { 112 gfx::Size WmWindowMus::GetMaximumSize() const {
330 return widget_ ? widget_->GetMaximumSize() : gfx::Size(); 113 return widget_ ? widget_->GetMaximumSize() : gfx::Size();
331 } 114 }
332 115
333 bool WmWindowMus::GetTargetVisibility() const {
334 // TODO: need animation support: http://crbug.com/615087.
335 NOTIMPLEMENTED();
336 return window_->visible();
337 }
338
339 bool WmWindowMus::IsVisible() const {
340 return window_->visible();
341 }
342
343 void WmWindowMus::SetOpacity(float opacity) {
344 window_->SetOpacity(opacity);
345 }
346
347 float WmWindowMus::GetTargetOpacity() const {
348 // TODO: need animation support: http://crbug.com/615087.
349 return window_->opacity();
350 }
351
352 gfx::Rect WmWindowMus::GetMinimizeAnimationTargetBoundsInScreen() const { 116 gfx::Rect WmWindowMus::GetMinimizeAnimationTargetBoundsInScreen() const {
353 // TODO: need animation support: http://crbug.com/615087. 117 // TODO: need animation support: http://crbug.com/615087.
354 NOTIMPLEMENTED(); 118 NOTIMPLEMENTED();
355 return GetBoundsInScreen(); 119 return GetBoundsInScreen();
356 } 120 }
357 121
358 void WmWindowMus::SetTransform(const gfx::Transform& transform) {
359 // TODO: mus needs to support transforms: http://crbug.com/615089.
360 NOTIMPLEMENTED();
361 }
362
363 gfx::Transform WmWindowMus::GetTargetTransform() const {
364 // TODO: need animation support: http://crbug.com/615087.
365 return gfx::Transform();
366 }
367
368 bool WmWindowMus::IsSystemModal() const { 122 bool WmWindowMus::IsSystemModal() const {
369 NOTIMPLEMENTED(); 123 NOTIMPLEMENTED();
370 return false; 124 return false;
371 } 125 }
372 126
373 bool WmWindowMus::GetBoolProperty(WmWindowProperty key) { 127 bool WmWindowMus::GetBoolProperty(WmWindowProperty key) {
374 switch (key) { 128 switch (key) {
375 case WmWindowProperty::ALWAYS_ON_TOP:
376 return IsAlwaysOnTop();
377
378 case WmWindowProperty::DRAW_ATTENTION:
379 NOTIMPLEMENTED();
380 return false;
381
382 case WmWindowProperty::EXCLUDE_FROM_MRU:
383 return GetExcludeFromMru(window_);
384
385 case WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY: 129 case WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY:
386 return snap_children_to_pixel_boundary_; 130 return snap_children_to_pixel_boundary_;
387 131
388 default: 132 default:
389 NOTREACHED();
390 break; 133 break;
391 } 134 }
392 135
393 NOTREACHED(); 136 return WmWindowAura::GetBoolProperty(key);
394 return false;
395 }
396
397 SkColor WmWindowMus::GetColorProperty(WmWindowProperty key) {
398 if (key == WmWindowProperty::TOP_VIEW_COLOR) {
399 // TODO: need support for TOP_VIEW_COLOR: http://crbug.com/615100.
400 NOTIMPLEMENTED();
401 return 0;
402 }
403
404 NOTREACHED();
405 return 0;
406 }
407
408 void WmWindowMus::SetColorProperty(WmWindowProperty key, SkColor value) {
409 if (key == WmWindowProperty::TOP_VIEW_COLOR) {
410 // TODO: need support for TOP_VIEW_COLOR: http://crbug.com/615100.
411 NOTIMPLEMENTED();
412 return;
413 }
414
415 NOTREACHED();
416 } 137 }
417 138
418 int WmWindowMus::GetIntProperty(WmWindowProperty key) { 139 int WmWindowMus::GetIntProperty(WmWindowProperty key) {
419 if (key == WmWindowProperty::MODAL_TYPE) { 140 if (key == WmWindowProperty::SHELF_ITEM_TYPE) {
420 // TODO: WindowTree::SetModalWindow() needs to route through WindowManager 141 if (aura_window()->GetProperty(kShelfItemTypeKey) != TYPE_UNDEFINED)
421 // so wm can position. http://crbug.com/645996. 142 return aura_window()->GetProperty(kShelfItemTypeKey);
422 NOTIMPLEMENTED(); 143
423 return static_cast<int>(ui::MODAL_TYPE_NONE); 144 // Mash provides a default shelf item type for non-ignored windows.
145 return GetWindowState()->ignored_by_shelf() ? TYPE_UNDEFINED : TYPE_APP;
424 } 146 }
425 147
426 if (key == WmWindowProperty::SHELF_ID) { 148 return WmWindowAura::GetIntProperty(key);
427 if (window_->HasSharedProperty(
428 ui::mojom::WindowManager::kShelfId_Property)) {
429 return window_->GetSharedProperty<int>(
430 ui::mojom::WindowManager::kShelfId_Property);
431 }
432
433 return kInvalidShelfID;
434 }
435
436 if (key == WmWindowProperty::SHELF_ITEM_TYPE) {
437 if (window_->HasSharedProperty(
438 ui::mojom::WindowManager::kShelfItemType_Property)) {
439 return window_->GetSharedProperty<int>(
440 ui::mojom::WindowManager::kShelfItemType_Property);
441 }
442 // Mash provides a default shelf item type for non-ignored windows.
443 return GetWindowIgnoredByShelf(window_) ? TYPE_UNDEFINED : TYPE_APP;
444 }
445
446 if (key == WmWindowProperty::TOP_VIEW_INSET) {
447 // TODO: need support for TOP_VIEW_INSET: http://crbug.com/615100.
448 NOTIMPLEMENTED();
449 return 0;
450 }
451
452 NOTREACHED();
453 return 0;
454 }
455
456 void WmWindowMus::SetIntProperty(WmWindowProperty key, int value) {
457 if (key == WmWindowProperty::SHELF_ID) {
458 window_->SetSharedProperty<int>(ui::mojom::WindowManager::kShelfId_Property,
459 value);
460 return;
461 }
462
463 if (key == WmWindowProperty::SHELF_ITEM_TYPE) {
464 window_->SetSharedProperty<int>(
465 ui::mojom::WindowManager::kShelfItemType_Property, value);
466 return;
467 }
468
469 if (key == WmWindowProperty::TOP_VIEW_INSET) {
470 // TODO: need support for TOP_VIEW_INSET: http://crbug.com/615100.
471 NOTIMPLEMENTED();
472 return;
473 }
474
475 NOTREACHED();
476 }
477
478 std::string WmWindowMus::GetStringProperty(WmWindowProperty key) {
479 NOTIMPLEMENTED();
480 return std::string();
481 }
482
483 void WmWindowMus::SetStringProperty(WmWindowProperty key,
484 const std::string& value) {
485 NOTIMPLEMENTED();
486 }
487
488 gfx::ImageSkia WmWindowMus::GetWindowIcon() {
489 NOTIMPLEMENTED();
490 return gfx::ImageSkia();
491 }
492
493 gfx::ImageSkia WmWindowMus::GetAppIcon() {
494 NOTIMPLEMENTED();
495 return gfx::ImageSkia();
496 }
497
498 const wm::WindowState* WmWindowMus::GetWindowState() const {
499 return window_state_.get();
500 } 149 }
501 150
502 WmWindow* WmWindowMus::GetToplevelWindow() { 151 WmWindow* WmWindowMus::GetToplevelWindow() {
503 return WmShellMus::GetToplevelAncestor(window_); 152 return WmShellMus::GetToplevelAncestor(aura_window());
504 } 153 }
505 154
506 WmWindow* WmWindowMus::GetToplevelWindowForFocus() { 155 WmWindow* WmWindowMus::GetToplevelWindowForFocus() {
507 // TODO(sky): resolve if we really need two notions of top-level. In the mus 156 // TODO(sky): resolve if we really need two notions of top-level. In the mus
508 // world they are the same. 157 // world they are the same.
509 return WmShellMus::GetToplevelAncestor(window_); 158 return WmShellMus::GetToplevelAncestor(aura_window());
510 } 159 }
511 160
512 void WmWindowMus::SetParentUsingContext(WmWindow* context, 161 // TODO(sky): investigate if needed.
513 const gfx::Rect& screen_bounds) {
514 wm::GetDefaultParent(context, this, screen_bounds)->AddChild(this);
515 }
516
517 void WmWindowMus::AddChild(WmWindow* window) {
518 window_->AddChild(GetMusWindow(window));
519 }
520
521 void WmWindowMus::RemoveChild(WmWindow* child) {
522 window_->RemoveChild(GetMusWindow(child));
523 }
524
525 const WmWindow* WmWindowMus::GetParent() const {
526 return Get(window_->parent());
527 }
528
529 const WmWindow* WmWindowMus::GetTransientParent() const {
530 return Get(window_->transient_parent());
531 }
532
533 std::vector<WmWindow*> WmWindowMus::GetTransientChildren() {
534 return FromMusWindows(window_->transient_children());
535 }
536
537 bool WmWindowMus::MoveToEventRoot(const ui::Event& event) { 162 bool WmWindowMus::MoveToEventRoot(const ui::Event& event) {
538 views::View* target = static_cast<views::View*>(event.target()); 163 views::View* target = static_cast<views::View*>(event.target());
539 if (!target) 164 if (!target)
540 return false; 165 return false;
541 WmWindow* target_root = 166 WmWindow* target_root =
542 WmLookup::Get()->GetWindowForWidget(target->GetWidget())->GetRootWindow(); 167 WmLookup::Get()->GetWindowForWidget(target->GetWidget())->GetRootWindow();
543 if (!target_root || target_root == GetRootWindow()) 168 if (!target_root || target_root == GetRootWindow())
544 return false; 169 return false;
545 WmWindow* window_container = 170 WmWindow* window_container =
546 target_root->GetChildByShellWindowId(GetParent()->GetShellWindowId()); 171 target_root->GetChildByShellWindowId(GetParent()->GetShellWindowId());
547 window_container->AddChild(this); 172 window_container->AddChild(this);
548 return true; 173 return true;
549 } 174 }
550 175
551 void WmWindowMus::SetLayoutManager( 176 // TODO(sky): investigate if needed.
552 std::unique_ptr<WmLayoutManager> layout_manager) {
553 if (layout_manager) {
554 layout_manager_adapter_.reset(
555 new MusLayoutManagerAdapter(window_, std::move(layout_manager)));
556 } else {
557 layout_manager_adapter_.reset();
558 }
559 }
560
561 WmLayoutManager* WmWindowMus::GetLayoutManager() {
562 return layout_manager_adapter_ ? layout_manager_adapter_->layout_manager()
563 : nullptr;
564 }
565
566 void WmWindowMus::SetVisibilityChangesAnimated() {
567 // TODO: need animation support: http://crbug.com/615087.
568 NOTIMPLEMENTED();
569 }
570
571 void WmWindowMus::SetVisibilityAnimationType(int type) {
572 // TODO: need animation support: http://crbug.com/615087.
573 NOTIMPLEMENTED();
574 }
575
576 void WmWindowMus::SetVisibilityAnimationDuration(base::TimeDelta delta) {
577 // TODO: need animation support: http://crbug.com/615087.
578 NOTIMPLEMENTED();
579 }
580
581 void WmWindowMus::SetVisibilityAnimationTransition(
582 ::wm::WindowVisibilityAnimationTransition transition) {
583 // TODO: need animation support: http://crbug.com/615087.
584 NOTIMPLEMENTED();
585 }
586
587 void WmWindowMus::Animate(::wm::WindowAnimationType type) {
588 // TODO: need animation support: http://crbug.com/615087.
589 NOTIMPLEMENTED();
590 }
591
592 void WmWindowMus::StopAnimatingProperty(
593 ui::LayerAnimationElement::AnimatableProperty property) {
594 // TODO: need animation support: http://crbug.com/615087.
595 NOTIMPLEMENTED();
596 }
597
598 void WmWindowMus::SetChildWindowVisibilityChangesAnimated() {
599 // TODO: need animation support: http://crbug.com/615087.
600 NOTIMPLEMENTED();
601 }
602
603 void WmWindowMus::SetMasksToBounds(bool value) {
604 // TODO: mus needs mask to bounds support: http://crbug.com/615550.
605 NOTIMPLEMENTED();
606 }
607
608 void WmWindowMus::SetBounds(const gfx::Rect& bounds) {
609 if (window_->parent()) {
610 WmWindowMus* parent = WmWindowMus::Get(window_->parent());
611 if (parent->layout_manager_adapter_) {
612 parent->layout_manager_adapter_->layout_manager()->SetChildBounds(this,
613 bounds);
614 return;
615 }
616 }
617 SetBoundsDirect(bounds);
618 }
619
620 void WmWindowMus::SetBoundsWithTransitionDelay(const gfx::Rect& bounds,
621 base::TimeDelta delta) {
622 // TODO: need animation support: http://crbug.com/615087.
623 NOTIMPLEMENTED();
624 SetBounds(bounds);
625 }
626
627 void WmWindowMus::SetBoundsDirect(const gfx::Rect& bounds) {
628 window_->SetBounds(bounds);
629 SnapToPixelBoundaryIfNecessary();
630 }
631
632 void WmWindowMus::SetBoundsDirectAnimated(const gfx::Rect& bounds) {
633 // TODO: need animation support: http://crbug.com/615087.
634 NOTIMPLEMENTED();
635 SetBoundsDirect(bounds);
636 }
637
638 void WmWindowMus::SetBoundsDirectCrossFade(const gfx::Rect& bounds) {
639 // TODO: need animation support: http://crbug.com/615087.
640 NOTIMPLEMENTED();
641 SetBoundsDirect(bounds);
642 }
643
644 void WmWindowMus::SetBoundsInScreen(const gfx::Rect& bounds_in_screen, 177 void WmWindowMus::SetBoundsInScreen(const gfx::Rect& bounds_in_screen,
645 const display::Display& dst_display) { 178 const display::Display& dst_display) {
646 DCHECK(GetParent()); // Aura code assumed a parent, so this does too. 179 DCHECK(GetParent()); // Aura code assumed a parent, so this does too.
647 if (static_cast<const WmWindowMus*>(GetParent()) 180 if (static_cast<const WmWindowMus*>(GetParent())
648 ->child_bounds_in_screen_behavior_ == 181 ->child_bounds_in_screen_behavior_ ==
649 BoundsInScreenBehavior::USE_LOCAL_COORDINATES) { 182 BoundsInScreenBehavior::USE_LOCAL_COORDINATES) {
650 SetBounds(bounds_in_screen); 183 SetBounds(bounds_in_screen);
651 return; 184 return;
652 } 185 }
653 wm::SetBoundsInScreen(this, bounds_in_screen, dst_display); 186 wm::SetBoundsInScreen(this, bounds_in_screen, dst_display);
654 } 187 }
655 188
656 gfx::Rect WmWindowMus::GetBoundsInScreen() const { 189 // TODO(sky): remove this override.
657 return ConvertRectToScreen(gfx::Rect(window_->bounds().size()));
658 }
659
660 const gfx::Rect& WmWindowMus::GetBounds() const {
661 return window_->bounds();
662 }
663
664 gfx::Rect WmWindowMus::GetTargetBounds() {
665 // TODO: need animation support: http://crbug.com/615087.
666 NOTIMPLEMENTED();
667 return window_->bounds();
668 }
669
670 void WmWindowMus::ClearRestoreBounds() {
671 window_->ClearSharedProperty(
672 ui::mojom::WindowManager::kRestoreBounds_Property);
673 }
674
675 void WmWindowMus::SetRestoreBoundsInScreen(const gfx::Rect& bounds) {
676 SetRestoreBounds(window_, bounds);
677 }
678
679 gfx::Rect WmWindowMus::GetRestoreBoundsInScreen() const {
680 return GetRestoreBounds(window_);
681 }
682
683 bool WmWindowMus::Contains(const WmWindow* other) const {
684 return other
685 ? window_->Contains(
686 static_cast<const WmWindowMus*>(other)->window_)
687 : false;
688 }
689
690 void WmWindowMus::SetShowState(ui::WindowShowState show_state) {
691 SetWindowShowState(window_, MojomWindowShowStateFromUI(show_state));
692 }
693
694 ui::WindowShowState WmWindowMus::GetShowState() const {
695 return UIWindowShowStateFromMojom(GetWindowShowState(window_));
696 }
697
698 void WmWindowMus::SetRestoreShowState(ui::WindowShowState show_state) {
699 restore_show_state_ = show_state;
700 }
701
702 void WmWindowMus::SetRestoreOverrides(
703 const gfx::Rect& bounds_override,
704 ui::WindowShowState window_state_override) {
705 // TODO(sky): see http://crbug.com/623314.
706 NOTIMPLEMENTED();
707 }
708
709 void WmWindowMus::SetLockedToRoot(bool value) {
710 locked_to_root_ = value;
711 }
712
713 bool WmWindowMus::IsLockedToRoot() const {
714 return locked_to_root_;
715 }
716
717 void WmWindowMus::SetCapture() {
718 window_->SetCapture();
719 }
720
721 bool WmWindowMus::HasCapture() {
722 return window_->HasCapture();
723 }
724
725 void WmWindowMus::ReleaseCapture() {
726 window_->ReleaseCapture();
727 }
728
729 bool WmWindowMus::HasRestoreBounds() const {
730 return window_->HasSharedProperty(
731 ui::mojom::WindowManager::kRestoreBounds_Property);
732 }
733
734 bool WmWindowMus::CanMaximize() const {
735 return (GetResizeBehavior(window_) &
736 ::ui::mojom::kResizeBehaviorCanMaximize) != 0;
737 }
738
739 bool WmWindowMus::CanMinimize() const {
740 return (GetResizeBehavior(window_) &
741 ::ui::mojom::kResizeBehaviorCanMinimize) != 0;
742 }
743
744 bool WmWindowMus::CanResize() const {
745 return window_ &&
746 (GetResizeBehavior(window_) & ::ui::mojom::kResizeBehaviorCanResize) !=
747 0;
748 }
749
750 bool WmWindowMus::CanActivate() const {
751 // TODO(sky): this isn't quite right. Should key off CanFocus(), which is not
752 // replicated.
753 return widget_ != nullptr;
754 }
755
756 void WmWindowMus::StackChildAtTop(WmWindow* child) {
757 GetMusWindow(child)->MoveToFront();
758 }
759
760 void WmWindowMus::StackChildAtBottom(WmWindow* child) {
761 GetMusWindow(child)->MoveToBack();
762 }
763
764 void WmWindowMus::StackChildAbove(WmWindow* child, WmWindow* target) {
765 GetMusWindow(child)->Reorder(GetMusWindow(target),
766 ui::mojom::OrderDirection::ABOVE);
767 }
768
769 void WmWindowMus::StackChildBelow(WmWindow* child, WmWindow* target) {
770 GetMusWindow(child)->Reorder(GetMusWindow(target),
771 ui::mojom::OrderDirection::BELOW);
772 }
773
774 void WmWindowMus::SetPinned(bool trusted) { 190 void WmWindowMus::SetPinned(bool trusted) {
775 // http://crbug.com/622486. 191 // http://crbug.com/622486.
776 NOTIMPLEMENTED(); 192 NOTIMPLEMENTED();
777 } 193 }
778 194
779 void WmWindowMus::SetAlwaysOnTop(bool value) {
780 mus::SetAlwaysOnTop(window_, value);
781 }
782
783 bool WmWindowMus::IsAlwaysOnTop() const {
784 return mus::IsAlwaysOnTop(window_);
785 }
786
787 void WmWindowMus::Hide() {
788 window_->SetVisible(false);
789 }
790
791 void WmWindowMus::Show() {
792 window_->SetVisible(true);
793 }
794
795 views::Widget* WmWindowMus::GetInternalWidget() { 195 views::Widget* WmWindowMus::GetInternalWidget() {
796 // Don't return the window frame widget for an embedded client window. 196 // Don't return the window frame widget for an embedded client window.
797 if (widget_creation_type_ == WidgetCreationType::FOR_CLIENT) 197 if (widget_creation_type_ == WidgetCreationType::FOR_CLIENT)
798 return nullptr; 198 return nullptr;
799 199
800 return widget_; 200 return widget_;
801 } 201 }
802 202
803 void WmWindowMus::CloseWidget() { 203 void WmWindowMus::CloseWidget() {
804 DCHECK(widget_); 204 DCHECK(widget_);
805 // Allow the client to service the close request for remote widgets. 205 // Allow the client to service the close request for remote widgets.
806 if (widget_creation_type_ == WidgetCreationType::FOR_CLIENT) 206 if (widget_creation_type_ == WidgetCreationType::FOR_CLIENT) {
807 window_->RequestClose(); 207 WmShellMus::Get()->window_manager()->window_manager_client()->RequestClose(
808 else 208 aura_window());
209 } else {
809 widget_->Close(); 210 widget_->Close();
211 }
810 } 212 }
811 213
812 void WmWindowMus::SetFocused() { 214 // TODO(sky): investigate if needed.
813 window_->SetFocus(); 215 bool WmWindowMus::CanActivate() const {
814 } 216 // TODO(sky): this isn't quite right. Should key off CanFocus(), which is not
815 217 // replicated.
816 bool WmWindowMus::IsFocused() const { 218 return WmWindowAura::CanActivate() && widget_ != nullptr;
817 return window_->HasFocus();
818 }
819
820 bool WmWindowMus::IsActive() const {
821 ui::Window* focused = window_->window_tree()->GetFocusedWindow();
822 return focused && window_->Contains(focused);
823 }
824
825 void WmWindowMus::Activate() {
826 window_->SetFocus();
827 WmWindow* top_level = GetToplevelWindow();
828 if (!top_level)
829 return;
830
831 // TODO(sky): mus should do this too.
832 GetMusWindow(top_level)->MoveToFront();
833 }
834
835 void WmWindowMus::Deactivate() {
836 if (IsActive())
837 window_->window_tree()->ClearFocus();
838 }
839
840 void WmWindowMus::SetFullscreen() {
841 SetWindowShowState(window_, ui::mojom::ShowState::FULLSCREEN);
842 }
843
844 void WmWindowMus::Maximize() {
845 SetWindowShowState(window_, ui::mojom::ShowState::MAXIMIZED);
846 }
847
848 void WmWindowMus::Minimize() {
849 SetWindowShowState(window_, ui::mojom::ShowState::MINIMIZED);
850 }
851
852 void WmWindowMus::Unminimize() {
853 SetWindowShowState(window_, MojomWindowShowStateFromUI(restore_show_state_));
854 restore_show_state_ = ui::SHOW_STATE_DEFAULT;
855 }
856
857 void WmWindowMus::SetExcludedFromMru(bool excluded_from_mru) {
858 SetExcludeFromMru(window_, excluded_from_mru);
859 }
860
861 std::vector<WmWindow*> WmWindowMus::GetChildren() {
862 return FromMusWindows(window_->children());
863 }
864
865 WmWindow* WmWindowMus::GetChildByShellWindowId(int id) {
866 if (id == shell_window_id_)
867 return this;
868 for (ui::Window* child : window_->children()) {
869 WmWindow* result = Get(child)->GetChildByShellWindowId(id);
870 if (result)
871 return result;
872 }
873 return nullptr;
874 } 219 }
875 220
876 void WmWindowMus::ShowResizeShadow(int component) { 221 void WmWindowMus::ShowResizeShadow(int component) {
877 // TODO: http://crbug.com/640773. 222 // TODO: http://crbug.com/640773.
878 NOTIMPLEMENTED(); 223 NOTIMPLEMENTED();
879 } 224 }
880 225
881 void WmWindowMus::HideResizeShadow() { 226 void WmWindowMus::HideResizeShadow() {
882 // TODO: http://crbug.com/640773. 227 // TODO: http://crbug.com/640773.
883 NOTIMPLEMENTED(); 228 NOTIMPLEMENTED();
884 } 229 }
885 230
886 void WmWindowMus::InstallResizeHandleWindowTargeter( 231 void WmWindowMus::InstallResizeHandleWindowTargeter(
887 ImmersiveFullscreenController* immersive_fullscreen_controller) { 232 ImmersiveFullscreenController* immersive_fullscreen_controller) {
888 // TODO(sky): I believe once ImmersiveFullscreenController is ported this 233 // TODO(sky): I believe once ImmersiveFullscreenController is ported this
889 // won't be necessary in mash, but I need to verify that: 234 // won't be necessary in mash, but I need to verify that:
890 // http://crbug.com/548435. 235 // http://crbug.com/548435.
891 } 236 }
892 237
238 // TODO: nuke this once SetBoundsInScreen() is updated.
893 void WmWindowMus::SetBoundsInScreenBehaviorForChildren( 239 void WmWindowMus::SetBoundsInScreenBehaviorForChildren(
894 WmWindow::BoundsInScreenBehavior behavior) { 240 WmWindow::BoundsInScreenBehavior behavior) {
895 child_bounds_in_screen_behavior_ = behavior; 241 child_bounds_in_screen_behavior_ = behavior;
896 } 242 }
897 243
898 void WmWindowMus::SetSnapsChildrenToPhysicalPixelBoundary() { 244 void WmWindowMus::SetSnapsChildrenToPhysicalPixelBoundary() {
899 if (snap_children_to_pixel_boundary_) 245 if (snap_children_to_pixel_boundary_)
900 return; 246 return;
901 247
902 snap_children_to_pixel_boundary_ = true; 248 snap_children_to_pixel_boundary_ = true;
903 for (auto& observer : observers_) { 249 for (auto& observer : observers()) {
904 observer.OnWindowPropertyChanged( 250 observer.OnWindowPropertyChanged(
905 this, WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY); 251 this, WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY);
906 } 252 }
907 } 253 }
908 254
909 void WmWindowMus::SnapToPixelBoundaryIfNecessary() { 255 void WmWindowMus::SnapToPixelBoundaryIfNecessary() {
910 WmWindowMus* parent = Get(window_->parent()); 256 WmWindowMus* parent = Get(aura_window()->parent());
911 if (parent && parent->snap_children_to_pixel_boundary_) { 257 if (parent && parent->snap_children_to_pixel_boundary_) {
912 // TODO: implement snap to pixel: http://crbug.com/615554. 258 // TODO: implement snap to pixel: http://crbug.com/615554.
913 NOTIMPLEMENTED(); 259 NOTIMPLEMENTED();
914 } 260 }
915 } 261 }
916 262
917 void WmWindowMus::SetChildrenUseExtendedHitRegion() { 263 void WmWindowMus::SetChildrenUseExtendedHitRegion() {
918 children_use_extended_hit_region_ = true; 264 children_use_extended_hit_region_ = true;
919 } 265 }
920 266
921 std::unique_ptr<views::View> WmWindowMus::CreateViewWithRecreatedLayers() {
922 // TODO: need real implementation, http://crbug.com/629497.
923 std::unique_ptr<views::View> view(new views::View);
924 return view;
925 }
926
927 void WmWindowMus::AddObserver(WmWindowObserver* observer) {
928 observers_.AddObserver(observer);
929 }
930
931 void WmWindowMus::RemoveObserver(WmWindowObserver* observer) {
932 observers_.RemoveObserver(observer);
933 }
934
935 bool WmWindowMus::HasObserver(const WmWindowObserver* observer) const {
936 return observers_.HasObserver(observer);
937 }
938
939 void WmWindowMus::AddTransientWindowObserver(
940 WmTransientWindowObserver* observer) {
941 transient_observers_.AddObserver(observer);
942 }
943
944 void WmWindowMus::RemoveTransientWindowObserver(
945 WmTransientWindowObserver* observer) {
946 transient_observers_.RemoveObserver(observer);
947 }
948
949 void WmWindowMus::AddLimitedPreTargetHandler(ui::EventHandler* handler) { 267 void WmWindowMus::AddLimitedPreTargetHandler(ui::EventHandler* handler) {
950 DCHECK(GetInternalWidget()); 268 DCHECK(WmShellMus::Get()->window_tree_client()->WasCreatedByThisClient(
951 widget_->GetNativeWindow()->AddPreTargetHandler(handler); 269 aura::WindowMus::Get(aura_window())));
952 } 270 WmWindowAura::AddLimitedPreTargetHandler(handler);
953
954 void WmWindowMus::RemoveLimitedPreTargetHandler(ui::EventHandler* handler) {
955 widget_->GetNativeWindow()->RemovePreTargetHandler(handler);
956 }
957
958 void WmWindowMus::OnTreeChanging(const TreeChangeParams& params) {
959 WmWindowObserver::TreeChangeParams wm_params;
960 wm_params.target = Get(params.target);
961 wm_params.new_parent = Get(params.new_parent);
962 wm_params.old_parent = Get(params.old_parent);
963 for (auto& observer : observers_)
964 observer.OnWindowTreeChanging(this, wm_params);
965 }
966
967 void WmWindowMus::OnTreeChanged(const TreeChangeParams& params) {
968 WmWindowObserver::TreeChangeParams wm_params;
969 wm_params.target = Get(params.target);
970 wm_params.new_parent = Get(params.new_parent);
971 wm_params.old_parent = Get(params.old_parent);
972 for (auto& observer : observers_)
973 observer.OnWindowTreeChanged(this, wm_params);
974 }
975
976 void WmWindowMus::OnWindowReordered(ui::Window* window,
977 ui::Window* relative_window,
978 ui::mojom::OrderDirection direction) {
979 for (auto& observer : observers_)
980 observer.OnWindowStackingChanged(this);
981 }
982
983 void WmWindowMus::OnWindowSharedPropertyChanged(
984 ui::Window* window,
985 const std::string& name,
986 const std::vector<uint8_t>* old_data,
987 const std::vector<uint8_t>* new_data) {
988 if (name == ui::mojom::WindowManager::kShowState_Property) {
989 GetWindowState()->OnWindowShowStateChanged();
990 return;
991 }
992 if (name == ui::mojom::WindowManager::kWindowTitle_Property) {
993 for (auto& observer : observers_)
994 observer.OnWindowTitleChanged(this);
995 return;
996 }
997
998 // Notify WmWindowObserver of certain white-listed property changes.
999 WmWindowProperty wm_property = WmWindowPropertyFromUI(name);
1000 if (wm_property != WmWindowProperty::INVALID_PROPERTY) {
1001 for (auto& observer : observers_)
1002 observer.OnWindowPropertyChanged(this, wm_property);
1003 return;
1004 }
1005
1006 // Deal with snap to pixel.
1007 NOTIMPLEMENTED();
1008 }
1009
1010 void WmWindowMus::OnWindowBoundsChanged(ui::Window* window,
1011 const gfx::Rect& old_bounds,
1012 const gfx::Rect& new_bounds) {
1013 for (auto& observer : observers_)
1014 observer.OnWindowBoundsChanged(this, old_bounds, new_bounds);
1015 }
1016
1017 void WmWindowMus::OnWindowDestroying(ui::Window* window) {
1018 for (auto& observer : observers_)
1019 observer.OnWindowDestroying(this);
1020 }
1021
1022 void WmWindowMus::OnWindowDestroyed(ui::Window* window) {
1023 for (auto& observer : observers_)
1024 observer.OnWindowDestroyed(this);
1025 }
1026
1027 void WmWindowMus::OnWindowVisibilityChanging(ui::Window* window, bool visible) {
1028 DCHECK_EQ(window_, window);
1029 for (auto& observer : observers_)
1030 observer.OnWindowVisibilityChanging(this, visible);
1031 }
1032
1033 void WmWindowMus::OnWindowVisibilityChanged(ui::Window* window, bool visible) {
1034 for (auto& observer : observers_)
1035 observer.OnWindowVisibilityChanged(Get(window), visible);
1036 }
1037
1038 void WmWindowMus::OnTransientChildAdded(ui::Window* window,
1039 ui::Window* transient) {
1040 for (auto& observer : transient_observers_)
1041 observer.OnTransientChildAdded(this, Get(transient));
1042 }
1043
1044 void WmWindowMus::OnTransientChildRemoved(ui::Window* window,
1045 ui::Window* transient) {
1046 for (auto& observer : transient_observers_)
1047 observer.OnTransientChildRemoved(this, Get(transient));
1048 } 271 }
1049 272
1050 } // namespace mus 273 } // namespace mus
1051 } // namespace ash 274 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698