| 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/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" | |
| 13 #include "ash/common/wm_transient_window_observer.h" | 12 #include "ash/common/wm_transient_window_observer.h" |
| 14 #include "ash/common/wm_window_observer.h" | 13 #include "ash/common/wm_window_observer.h" |
| 15 #include "ash/common/wm_window_property.h" | 14 #include "ash/common/wm_window_property.h" |
| 16 #include "ash/mus/bridge/mus_layout_manager_adapter.h" | 15 #include "ash/mus/bridge/mus_layout_manager_adapter.h" |
| 17 #include "ash/mus/bridge/wm_root_window_controller_mus.h" | 16 #include "ash/mus/bridge/wm_root_window_controller_mus.h" |
| 18 #include "ash/mus/bridge/wm_shell_mus.h" | 17 #include "ash/mus/bridge/wm_shell_mus.h" |
| 19 #include "ash/mus/property_util.h" | 18 #include "ash/mus/property_util.h" |
| 20 #include "services/ui/public/cpp/property_type_converters.h" | 19 #include "services/ui/public/cpp/property_type_converters.h" |
| 21 #include "services/ui/public/cpp/window.h" | 20 #include "services/ui/public/cpp/window.h" |
| 22 #include "services/ui/public/cpp/window_property.h" | 21 #include "services/ui/public/cpp/window_property.h" |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 bool WmWindowMus::IsSystemModal() const { | 369 bool WmWindowMus::IsSystemModal() const { |
| 371 NOTIMPLEMENTED(); | 370 NOTIMPLEMENTED(); |
| 372 return false; | 371 return false; |
| 373 } | 372 } |
| 374 | 373 |
| 375 bool WmWindowMus::GetBoolProperty(WmWindowProperty key) { | 374 bool WmWindowMus::GetBoolProperty(WmWindowProperty key) { |
| 376 switch (key) { | 375 switch (key) { |
| 377 case WmWindowProperty::ALWAYS_ON_TOP: | 376 case WmWindowProperty::ALWAYS_ON_TOP: |
| 378 return IsAlwaysOnTop(); | 377 return IsAlwaysOnTop(); |
| 379 | 378 |
| 380 case WmWindowProperty::DRAW_ATTENTION: | |
| 381 NOTIMPLEMENTED(); | |
| 382 return false; | |
| 383 | |
| 384 case WmWindowProperty::EXCLUDE_FROM_MRU: | 379 case WmWindowProperty::EXCLUDE_FROM_MRU: |
| 385 return GetExcludeFromMru(window_); | 380 return GetExcludeFromMru(window_); |
| 386 | 381 |
| 387 case WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY: | 382 case WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY: |
| 388 return snap_children_to_pixel_boundary_; | 383 return snap_children_to_pixel_boundary_; |
| 389 | 384 |
| 390 default: | 385 default: |
| 391 NOTREACHED(); | 386 NOTREACHED(); |
| 392 break; | 387 break; |
| 393 } | 388 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 | 484 |
| 490 if (key == WmWindowProperty::TOP_VIEW_INSET) { | 485 if (key == WmWindowProperty::TOP_VIEW_INSET) { |
| 491 // TODO: need support for TOP_VIEW_INSET: http://crbug.com/615100. | 486 // TODO: need support for TOP_VIEW_INSET: http://crbug.com/615100. |
| 492 NOTIMPLEMENTED(); | 487 NOTIMPLEMENTED(); |
| 493 return; | 488 return; |
| 494 } | 489 } |
| 495 | 490 |
| 496 NOTREACHED(); | 491 NOTREACHED(); |
| 497 } | 492 } |
| 498 | 493 |
| 499 std::string WmWindowMus::GetStringProperty(WmWindowProperty key) { | |
| 500 NOTIMPLEMENTED(); | |
| 501 return std::string(); | |
| 502 } | |
| 503 | |
| 504 void WmWindowMus::SetStringProperty(WmWindowProperty key, | |
| 505 const std::string& value) { | |
| 506 NOTIMPLEMENTED(); | |
| 507 } | |
| 508 | |
| 509 gfx::ImageSkia WmWindowMus::GetWindowIcon() { | |
| 510 NOTIMPLEMENTED(); | |
| 511 return gfx::ImageSkia(); | |
| 512 } | |
| 513 | |
| 514 gfx::ImageSkia WmWindowMus::GetAppIcon() { | |
| 515 NOTIMPLEMENTED(); | |
| 516 return gfx::ImageSkia(); | |
| 517 } | |
| 518 | |
| 519 const wm::WindowState* WmWindowMus::GetWindowState() const { | 494 const wm::WindowState* WmWindowMus::GetWindowState() const { |
| 520 return window_state_.get(); | 495 return window_state_.get(); |
| 521 } | 496 } |
| 522 | 497 |
| 523 WmWindow* WmWindowMus::GetToplevelWindow() { | 498 WmWindow* WmWindowMus::GetToplevelWindow() { |
| 524 return WmShellMus::GetToplevelAncestor(window_); | 499 return WmShellMus::GetToplevelAncestor(window_); |
| 525 } | 500 } |
| 526 | 501 |
| 527 WmWindow* WmWindowMus::GetToplevelWindowForFocus() { | 502 WmWindow* WmWindowMus::GetToplevelWindowForFocus() { |
| 528 // TODO(sky): resolve if we really need two notions of top-level. In the mus | 503 // TODO(sky): resolve if we really need two notions of top-level. In the mus |
| (...skipping 19 matching lines...) Expand all Loading... |
| 548 } | 523 } |
| 549 | 524 |
| 550 const WmWindow* WmWindowMus::GetTransientParent() const { | 525 const WmWindow* WmWindowMus::GetTransientParent() const { |
| 551 return Get(window_->transient_parent()); | 526 return Get(window_->transient_parent()); |
| 552 } | 527 } |
| 553 | 528 |
| 554 std::vector<WmWindow*> WmWindowMus::GetTransientChildren() { | 529 std::vector<WmWindow*> WmWindowMus::GetTransientChildren() { |
| 555 return FromMusWindows(window_->transient_children()); | 530 return FromMusWindows(window_->transient_children()); |
| 556 } | 531 } |
| 557 | 532 |
| 558 bool WmWindowMus::MoveToEventRoot(const ui::Event& event) { | |
| 559 views::View* target = static_cast<views::View*>(event.target()); | |
| 560 if (!target) | |
| 561 return false; | |
| 562 WmWindow* target_root = | |
| 563 WmLookup::Get()->GetWindowForWidget(target->GetWidget())->GetRootWindow(); | |
| 564 if (!target_root || target_root == GetRootWindow()) | |
| 565 return false; | |
| 566 WmWindow* window_container = | |
| 567 target_root->GetChildByShellWindowId(GetParent()->GetShellWindowId()); | |
| 568 window_container->AddChild(this); | |
| 569 return true; | |
| 570 } | |
| 571 | |
| 572 void WmWindowMus::SetLayoutManager( | 533 void WmWindowMus::SetLayoutManager( |
| 573 std::unique_ptr<WmLayoutManager> layout_manager) { | 534 std::unique_ptr<WmLayoutManager> layout_manager) { |
| 574 if (layout_manager) { | 535 if (layout_manager) { |
| 575 layout_manager_adapter_.reset( | 536 layout_manager_adapter_.reset( |
| 576 new MusLayoutManagerAdapter(window_, std::move(layout_manager))); | 537 new MusLayoutManagerAdapter(window_, std::move(layout_manager))); |
| 577 } else { | 538 } else { |
| 578 layout_manager_adapter_.reset(); | 539 layout_manager_adapter_.reset(); |
| 579 } | 540 } |
| 580 } | 541 } |
| 581 | 542 |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 } | 1024 } |
| 1064 | 1025 |
| 1065 void WmWindowMus::OnTransientChildRemoved(ui::Window* window, | 1026 void WmWindowMus::OnTransientChildRemoved(ui::Window* window, |
| 1066 ui::Window* transient) { | 1027 ui::Window* transient) { |
| 1067 for (auto& observer : transient_observers_) | 1028 for (auto& observer : transient_observers_) |
| 1068 observer.OnTransientChildRemoved(this, Get(transient)); | 1029 observer.OnTransientChildRemoved(this, Get(transient)); |
| 1069 } | 1030 } |
| 1070 | 1031 |
| 1071 } // namespace mus | 1032 } // namespace mus |
| 1072 } // namespace ash | 1033 } // namespace ash |
| OLD | NEW |