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

Unified Diff: ash/common/wm/default_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 side-by-side diff with in-line comments
Download patch
Index: ash/common/wm/default_state.cc
diff --git a/ash/common/wm/default_state.cc b/ash/common/wm/default_state.cc
index d7e49d9579bb57bb16e98241e359238de9cefeaf..280b61a56d8b099b3bce3abdf3fe485a02a03eb5 100644
--- a/ash/common/wm/default_state.cc
+++ b/ash/common/wm/default_state.cc
@@ -179,14 +179,20 @@ void DefaultState::OnWMEvent(WindowState* window_state, const WMEvent* event) {
: WINDOW_STATE_TYPE_NORMAL;
break;
case WM_EVENT_MAXIMIZE:
+ if (window_state->IsTrustedPinned())
+ return;
next_state_type = WINDOW_STATE_TYPE_MAXIMIZED;
break;
case WM_EVENT_MINIMIZE:
+ if (window_state->IsTrustedPinned())
+ return;
next_state_type = current_state_type == WINDOW_STATE_TYPE_DOCKED
? WINDOW_STATE_TYPE_DOCKED_MINIMIZED
: WINDOW_STATE_TYPE_MINIMIZED;
break;
case WM_EVENT_FULLSCREEN:
+ if (window_state->IsTrustedPinned())
+ return;
next_state_type = WINDOW_STATE_TYPE_FULLSCREEN;
break;
case WM_EVENT_SNAP_LEFT:
@@ -293,6 +299,8 @@ bool DefaultState::ProcessCompoundEvents(WindowState* window_state,
switch (event->type()) {
case WM_EVENT_TOGGLE_MAXIMIZE_CAPTION:
+ if (window_state->IsTrustedPinned())
+ return true;
if (window_state->IsFullscreen()) {
const wm::WMEvent event(wm::WM_EVENT_TOGGLE_FULLSCREEN);
window_state->OnWMEvent(&event);
@@ -304,6 +312,8 @@ bool DefaultState::ProcessCompoundEvents(WindowState* window_state,
}
return true;
case WM_EVENT_TOGGLE_MAXIMIZE:
+ if (window_state->IsTrustedPinned())
+ return true;
if (window_state->IsFullscreen()) {
const wm::WMEvent event(wm::WM_EVENT_TOGGLE_FULLSCREEN);
window_state->OnWMEvent(&event);
@@ -314,6 +324,8 @@ bool DefaultState::ProcessCompoundEvents(WindowState* window_state,
}
return true;
case WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE: {
+ if (window_state->IsTrustedPinned())
+ return true;
gfx::Rect work_area = GetDisplayWorkAreaBoundsInParent(window);
// Maximize vertically if:
@@ -338,6 +350,9 @@ bool DefaultState::ProcessCompoundEvents(WindowState* window_state,
return true;
}
case WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE: {
+ if (window_state->IsTrustedPinned())
+ return true;
+
// Maximize horizontally if:
// - The window does not have a max width defined.
// - The window is snapped or has the normal state type.
@@ -371,6 +386,8 @@ bool DefaultState::ProcessCompoundEvents(WindowState* window_state,
return true;
}
case WM_EVENT_TOGGLE_FULLSCREEN:
+ if (window_state->IsTrustedPinned())
+ return true;
ToggleFullScreen(window_state, window_state->delegate());
return true;
case WM_EVENT_CYCLE_SNAP_DOCK_LEFT:

Powered by Google App Engine
This is Rietveld 408576698