Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: ui/views/mus/desktop_window_tree_host_mus.cc

Issue 2625113004: Unify window fullscreen and minimizing implementation (Closed)
Patch Set: Fix review issue Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/mus/desktop_window_tree_host_mus.h ('k') | ui/views/widget/native_widget_aura.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 native_widget_delegate_->AsWidget()->AddObserver(this); 183 native_widget_delegate_->AsWidget()->AddObserver(this);
185 // DesktopNativeWidgetAura registers the association between |content_window_| 184 // DesktopNativeWidgetAura registers the association between |content_window_|
186 // and Widget, but code may also want to go from the root (window()) to the 185 // and Widget, but code may also want to go from the root (window()) to the
187 // Widget. This call enables that. 186 // Widget. This call enables that.
188 NativeWidgetAura::RegisterNativeWidgetForWindow(desktop_native_widget_aura, 187 NativeWidgetAura::RegisterNativeWidgetForWindow(desktop_native_widget_aura,
189 window()); 188 window());
190 // TODO: use display id and bounds if available, likely need to pass in 189 // TODO: use display id and bounds if available, likely need to pass in
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 bool DesktopWindowTreeHostMus::ShouldWindowContentsBeTransparent() const { 598 bool DesktopWindowTreeHostMus::ShouldWindowContentsBeTransparent() const {
600 return false; 599 return false;
601 } 600 }
602 601
603 void DesktopWindowTreeHostMus::FrameTypeChanged() {} 602 void DesktopWindowTreeHostMus::FrameTypeChanged() {}
604 603
605 void DesktopWindowTreeHostMus::SetFullscreen(bool fullscreen) { 604 void DesktopWindowTreeHostMus::SetFullscreen(bool fullscreen) {
606 if (IsFullscreen() == fullscreen) 605 if (IsFullscreen() == fullscreen)
607 return; // Nothing to do. 606 return; // Nothing to do.
608 607
609 // Save window state before entering full screen so that it could restored 608 wm::SetWindowFullscreen(window(), fullscreen);
610 // when exiting full screen.
611 if (fullscreen) {
612 fullscreen_restore_state_ =
613 window()->GetProperty(aura::client::kShowStateKey);
614 }
615
616 window()->SetProperty(
617 aura::client::kShowStateKey,
618 fullscreen ? ui::SHOW_STATE_FULLSCREEN : fullscreen_restore_state_);
619 } 609 }
620 610
621 bool DesktopWindowTreeHostMus::IsFullscreen() const { 611 bool DesktopWindowTreeHostMus::IsFullscreen() const {
622 return window()->GetProperty(aura::client::kShowStateKey) == 612 return window()->GetProperty(aura::client::kShowStateKey) ==
623 ui::SHOW_STATE_FULLSCREEN; 613 ui::SHOW_STATE_FULLSCREEN;
624 } 614 }
625 void DesktopWindowTreeHostMus::SetOpacity(float opacity) { 615 void DesktopWindowTreeHostMus::SetOpacity(float opacity) {
626 // TODO: this likely need to go to server so that non-client decorations get 616 // TODO: this likely need to go to server so that non-client decorations get
627 // opacity. http://crbug.com/663619. 617 // opacity. http://crbug.com/663619.
628 window()->layer()->SetOpacity(opacity); 618 window()->layer()->SetOpacity(opacity);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 aura::client::FocusClient* focus_client, 720 aura::client::FocusClient* focus_client,
731 aura::Window* window) { 721 aura::Window* window) {
732 if (window == this->window()) { 722 if (window == this->window()) {
733 desktop_native_widget_aura_->HandleActivationChanged(true); 723 desktop_native_widget_aura_->HandleActivationChanged(true);
734 } else if (is_active_) { 724 } else if (is_active_) {
735 desktop_native_widget_aura_->HandleActivationChanged(false); 725 desktop_native_widget_aura_->HandleActivationChanged(false);
736 } 726 }
737 } 727 }
738 728
739 } // namespace views 729 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/desktop_window_tree_host_mus.h ('k') | ui/views/widget/native_widget_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698