| 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/threading/thread_task_runner_handle.h" | 8 #include "base/threading/thread_task_runner_handle.h" |
| 9 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
| 10 #include "ui/aura/client/cursor_client.h" | 10 #include "ui/aura/client/cursor_client.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 } // namespace | 170 } // namespace |
| 171 | 171 |
| 172 DesktopWindowTreeHostMus::DesktopWindowTreeHostMus( | 172 DesktopWindowTreeHostMus::DesktopWindowTreeHostMus( |
| 173 internal::NativeWidgetDelegate* native_widget_delegate, | 173 internal::NativeWidgetDelegate* native_widget_delegate, |
| 174 DesktopNativeWidgetAura* desktop_native_widget_aura, | 174 DesktopNativeWidgetAura* desktop_native_widget_aura, |
| 175 const std::map<std::string, std::vector<uint8_t>>* mus_properties) | 175 const std::map<std::string, std::vector<uint8_t>>* mus_properties) |
| 176 : aura::WindowTreeHostMus(MusClient::Get()->window_tree_client(), | 176 : aura::WindowTreeHostMus(MusClient::Get()->window_tree_client(), |
| 177 mus_properties), | 177 mus_properties), |
| 178 native_widget_delegate_(native_widget_delegate), | 178 native_widget_delegate_(native_widget_delegate), |
| 179 desktop_native_widget_aura_(desktop_native_widget_aura), | 179 desktop_native_widget_aura_(desktop_native_widget_aura), |
| 180 fullscreen_restore_state_(ui::SHOW_STATE_DEFAULT), | |
| 181 close_widget_factory_(this) { | 180 close_widget_factory_(this) { |
| 182 aura::Env::GetInstance()->AddObserver(this); | 181 aura::Env::GetInstance()->AddObserver(this); |
| 183 MusClient::Get()->AddObserver(this); | 182 MusClient::Get()->AddObserver(this); |
| 184 // DesktopNativeWidgetAura registers the association between |content_window_| | 183 // DesktopNativeWidgetAura registers the association between |content_window_| |
| 185 // and Widget, but code may also want to go from the root (window()) to the | 184 // and Widget, but code may also want to go from the root (window()) to the |
| 186 // Widget. This call enables that. | 185 // Widget. This call enables that. |
| 187 NativeWidgetAura::RegisterNativeWidgetForWindow(desktop_native_widget_aura, | 186 NativeWidgetAura::RegisterNativeWidgetForWindow(desktop_native_widget_aura, |
| 188 window()); | 187 window()); |
| 189 // TODO: use display id and bounds if available, likely need to pass in | 188 // TODO: use display id and bounds if available, likely need to pass in |
| 190 // InitParams for that. | 189 // InitParams for that. |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 bool DesktopWindowTreeHostMus::ShouldWindowContentsBeTransparent() const { | 588 bool DesktopWindowTreeHostMus::ShouldWindowContentsBeTransparent() const { |
| 590 return false; | 589 return false; |
| 591 } | 590 } |
| 592 | 591 |
| 593 void DesktopWindowTreeHostMus::FrameTypeChanged() {} | 592 void DesktopWindowTreeHostMus::FrameTypeChanged() {} |
| 594 | 593 |
| 595 void DesktopWindowTreeHostMus::SetFullscreen(bool fullscreen) { | 594 void DesktopWindowTreeHostMus::SetFullscreen(bool fullscreen) { |
| 596 if (IsFullscreen() == fullscreen) | 595 if (IsFullscreen() == fullscreen) |
| 597 return; // Nothing to do. | 596 return; // Nothing to do. |
| 598 | 597 |
| 599 // Save window state before entering full screen so that it could restored | |
| 600 // when exiting full screen. | |
| 601 if (fullscreen) { | |
| 602 fullscreen_restore_state_ = | |
| 603 window()->GetProperty(aura::client::kShowStateKey); | |
| 604 } | |
| 605 | |
| 606 window()->SetProperty( | 598 window()->SetProperty( |
| 607 aura::client::kShowStateKey, | 599 aura::client::kShowStateKey, |
| 608 fullscreen ? ui::SHOW_STATE_FULLSCREEN : fullscreen_restore_state_); | 600 fullscreen ? ui::SHOW_STATE_FULLSCREEN : ui::SHOW_STATE_PREVIOUS); |
| 609 } | 601 } |
| 610 | 602 |
| 611 bool DesktopWindowTreeHostMus::IsFullscreen() const { | 603 bool DesktopWindowTreeHostMus::IsFullscreen() const { |
| 612 return window()->GetProperty(aura::client::kShowStateKey) == | 604 return window()->GetProperty(aura::client::kShowStateKey) == |
| 613 ui::SHOW_STATE_FULLSCREEN; | 605 ui::SHOW_STATE_FULLSCREEN; |
| 614 } | 606 } |
| 615 void DesktopWindowTreeHostMus::SetOpacity(float opacity) { | 607 void DesktopWindowTreeHostMus::SetOpacity(float opacity) { |
| 616 // TODO: this likely need to go to server so that non-client decorations get | 608 // TODO: this likely need to go to server so that non-client decorations get |
| 617 // opacity. http://crbug.com/663619. | 609 // opacity. http://crbug.com/663619. |
| 618 window()->layer()->SetOpacity(opacity); | 610 window()->layer()->SetOpacity(opacity); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 if (window == this->window()) { | 705 if (window == this->window()) { |
| 714 is_active_ = true; | 706 is_active_ = true; |
| 715 desktop_native_widget_aura_->HandleActivationChanged(true); | 707 desktop_native_widget_aura_->HandleActivationChanged(true); |
| 716 } else if (is_active_) { | 708 } else if (is_active_) { |
| 717 is_active_ = false; | 709 is_active_ = false; |
| 718 desktop_native_widget_aura_->HandleActivationChanged(false); | 710 desktop_native_widget_aura_->HandleActivationChanged(false); |
| 719 } | 711 } |
| 720 } | 712 } |
| 721 | 713 |
| 722 } // namespace views | 714 } // namespace views |
| OLD | NEW |