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

Side by Side Diff: ash/wm/maximize_mode/maximize_mode_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/shell.cc ('k') | ash/wm/overview/window_selector_controller.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/wm/maximize_mode/maximize_mode_window_state.h" 5 #include "ash/wm/maximize_mode/maximize_mode_window_state.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/aura/wm_window_aura.h" 9 #include "ash/aura/wm_window_aura.h"
10 #include "ash/common/shell_window_ids.h" 10 #include "ash/common/shell_window_ids.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 void MaximizeModeWindowState::OnWMEvent(wm::WindowState* window_state, 123 void MaximizeModeWindowState::OnWMEvent(wm::WindowState* window_state,
124 const wm::WMEvent* event) { 124 const wm::WMEvent* event) {
125 switch (event->type()) { 125 switch (event->type()) {
126 case wm::WM_EVENT_TOGGLE_FULLSCREEN: 126 case wm::WM_EVENT_TOGGLE_FULLSCREEN:
127 ToggleFullScreen(window_state, window_state->delegate()); 127 ToggleFullScreen(window_state, window_state->delegate());
128 break; 128 break;
129 case wm::WM_EVENT_FULLSCREEN: 129 case wm::WM_EVENT_FULLSCREEN:
130 UpdateWindow(window_state, wm::WINDOW_STATE_TYPE_FULLSCREEN, true); 130 UpdateWindow(window_state, wm::WINDOW_STATE_TYPE_FULLSCREEN, true);
131 break; 131 break;
132 case wm::WM_EVENT_PIN: 132 case wm::WM_EVENT_PIN:
133 UpdateWindow(window_state, wm::WINDOW_STATE_TYPE_PINNED, true); 133 if (!WmShell::Get()->IsPinned())
134 UpdateWindow(window_state, wm::WINDOW_STATE_TYPE_PINNED, true);
134 break; 135 break;
135 case wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION: 136 case wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION:
136 case wm::WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE: 137 case wm::WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE:
137 case wm::WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE: 138 case wm::WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE:
138 case wm::WM_EVENT_TOGGLE_MAXIMIZE: 139 case wm::WM_EVENT_TOGGLE_MAXIMIZE:
139 case wm::WM_EVENT_CYCLE_SNAP_DOCK_LEFT: 140 case wm::WM_EVENT_CYCLE_SNAP_DOCK_LEFT:
140 case wm::WM_EVENT_CYCLE_SNAP_DOCK_RIGHT: 141 case wm::WM_EVENT_CYCLE_SNAP_DOCK_RIGHT:
141 case wm::WM_EVENT_CENTER: 142 case wm::WM_EVENT_CENTER:
142 case wm::WM_EVENT_SNAP_LEFT: 143 case wm::WM_EVENT_SNAP_LEFT:
143 case wm::WM_EVENT_SNAP_RIGHT: 144 case wm::WM_EVENT_SNAP_RIGHT:
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 275
275 const wm::WindowStateType old_state_type = current_state_type_; 276 const wm::WindowStateType old_state_type = current_state_type_;
276 current_state_type_ = target_state; 277 current_state_type_ = target_state;
277 window_state->UpdateWindowShowStateFromStateType(); 278 window_state->UpdateWindowShowStateFromStateType();
278 window_state->NotifyPreStateTypeChange(old_state_type); 279 window_state->NotifyPreStateTypeChange(old_state_type);
279 UpdateBounds(window_state, animated); 280 UpdateBounds(window_state, animated);
280 window_state->NotifyPostStateTypeChange(old_state_type); 281 window_state->NotifyPostStateTypeChange(old_state_type);
281 282
282 if (old_state_type == wm::WINDOW_STATE_TYPE_PINNED || 283 if (old_state_type == wm::WINDOW_STATE_TYPE_PINNED ||
283 target_state == wm::WINDOW_STATE_TYPE_PINNED) { 284 target_state == wm::WINDOW_STATE_TYPE_PINNED) {
284 WmShell::Get()->NotifyPinnedStateChanged(window_state->window()); 285 WmShell::Get()->SetPinnedWindow(window_state->window());
285 } 286 }
286 287
287 if ((window_state->window()->GetTargetVisibility() || 288 if ((window_state->window()->GetTargetVisibility() ||
288 old_state_type == wm::WINDOW_STATE_TYPE_MINIMIZED) && 289 old_state_type == wm::WINDOW_STATE_TYPE_MINIMIZED) &&
289 !window_state->window()->GetLayer()->visible()) { 290 !window_state->window()->GetLayer()->visible()) {
290 // The layer may be hidden if the window was previously minimized. Make 291 // The layer may be hidden if the window was previously minimized. Make
291 // sure it's visible. 292 // sure it's visible.
292 window_state->window()->Show(); 293 window_state->window()->Show();
293 } 294 }
294 } 295 }
(...skipping 22 matching lines...) Expand all
317 // avoid flashing. 318 // avoid flashing.
318 if (window_state->IsMaximized()) 319 if (window_state->IsMaximized())
319 window_state->SetBoundsDirectCrossFade(bounds_in_parent); 320 window_state->SetBoundsDirectCrossFade(bounds_in_parent);
320 else 321 else
321 window_state->SetBoundsDirectAnimated(bounds_in_parent); 322 window_state->SetBoundsDirectAnimated(bounds_in_parent);
322 } 323 }
323 } 324 }
324 } 325 }
325 326
326 } // namespace ash 327 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell.cc ('k') | ash/wm/overview/window_selector_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698