| 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 "mash/wm/bridge/wm_window_mus.h" | 5 #include "mash/wm/bridge/wm_window_mus.h" |
| 6 | 6 |
| 7 #include "ash/wm/common/container_finder.h" | 7 #include "ash/wm/common/container_finder.h" |
| 8 #include "ash/wm/common/window_state.h" | 8 #include "ash/wm/common/window_state.h" |
| 9 #include "ash/wm/common/wm_layout_manager.h" | 9 #include "ash/wm/common/wm_layout_manager.h" |
| 10 #include "ash/wm/common/wm_window_observer.h" | 10 #include "ash/wm/common/wm_window_observer.h" |
| 11 #include "ash/wm/common/wm_window_property.h" | 11 #include "ash/wm/common/wm_window_property.h" |
| 12 #include "components/mus/public/cpp/window.h" | 12 #include "components/mus/public/cpp/window.h" |
| 13 #include "components/mus/public/cpp/window_property.h" | 13 #include "components/mus/public/cpp/window_property.h" |
| 14 #include "components/mus/public/cpp/window_tree_connection.h" | 14 #include "components/mus/public/cpp/window_tree_connection.h" |
| 15 #include "mash/wm/bridge/mus_layout_manager_adapter.h" | 15 #include "mash/wm/bridge/mus_layout_manager_adapter.h" |
| 16 #include "mash/wm/bridge/wm_globals_mus.h" | 16 #include "mash/wm/bridge/wm_globals_mus.h" |
| 17 #include "mash/wm/bridge/wm_root_window_controller_mus.h" | 17 #include "mash/wm/bridge/wm_root_window_controller_mus.h" |
| 18 #include "mash/wm/property_util.h" | 18 #include "mash/wm/property_util.h" |
| 19 #include "ui/aura/mus/mus_util.h" | 19 #include "ui/aura/mus/mus_util.h" |
| 20 #include "ui/base/hit_test.h" | 20 #include "ui/base/hit_test.h" |
| 21 #include "ui/display/display.h" | 21 #include "ui/display/display.h" |
| 22 #include "ui/views/widget/widget.h" | 22 #include "ui/views/widget/widget.h" |
| 23 #include "ui/views/widget/widget_delegate.h" | 23 #include "ui/views/widget/widget_delegate.h" |
| 24 | 24 |
| 25 MUS_DECLARE_WINDOW_PROPERTY_TYPE(mash::wm::WmWindowMus*); | 25 MUS_DECLARE_WINDOW_PROPERTY_TYPE(mash::wm::WmWindowMus*); |
| 26 | 26 |
| 27 // TODO(sky): fully implement this. Making DVLOG as too spammy to be useful. |
| 28 #undef NOTIMPLEMENTED |
| 29 #define NOTIMPLEMENTED() DVLOG(1) << "notimplemented" |
| 30 |
| 27 namespace mash { | 31 namespace mash { |
| 28 namespace wm { | 32 namespace wm { |
| 29 | 33 |
| 30 MUS_DEFINE_OWNED_WINDOW_PROPERTY_KEY(mash::wm::WmWindowMus, | 34 MUS_DEFINE_OWNED_WINDOW_PROPERTY_KEY(mash::wm::WmWindowMus, |
| 31 kWmWindowKey, | 35 kWmWindowKey, |
| 32 nullptr); | 36 nullptr); |
| 33 namespace { | 37 namespace { |
| 34 | 38 |
| 35 // This classes is used so that the WindowState constructor can be made | 39 // This classes is used so that the WindowState constructor can be made |
| 36 // protected. GetWindowState() is the only place that should be creating | 40 // protected. GetWindowState() is the only place that should be creating |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 bool WmWindowMus::IsVisible() const { | 247 bool WmWindowMus::IsVisible() const { |
| 244 return window_->visible(); | 248 return window_->visible(); |
| 245 } | 249 } |
| 246 | 250 |
| 247 bool WmWindowMus::IsSystemModal() const { | 251 bool WmWindowMus::IsSystemModal() const { |
| 248 NOTIMPLEMENTED(); | 252 NOTIMPLEMENTED(); |
| 249 return false; | 253 return false; |
| 250 } | 254 } |
| 251 | 255 |
| 252 bool WmWindowMus::GetBoolProperty(ash::wm::WmWindowProperty key) { | 256 bool WmWindowMus::GetBoolProperty(ash::wm::WmWindowProperty key) { |
| 253 NOTIMPLEMENTED(); | |
| 254 switch (key) { | 257 switch (key) { |
| 255 case ash::wm::WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUDARY: | 258 case ash::wm::WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUDARY: |
| 259 NOTIMPLEMENTED(); |
| 256 return true; | 260 return true; |
| 257 | 261 |
| 258 case ash::wm::WmWindowProperty::ALWAYS_ON_TOP: | 262 case ash::wm::WmWindowProperty::ALWAYS_ON_TOP: |
| 259 return false; | 263 return IsAlwaysOnTop(); |
| 260 | 264 |
| 261 default: | 265 default: |
| 262 NOTREACHED(); | 266 NOTREACHED(); |
| 263 break; | 267 break; |
| 264 } | 268 } |
| 265 | 269 |
| 266 NOTREACHED(); | 270 NOTREACHED(); |
| 267 return false; | 271 return false; |
| 268 } | 272 } |
| 269 | 273 |
| 270 int WmWindowMus::GetIntProperty(ash::wm::WmWindowProperty key) { | 274 int WmWindowMus::GetIntProperty(ash::wm::WmWindowProperty key) { |
| 271 NOTIMPLEMENTED(); | 275 if (key == ash::wm::WmWindowProperty::SHELF_ID) { |
| 272 if (key == ash::wm::WmWindowProperty::SHELF_ID) | 276 NOTIMPLEMENTED(); |
| 273 return 0; | 277 return 0; |
| 278 } |
| 274 | 279 |
| 275 NOTREACHED(); | 280 NOTREACHED(); |
| 276 return 0; | 281 return 0; |
| 277 } | 282 } |
| 278 | 283 |
| 279 const ash::wm::WindowState* WmWindowMus::GetWindowState() const { | 284 const ash::wm::WindowState* WmWindowMus::GetWindowState() const { |
| 280 return window_state_.get(); | 285 return window_state_.get(); |
| 281 } | 286 } |
| 282 | 287 |
| 283 ash::wm::WmWindow* WmWindowMus::GetToplevelWindow() { | 288 ash::wm::WmWindow* WmWindowMus::GetToplevelWindow() { |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 GetMusWindow(child)->Reorder(GetMusWindow(target), | 474 GetMusWindow(child)->Reorder(GetMusWindow(target), |
| 470 mus::mojom::OrderDirection::ABOVE); | 475 mus::mojom::OrderDirection::ABOVE); |
| 471 } | 476 } |
| 472 | 477 |
| 473 void WmWindowMus::StackChildBelow(WmWindow* child, WmWindow* target) { | 478 void WmWindowMus::StackChildBelow(WmWindow* child, WmWindow* target) { |
| 474 GetMusWindow(child)->Reorder(GetMusWindow(target), | 479 GetMusWindow(child)->Reorder(GetMusWindow(target), |
| 475 mus::mojom::OrderDirection::BELOW); | 480 mus::mojom::OrderDirection::BELOW); |
| 476 } | 481 } |
| 477 | 482 |
| 478 void WmWindowMus::SetAlwaysOnTop(bool value) { | 483 void WmWindowMus::SetAlwaysOnTop(bool value) { |
| 479 // TODO(sky): need to set property on window. | 484 mash::wm::SetAlwaysOnTop(window_, value); |
| 480 NOTIMPLEMENTED(); | |
| 481 } | 485 } |
| 482 | 486 |
| 483 bool WmWindowMus::IsAlwaysOnTop() const { | 487 bool WmWindowMus::IsAlwaysOnTop() const { |
| 484 // TODO(sky): need to set property on window. | 488 return mash::wm::IsAlwaysOnTop(window_); |
| 485 NOTIMPLEMENTED(); | |
| 486 return false; | |
| 487 } | 489 } |
| 488 | 490 |
| 489 void WmWindowMus::Hide() { | 491 void WmWindowMus::Hide() { |
| 490 window_->SetVisible(false); | 492 window_->SetVisible(false); |
| 491 } | 493 } |
| 492 | 494 |
| 493 void WmWindowMus::Show() { | 495 void WmWindowMus::Show() { |
| 494 window_->SetVisible(true); | 496 window_->SetVisible(true); |
| 495 } | 497 } |
| 496 | 498 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 mus::mojom::OrderDirection direction) { | 578 mus::mojom::OrderDirection direction) { |
| 577 FOR_EACH_OBSERVER(ash::wm::WmWindowObserver, observers_, | 579 FOR_EACH_OBSERVER(ash::wm::WmWindowObserver, observers_, |
| 578 OnWindowStackingChanged(this)); | 580 OnWindowStackingChanged(this)); |
| 579 } | 581 } |
| 580 | 582 |
| 581 void WmWindowMus::OnWindowSharedPropertyChanged( | 583 void WmWindowMus::OnWindowSharedPropertyChanged( |
| 582 mus::Window* window, | 584 mus::Window* window, |
| 583 const std::string& name, | 585 const std::string& name, |
| 584 const std::vector<uint8_t>* old_data, | 586 const std::vector<uint8_t>* old_data, |
| 585 const std::vector<uint8_t>* new_data) { | 587 const std::vector<uint8_t>* new_data) { |
| 586 if (name == mus::mojom::WindowManager::kShowState_Property) | 588 if (name == mus::mojom::WindowManager::kShowState_Property) { |
| 587 GetWindowState()->OnWindowShowStateChanged(); | 589 GetWindowState()->OnWindowShowStateChanged(); |
| 590 } |
| 591 if (name == mus::mojom::WindowManager::kAlwaysOnTop_Property) { |
| 592 FOR_EACH_OBSERVER(ash::wm::WmWindowObserver, observers_, |
| 593 OnWindowPropertyChanged( |
| 594 this, ash::wm::WmWindowProperty::ALWAYS_ON_TOP, 0u)); |
| 595 return; |
| 596 } |
| 588 | 597 |
| 589 // Deal with always on top and snap. | 598 // Deal with snap to pixel. |
| 590 NOTIMPLEMENTED(); | 599 NOTIMPLEMENTED(); |
| 591 } | 600 } |
| 592 | 601 |
| 593 void WmWindowMus::OnWindowBoundsChanged(mus::Window* window, | 602 void WmWindowMus::OnWindowBoundsChanged(mus::Window* window, |
| 594 const gfx::Rect& old_bounds, | 603 const gfx::Rect& old_bounds, |
| 595 const gfx::Rect& new_bounds) { | 604 const gfx::Rect& new_bounds) { |
| 596 FOR_EACH_OBSERVER(ash::wm::WmWindowObserver, observers_, | 605 FOR_EACH_OBSERVER(ash::wm::WmWindowObserver, observers_, |
| 597 OnWindowBoundsChanged(this, old_bounds, new_bounds)); | 606 OnWindowBoundsChanged(this, old_bounds, new_bounds)); |
| 598 } | 607 } |
| 599 | 608 |
| 600 void WmWindowMus::OnWindowDestroying(mus::Window* window) { | 609 void WmWindowMus::OnWindowDestroying(mus::Window* window) { |
| 601 FOR_EACH_OBSERVER(ash::wm::WmWindowObserver, observers_, | 610 FOR_EACH_OBSERVER(ash::wm::WmWindowObserver, observers_, |
| 602 OnWindowDestroying(this)); | 611 OnWindowDestroying(this)); |
| 603 } | 612 } |
| 604 | 613 |
| 605 } // namespace wm | 614 } // namespace wm |
| 606 } // namespace mash | 615 } // namespace mash |
| OLD | NEW |