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

Side by Side Diff: ui/views/widget/native_widget_aura.cc

Issue 2625113004: Unify window fullscreen and minimizing implementation (Closed)
Patch Set: Fix review issue Created 3 years, 11 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/widget/native_widget_aura.h ('k') | ui/wm/core/window_util.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/widget/native_widget_aura.h" 5 #include "ui/views/widget/native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 NativeWidgetAura::NativeWidgetAura(internal::NativeWidgetDelegate* delegate, 102 NativeWidgetAura::NativeWidgetAura(internal::NativeWidgetDelegate* delegate,
103 bool is_parallel_widget_in_window_manager) 103 bool is_parallel_widget_in_window_manager)
104 : delegate_(delegate), 104 : delegate_(delegate),
105 is_parallel_widget_in_window_manager_( 105 is_parallel_widget_in_window_manager_(
106 is_parallel_widget_in_window_manager), 106 is_parallel_widget_in_window_manager),
107 window_(new aura::Window(this)), 107 window_(new aura::Window(this)),
108 ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET), 108 ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET),
109 destroying_(false), 109 destroying_(false),
110 cursor_(gfx::kNullCursor), 110 cursor_(gfx::kNullCursor),
111 saved_window_state_(ui::SHOW_STATE_DEFAULT),
112 close_widget_factory_(this) { 111 close_widget_factory_(this) {
113 aura::client::SetFocusChangeObserver(window_, this); 112 aura::client::SetFocusChangeObserver(window_, this);
114 aura::client::SetActivationChangeObserver(window_, this); 113 aura::client::SetActivationChangeObserver(window_, this);
115 } 114 }
116 115
117 // static 116 // static
118 void NativeWidgetAura::RegisterNativeWidgetForWindow( 117 void NativeWidgetAura::RegisterNativeWidgetForWindow(
119 internal::NativeWidgetPrivate* native_widget, 118 internal::NativeWidgetPrivate* native_widget,
120 aura::Window* window) { 119 aura::Window* window) {
121 window->SetProperty(kNativeWidgetPrivateKey, native_widget); 120 window->SetProperty(kNativeWidgetPrivateKey, native_widget);
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 625
627 void NativeWidgetAura::Restore() { 626 void NativeWidgetAura::Restore() {
628 if (window_) 627 if (window_)
629 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); 628 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
630 } 629 }
631 630
632 void NativeWidgetAura::SetFullscreen(bool fullscreen) { 631 void NativeWidgetAura::SetFullscreen(bool fullscreen) {
633 if (!window_ || IsFullscreen() == fullscreen) 632 if (!window_ || IsFullscreen() == fullscreen)
634 return; // Nothing to do. 633 return; // Nothing to do.
635 634
636 // Save window state before entering full screen so that it could restored 635 wm::SetWindowFullscreen(window_, fullscreen);
637 // when exiting full screen.
638 if (fullscreen)
639 saved_window_state_ = window_->GetProperty(aura::client::kShowStateKey);
640
641 window_->SetProperty(
642 aura::client::kShowStateKey,
643 fullscreen ? ui::SHOW_STATE_FULLSCREEN : saved_window_state_);
644 } 636 }
645 637
646 bool NativeWidgetAura::IsFullscreen() const { 638 bool NativeWidgetAura::IsFullscreen() const {
647 return window_ && window_->GetProperty(aura::client::kShowStateKey) == 639 return window_ && window_->GetProperty(aura::client::kShowStateKey) ==
648 ui::SHOW_STATE_FULLSCREEN; 640 ui::SHOW_STATE_FULLSCREEN;
649 } 641 }
650 642
651 void NativeWidgetAura::SetOpacity(float opacity) { 643 void NativeWidgetAura::SetOpacity(float opacity) {
652 if (window_) 644 if (window_)
653 window_->layer()->SetOpacity(opacity); 645 window_->layer()->SetOpacity(opacity);
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 gfx::NativeView native_view) { 1231 gfx::NativeView native_view) {
1240 aura::client::CaptureClient* capture_client = 1232 aura::client::CaptureClient* capture_client =
1241 aura::client::GetCaptureClient(native_view->GetRootWindow()); 1233 aura::client::GetCaptureClient(native_view->GetRootWindow());
1242 if (!capture_client) 1234 if (!capture_client)
1243 return nullptr; 1235 return nullptr;
1244 return capture_client->GetGlobalCaptureWindow(); 1236 return capture_client->GetGlobalCaptureWindow();
1245 } 1237 }
1246 1238
1247 } // namespace internal 1239 } // namespace internal
1248 } // namespace views 1240 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/native_widget_aura.h ('k') | ui/wm/core/window_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698