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