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

Side by Side Diff: ash/common/wm/maximize_mode/maximize_mode_window_state.cc

Issue 2590123002: Prevent maximize/minimize/fullscreen-ize window in trusted pinned mode. (Closed)
Patch Set: Created 4 years 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 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/common/wm/maximize_mode/maximize_mode_window_state.h" 5 #include "ash/common/wm/maximize_mode/maximize_mode_window_state.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/common/wm/maximize_mode/maximize_mode_window_manager.h" 9 #include "ash/common/wm/maximize_mode/maximize_mode_window_manager.h"
10 #include "ash/common/wm/window_animation_types.h" 10 #include "ash/common/wm/window_animation_types.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 126
127 defer_bounds_updates_ = defer_bounds_updates; 127 defer_bounds_updates_ = defer_bounds_updates;
128 if (!defer_bounds_updates_) 128 if (!defer_bounds_updates_)
129 UpdateBounds(window_->GetWindowState(), true); 129 UpdateBounds(window_->GetWindowState(), true);
130 } 130 }
131 131
132 void MaximizeModeWindowState::OnWMEvent(wm::WindowState* window_state, 132 void MaximizeModeWindowState::OnWMEvent(wm::WindowState* window_state,
133 const wm::WMEvent* event) { 133 const wm::WMEvent* event) {
134 switch (event->type()) { 134 switch (event->type()) {
135 case wm::WM_EVENT_TOGGLE_FULLSCREEN: 135 case wm::WM_EVENT_TOGGLE_FULLSCREEN:
136 if (window_state->IsTrustedPinned())
137 return;
oshima 2016/12/21 01:38:58 FYI: ARC windows are no longer using this class. W
hidehiko 2016/12/21 06:57:30 Thanks, so reverted this file. Let's address remov
136 ToggleFullScreen(window_state, window_state->delegate()); 138 ToggleFullScreen(window_state, window_state->delegate());
137 break; 139 break;
138 case wm::WM_EVENT_FULLSCREEN: 140 case wm::WM_EVENT_FULLSCREEN:
141 if (window_state->IsTrustedPinned())
142 return;
139 UpdateWindow(window_state, wm::WINDOW_STATE_TYPE_FULLSCREEN, true); 143 UpdateWindow(window_state, wm::WINDOW_STATE_TYPE_FULLSCREEN, true);
140 break; 144 break;
141 case wm::WM_EVENT_PIN: 145 case wm::WM_EVENT_PIN:
142 if (!WmShell::Get()->IsPinned()) 146 if (!WmShell::Get()->IsPinned())
143 UpdateWindow(window_state, wm::WINDOW_STATE_TYPE_PINNED, true); 147 UpdateWindow(window_state, wm::WINDOW_STATE_TYPE_PINNED, true);
144 break; 148 break;
145 case wm::WM_EVENT_TRUSTED_PIN: 149 case wm::WM_EVENT_TRUSTED_PIN:
146 if (!WmShell::Get()->IsPinned()) 150 if (!WmShell::Get()->IsPinned())
147 UpdateWindow(window_state, wm::WINDOW_STATE_TYPE_TRUSTED_PINNED, true); 151 UpdateWindow(window_state, wm::WINDOW_STATE_TYPE_TRUSTED_PINNED, true);
148 break; 152 break;
149 case wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION: 153 case wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION:
150 case wm::WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE: 154 case wm::WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE:
151 case wm::WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE: 155 case wm::WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE:
152 case wm::WM_EVENT_TOGGLE_MAXIMIZE: 156 case wm::WM_EVENT_TOGGLE_MAXIMIZE:
157 case wm::WM_EVENT_MAXIMIZE:
158 if (window_state->IsTrustedPinned())
159 return;
160 // Fall through.
153 case wm::WM_EVENT_CYCLE_SNAP_DOCK_LEFT: 161 case wm::WM_EVENT_CYCLE_SNAP_DOCK_LEFT:
154 case wm::WM_EVENT_CYCLE_SNAP_DOCK_RIGHT: 162 case wm::WM_EVENT_CYCLE_SNAP_DOCK_RIGHT:
155 case wm::WM_EVENT_CENTER: 163 case wm::WM_EVENT_CENTER:
156 case wm::WM_EVENT_SNAP_LEFT: 164 case wm::WM_EVENT_SNAP_LEFT:
157 case wm::WM_EVENT_SNAP_RIGHT: 165 case wm::WM_EVENT_SNAP_RIGHT:
158 case wm::WM_EVENT_NORMAL: 166 case wm::WM_EVENT_NORMAL:
159 case wm::WM_EVENT_MAXIMIZE:
160 case wm::WM_EVENT_DOCK: 167 case wm::WM_EVENT_DOCK:
161 UpdateWindow(window_state, GetMaximizedOrCenteredWindowType(window_state), 168 UpdateWindow(window_state, GetMaximizedOrCenteredWindowType(window_state),
162 true); 169 true);
163 return; 170 return;
164 case wm::WM_EVENT_MINIMIZE: 171 case wm::WM_EVENT_MINIMIZE:
172 if (window_state->IsTrustedPinned())
173 return;
165 UpdateWindow(window_state, wm::WINDOW_STATE_TYPE_MINIMIZED, true); 174 UpdateWindow(window_state, wm::WINDOW_STATE_TYPE_MINIMIZED, true);
166 return; 175 return;
167 case wm::WM_EVENT_SHOW_INACTIVE: 176 case wm::WM_EVENT_SHOW_INACTIVE:
168 return; 177 return;
169 case wm::WM_EVENT_SET_BOUNDS: 178 case wm::WM_EVENT_SET_BOUNDS:
170 if (window_state->allow_set_bounds_in_maximized()) { 179 if (window_state->allow_set_bounds_in_maximized()) {
171 window_state->SetBoundsConstrained( 180 window_state->SetBoundsConstrained(
172 static_cast<const wm::SetBoundsEvent*>(event)->requested_bounds()); 181 static_cast<const wm::SetBoundsEvent*>(event)->requested_bounds());
173 } else if (current_state_type_ == wm::WINDOW_STATE_TYPE_MAXIMIZED) { 182 } else if (current_state_type_ == wm::WINDOW_STATE_TYPE_MAXIMIZED) {
174 // Having a maximized window, it could have been created with an empty 183 // Having a maximized window, it could have been created with an empty
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 // avoid flashing. 337 // avoid flashing.
329 if (window_state->IsMaximized()) 338 if (window_state->IsMaximized())
330 window_state->SetBoundsDirectCrossFade(bounds_in_parent); 339 window_state->SetBoundsDirectCrossFade(bounds_in_parent);
331 else 340 else
332 window_state->SetBoundsDirectAnimated(bounds_in_parent); 341 window_state->SetBoundsDirectAnimated(bounds_in_parent);
333 } 342 }
334 } 343 }
335 } 344 }
336 345
337 } // namespace ash 346 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698