| 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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 | 494 |
| 495 void WmWindowMus::Show() { | 495 void WmWindowMus::Show() { |
| 496 window_->SetVisible(true); | 496 window_->SetVisible(true); |
| 497 } | 497 } |
| 498 | 498 |
| 499 bool WmWindowMus::IsFocused() const { | 499 bool WmWindowMus::IsFocused() const { |
| 500 return window_->HasFocus(); | 500 return window_->HasFocus(); |
| 501 } | 501 } |
| 502 | 502 |
| 503 bool WmWindowMus::IsActive() const { | 503 bool WmWindowMus::IsActive() const { |
| 504 mus::Window* focused = window_->connection()->GetFocusedWindow(); | 504 mus::Window* focused = window_->window_tree()->GetFocusedWindow(); |
| 505 return focused && window_->Contains(focused); | 505 return focused && window_->Contains(focused); |
| 506 } | 506 } |
| 507 | 507 |
| 508 void WmWindowMus::Activate() { | 508 void WmWindowMus::Activate() { |
| 509 window_->SetFocus(); | 509 window_->SetFocus(); |
| 510 ash::wm::WmWindow* top_level = GetToplevelWindow(); | 510 ash::wm::WmWindow* top_level = GetToplevelWindow(); |
| 511 if (!top_level) | 511 if (!top_level) |
| 512 return; | 512 return; |
| 513 | 513 |
| 514 // TODO(sky): mus should do this too. | 514 // TODO(sky): mus should do this too. |
| 515 GetMusWindow(top_level)->MoveToFront(); | 515 GetMusWindow(top_level)->MoveToFront(); |
| 516 } | 516 } |
| 517 | 517 |
| 518 void WmWindowMus::Deactivate() { | 518 void WmWindowMus::Deactivate() { |
| 519 if (IsActive()) | 519 if (IsActive()) |
| 520 window_->connection()->ClearFocus(); | 520 window_->window_tree()->ClearFocus(); |
| 521 } | 521 } |
| 522 | 522 |
| 523 void WmWindowMus::SetFullscreen() { | 523 void WmWindowMus::SetFullscreen() { |
| 524 SetWindowShowState(window_, mus::mojom::ShowState::FULLSCREEN); | 524 SetWindowShowState(window_, mus::mojom::ShowState::FULLSCREEN); |
| 525 } | 525 } |
| 526 | 526 |
| 527 void WmWindowMus::Maximize() { | 527 void WmWindowMus::Maximize() { |
| 528 SetWindowShowState(window_, mus::mojom::ShowState::MAXIMIZED); | 528 SetWindowShowState(window_, mus::mojom::ShowState::MAXIMIZED); |
| 529 } | 529 } |
| 530 | 530 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 OnWindowBoundsChanged(this, old_bounds, new_bounds)); | 615 OnWindowBoundsChanged(this, old_bounds, new_bounds)); |
| 616 } | 616 } |
| 617 | 617 |
| 618 void WmWindowMus::OnWindowDestroying(mus::Window* window) { | 618 void WmWindowMus::OnWindowDestroying(mus::Window* window) { |
| 619 FOR_EACH_OBSERVER(ash::wm::WmWindowObserver, observers_, | 619 FOR_EACH_OBSERVER(ash::wm::WmWindowObserver, observers_, |
| 620 OnWindowDestroying(this)); | 620 OnWindowDestroying(this)); |
| 621 } | 621 } |
| 622 | 622 |
| 623 } // namespace wm | 623 } // namespace wm |
| 624 } // namespace mash | 624 } // namespace mash |
| OLD | NEW |