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

Side by Side Diff: ash/common/wm/window_state.cc

Issue 2072853002: Implement "pinned" mode in ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 6 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 | « ash/common/wm/default_state.cc ('k') | ash/common/wm/workspace/workspace_layout_manager.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ash/common/wm/window_state.h" 5 #include "ash/common/wm/window_state.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/common/wm/default_state.h" 9 #include "ash/common/wm/default_state.h"
10 #include "ash/common/wm/window_positioning_utils.h" 10 #include "ash/common/wm/window_positioning_utils.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 179 }
180 180
181 void WindowState::Restore() { 181 void WindowState::Restore() {
182 if (!IsNormalStateType()) { 182 if (!IsNormalStateType()) {
183 const WMEvent event(WM_EVENT_NORMAL); 183 const WMEvent event(WM_EVENT_NORMAL);
184 OnWMEvent(&event); 184 OnWMEvent(&event);
185 } 185 }
186 } 186 }
187 187
188 void WindowState::DisableAlwaysOnTop(WmWindow* window_on_top) { 188 void WindowState::DisableAlwaysOnTop(WmWindow* window_on_top) {
189 DCHECK(window_on_top);
190 if (GetAlwaysOnTop()) { 189 if (GetAlwaysOnTop()) {
191 // |window_| is hidden first to avoid canceling fullscreen mode when it is 190 // |window_| is hidden first to avoid canceling fullscreen mode when it is
192 // no longer always on top and gets added to default container. This avoids 191 // no longer always on top and gets added to default container. This avoids
193 // sending redundant OnFullscreenStateChanged to the layout manager. The 192 // sending redundant OnFullscreenStateChanged to the layout manager. The
194 // |window_| visibility is restored after it no longer obscures the 193 // |window_| visibility is restored after it no longer obscures the
195 // |window_on_top|. 194 // |window_on_top|.
196 bool visible = window_->IsVisible(); 195 bool visible = window_->IsVisible();
197 if (visible) 196 if (visible)
198 window_->Hide(); 197 window_->Hide();
199 window_->SetAlwaysOnTop(false); 198 window_->SetAlwaysOnTop(false);
200 // Technically it is possible that a |window_| could make itself 199 // Technically it is possible that a |window_| could make itself
201 // always_on_top really quickly. This is probably not a realistic case but 200 // always_on_top really quickly. This is probably not a realistic case but
202 // check if the two windows are in the same container just in case. 201 // check if the two windows are in the same container just in case.
203 if (window_on_top->GetParent() == window_->GetParent()) 202 if (window_on_top && window_on_top->GetParent() == window_->GetParent())
204 window_->GetParent()->StackChildAbove(window_on_top, window_); 203 window_->GetParent()->StackChildAbove(window_on_top, window_);
205 if (visible) 204 if (visible)
206 window_->Show(); 205 window_->Show();
207 cached_always_on_top_ = true; 206 cached_always_on_top_ = true;
208 } 207 }
209 } 208 }
210 209
211 void WindowState::RestoreAlwaysOnTop() { 210 void WindowState::RestoreAlwaysOnTop() {
212 if (delegate() && delegate()->RestoreAlwaysOnTop(this)) 211 if (delegate() && delegate()->RestoreAlwaysOnTop(this))
213 return; 212 return;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 if (!window_->GetTargetVisibility()) { 397 if (!window_->GetTargetVisibility()) {
399 SetBoundsConstrained(new_bounds); 398 SetBoundsConstrained(new_bounds);
400 return; 399 return;
401 } 400 }
402 401
403 window_->SetBoundsDirectCrossFade(new_bounds); 402 window_->SetBoundsDirectCrossFade(new_bounds);
404 } 403 }
405 404
406 } // namespace wm 405 } // namespace wm
407 } // namespace ash 406 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/default_state.cc ('k') | ash/common/wm/workspace/workspace_layout_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698