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_client.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 |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 window_->RequestClose(); | 552 window_->RequestClose(); |
553 else | 553 else |
554 widget_->Close(); | 554 widget_->Close(); |
555 } | 555 } |
556 | 556 |
557 bool WmWindowMus::IsFocused() const { | 557 bool WmWindowMus::IsFocused() const { |
558 return window_->HasFocus(); | 558 return window_->HasFocus(); |
559 } | 559 } |
560 | 560 |
561 bool WmWindowMus::IsActive() const { | 561 bool WmWindowMus::IsActive() const { |
562 mus::Window* focused = window_->connection()->GetFocusedWindow(); | 562 mus::Window* focused = window_->window_tree()->GetFocusedWindow(); |
563 return focused && window_->Contains(focused); | 563 return focused && window_->Contains(focused); |
564 } | 564 } |
565 | 565 |
566 void WmWindowMus::Activate() { | 566 void WmWindowMus::Activate() { |
567 window_->SetFocus(); | 567 window_->SetFocus(); |
568 ash::wm::WmWindow* top_level = GetToplevelWindow(); | 568 ash::wm::WmWindow* top_level = GetToplevelWindow(); |
569 if (!top_level) | 569 if (!top_level) |
570 return; | 570 return; |
571 | 571 |
572 // TODO(sky): mus should do this too. | 572 // TODO(sky): mus should do this too. |
573 GetMusWindow(top_level)->MoveToFront(); | 573 GetMusWindow(top_level)->MoveToFront(); |
574 } | 574 } |
575 | 575 |
576 void WmWindowMus::Deactivate() { | 576 void WmWindowMus::Deactivate() { |
577 if (IsActive()) | 577 if (IsActive()) |
578 window_->connection()->ClearFocus(); | 578 window_->window_tree()->ClearFocus(); |
579 } | 579 } |
580 | 580 |
581 void WmWindowMus::SetFullscreen() { | 581 void WmWindowMus::SetFullscreen() { |
582 SetWindowShowState(window_, mus::mojom::ShowState::FULLSCREEN); | 582 SetWindowShowState(window_, mus::mojom::ShowState::FULLSCREEN); |
583 } | 583 } |
584 | 584 |
585 void WmWindowMus::Maximize() { | 585 void WmWindowMus::Maximize() { |
586 SetWindowShowState(window_, mus::mojom::ShowState::MAXIMIZED); | 586 SetWindowShowState(window_, mus::mojom::ShowState::MAXIMIZED); |
587 } | 587 } |
588 | 588 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 OnWindowBoundsChanged(this, old_bounds, new_bounds)); | 673 OnWindowBoundsChanged(this, old_bounds, new_bounds)); |
674 } | 674 } |
675 | 675 |
676 void WmWindowMus::OnWindowDestroying(mus::Window* window) { | 676 void WmWindowMus::OnWindowDestroying(mus::Window* window) { |
677 FOR_EACH_OBSERVER(ash::wm::WmWindowObserver, observers_, | 677 FOR_EACH_OBSERVER(ash::wm::WmWindowObserver, observers_, |
678 OnWindowDestroying(this)); | 678 OnWindowDestroying(this)); |
679 } | 679 } |
680 | 680 |
681 } // namespace wm | 681 } // namespace wm |
682 } // namespace mash | 682 } // namespace mash |
OLD | NEW |