| 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 "ui/views/mus/desktop_window_tree_host_mus.h" | 5 #include "ui/views/mus/desktop_window_tree_host_mus.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 return is_active_; | 546 return is_active_; |
| 547 } | 547 } |
| 548 | 548 |
| 549 void DesktopWindowTreeHostMus::Maximize() { | 549 void DesktopWindowTreeHostMus::Maximize() { |
| 550 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 550 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 551 } | 551 } |
| 552 void DesktopWindowTreeHostMus::Minimize() { | 552 void DesktopWindowTreeHostMus::Minimize() { |
| 553 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); | 553 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); |
| 554 } | 554 } |
| 555 | 555 |
| 556 void DesktopWindowTreeHostMus::Pin(bool trusted) { |
| 557 aura::client::WindowPinType type = |
| 558 trusted ? aura::client::WindowPinType::TRUSTED_PINNED |
| 559 : aura::client::WindowPinType::PINNED; |
| 560 window()->SetProperty(aura::client::kWindowPinTypeKey, type); |
| 561 } |
| 562 |
| 556 void DesktopWindowTreeHostMus::Restore() { | 563 void DesktopWindowTreeHostMus::Restore() { |
| 557 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 564 window()->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
| 558 } | 565 } |
| 559 | 566 |
| 560 bool DesktopWindowTreeHostMus::IsMaximized() const { | 567 bool DesktopWindowTreeHostMus::IsMaximized() const { |
| 561 return window()->GetProperty(aura::client::kShowStateKey) == | 568 return window()->GetProperty(aura::client::kShowStateKey) == |
| 562 ui::SHOW_STATE_MAXIMIZED; | 569 ui::SHOW_STATE_MAXIMIZED; |
| 563 } | 570 } |
| 564 | 571 |
| 565 bool DesktopWindowTreeHostMus::IsMinimized() const { | 572 bool DesktopWindowTreeHostMus::IsMinimized() const { |
| 566 return window()->GetProperty(aura::client::kShowStateKey) == | 573 return window()->GetProperty(aura::client::kShowStateKey) == |
| 567 ui::SHOW_STATE_MINIMIZED; | 574 ui::SHOW_STATE_MINIMIZED; |
| 568 } | 575 } |
| 569 | 576 |
| 577 bool DesktopWindowTreeHostMus::IsPinned() const { |
| 578 aura::client::WindowPinType type = |
| 579 window()->GetProperty(aura::client::kWindowPinTypeKey); |
| 580 return type == aura::client::WindowPinType::PINNED || |
| 581 type == aura::client::WindowPinType::TRUSTED_PINNED; |
| 582 } |
| 583 |
| 570 bool DesktopWindowTreeHostMus::HasCapture() const { | 584 bool DesktopWindowTreeHostMus::HasCapture() const { |
| 571 // Capture state is held by DesktopNativeWidgetAura::content_window_. | 585 // Capture state is held by DesktopNativeWidgetAura::content_window_. |
| 572 // DesktopNativeWidgetAura::HasCapture() calls content_window_->HasCapture(), | 586 // DesktopNativeWidgetAura::HasCapture() calls content_window_->HasCapture(), |
| 573 // and this. That means this function can always return true. | 587 // and this. That means this function can always return true. |
| 574 return true; | 588 return true; |
| 575 } | 589 } |
| 576 | 590 |
| 577 void DesktopWindowTreeHostMus::SetAlwaysOnTop(bool always_on_top) { | 591 void DesktopWindowTreeHostMus::SetAlwaysOnTop(bool always_on_top) { |
| 578 window()->SetProperty(aura::client::kAlwaysOnTopKey, always_on_top); | 592 window()->SetProperty(aura::client::kAlwaysOnTopKey, always_on_top); |
| 579 } | 593 } |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 aura::client::FocusClient* focus_client, | 809 aura::client::FocusClient* focus_client, |
| 796 aura::Window* window) { | 810 aura::Window* window) { |
| 797 if (window == this->window()) { | 811 if (window == this->window()) { |
| 798 desktop_native_widget_aura_->HandleActivationChanged(true); | 812 desktop_native_widget_aura_->HandleActivationChanged(true); |
| 799 } else if (is_active_) { | 813 } else if (is_active_) { |
| 800 desktop_native_widget_aura_->HandleActivationChanged(false); | 814 desktop_native_widget_aura_->HandleActivationChanged(false); |
| 801 } | 815 } |
| 802 } | 816 } |
| 803 | 817 |
| 804 } // namespace views | 818 } // namespace views |
| OLD | NEW |