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

Side by Side Diff: chrome/browser/ui/views/apps/chrome_native_app_window_views_aura.cc

Issue 2622053004: ash: Restore previous show state after exiting fullscreen. (Closed)
Patch Set: Add unittest for fullscreen 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/ui/views/apps/chrome_native_app_window_views_aura.h" 5 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views_aura.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "apps/ui/views/app_window_frame_view.h" 9 #include "apps/ui/views/app_window_frame_view.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 // window. The root window does not have a delegate, which is needed to 86 // window. The root window does not have a delegate, which is needed to
87 // handle the event in Linux. 87 // handle the event in Linux.
88 window->SetEventTargeter( 88 window->SetEventTargeter(
89 std::unique_ptr<ui::EventTargeter>(new AppWindowEasyResizeWindowTargeter( 89 std::unique_ptr<ui::EventTargeter>(new AppWindowEasyResizeWindowTargeter(
90 window, gfx::Insets(frame->resize_inside_bounds_size()), this))); 90 window, gfx::Insets(frame->resize_inside_bounds_size()), this)));
91 91
92 return frame; 92 return frame;
93 } 93 }
94 94
95 ui::WindowShowState ChromeNativeAppWindowViewsAura::GetRestoredState() const { 95 ui::WindowShowState ChromeNativeAppWindowViewsAura::GetRestoredState() const {
96 // Use kRestoreShowStateKey in case a window is minimized/hidden. 96 // Use kPreMinimizedShowStateKey in case a window is minimized/hidden.
sky 2017/01/18 22:59:49 Shouldn't this check the current state and then us
Peng 2017/01/19 14:12:38 Looks like this function is used for saving the wi
sky 2017/01/19 16:58:57 This should return the current state. Why does it
Peng 2017/01/19 20:20:03 I think this function is used for getting and savi
sky 2017/01/19 21:55:38 I believe this function is the same as NativeWidge
Peng 2017/01/20 19:18:01 I tried return current show state in this function
97 ui::WindowShowState restore_state = widget()->GetNativeWindow()->GetProperty( 97 ui::WindowShowState restore_state = widget()->GetNativeWindow()->GetProperty(
sky 2017/01/19 16:58:57 Please move this to where it's needed.
Peng 2017/01/19 20:20:03 Done.
98 aura::client::kRestoreShowStateKey); 98 aura::client::kPreMinimizedShowStateKey);
99 99
100 // First normal states are checked. 100 // First normal states are checked.
101 if (IsMaximized()) 101 if (IsMaximized())
102 return ui::SHOW_STATE_MAXIMIZED; 102 return ui::SHOW_STATE_MAXIMIZED;
103 if (IsFullscreen()) { 103 if (IsFullscreen()) {
104 return ui::SHOW_STATE_FULLSCREEN; 104 return ui::SHOW_STATE_FULLSCREEN;
105 } 105 }
106 106
107 if (widget()->GetNativeWindow()->GetProperty( 107 if (widget()->GetNativeWindow()->GetProperty(aura::client::kShowStateKey) ==
108 aura::client::kShowStateKey) == ui::SHOW_STATE_DOCKED || 108 ui::SHOW_STATE_DOCKED ||
sky 2017/01/19 16:58:57 Why can't this function return the showstate alway
Peng 2017/01/19 20:20:03 I cannot find GetRestoredState() in NativeWidgteAu
109 widget()->GetNativeWindow()->GetProperty( 109 widget()->GetNativeWindow()->GetProperty(
110 aura::client::kRestoreShowStateKey) == ui::SHOW_STATE_DOCKED) { 110 aura::client::kPreMinimizedShowStateKey) == ui::SHOW_STATE_DOCKED) {
111 return ui::SHOW_STATE_DOCKED; 111 return ui::SHOW_STATE_DOCKED;
112 } 112 }
113 113
114 return GetRestorableState(restore_state); 114 return GetRestorableState(restore_state);
115 } 115 }
116 116
117 bool ChromeNativeAppWindowViewsAura::IsAlwaysOnTop() const { 117 bool ChromeNativeAppWindowViewsAura::IsAlwaysOnTop() const {
118 return widget()->IsAlwaysOnTop(); 118 return widget()->IsAlwaysOnTop();
119 } 119 }
120 120
121 void ChromeNativeAppWindowViewsAura::UpdateShape( 121 void ChromeNativeAppWindowViewsAura::UpdateShape(
122 std::unique_ptr<SkRegion> region) { 122 std::unique_ptr<SkRegion> region) {
123 bool had_shape = !!shape(); 123 bool had_shape = !!shape();
124 124
125 ChromeNativeAppWindowViews::UpdateShape(std::move(region)); 125 ChromeNativeAppWindowViews::UpdateShape(std::move(region));
126 126
127 aura::Window* native_window = widget()->GetNativeWindow(); 127 aura::Window* native_window = widget()->GetNativeWindow();
128 if (shape() && !had_shape) { 128 if (shape() && !had_shape) {
129 native_window->SetEventTargeter(std::unique_ptr<ui::EventTargeter>( 129 native_window->SetEventTargeter(std::unique_ptr<ui::EventTargeter>(
130 new ShapedAppWindowTargeter(native_window, this))); 130 new ShapedAppWindowTargeter(native_window, this)));
131 } else if (!shape() && had_shape) { 131 } else if (!shape() && had_shape) {
132 native_window->SetEventTargeter(std::unique_ptr<ui::EventTargeter>()); 132 native_window->SetEventTargeter(std::unique_ptr<ui::EventTargeter>());
133 } 133 }
134 } 134 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698