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

Unified Diff: ash/common/wm/default_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/aura/wm_shell_aura.cc ('k') | ash/common/wm/window_state.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/wm/default_state.cc
diff --git a/ash/common/wm/default_state.cc b/ash/common/wm/default_state.cc
index 2579ff16311b176a91f3339c9ec329f23777443b..22ef5c841ef2205d6287f693897dba687e8dcae2 100644
--- a/ash/common/wm/default_state.cc
+++ b/ash/common/wm/default_state.cc
@@ -205,10 +205,17 @@ void DefaultState::OnWMEvent(WindowState* window_state, const WMEvent* event) {
next_state_type = WINDOW_STATE_TYPE_INACTIVE;
break;
case WM_EVENT_PIN:
- // TODO(hidehiko): Check if the window can be pinnable. If a system modal
- // window is openening, or if there already is another pinned window,
- // the pinning should fail.
- next_state_type = WINDOW_STATE_TYPE_PINNED;
+ // If there already is a pinned window, it is not allowed to set it
+ // to this window.
+ // TODO(hidehiko): If a system modal window is openening, the pinning
+ // probably should fail.
+ if (WmShell::Get()->IsPinned()) {
+ LOG(ERROR) << "An PIN event is triggered, while another window is "
+ << "already in pinned mode.";
+ next_state_type = current_state_type;
+ } else {
+ next_state_type = WINDOW_STATE_TYPE_PINNED;
+ }
break;
case WM_EVENT_TOGGLE_MAXIMIZE_CAPTION:
case WM_EVENT_TOGGLE_MAXIMIZE:
@@ -579,7 +586,7 @@ void DefaultState::EnterToNextState(WindowState* window_state,
if (next_state_type == WINDOW_STATE_TYPE_PINNED ||
previous_state_type == WINDOW_STATE_TYPE_PINNED) {
- WmShell::Get()->NotifyPinnedStateChanged(window_state->window());
+ WmShell::Get()->SetPinnedWindow(window_state->window());
}
}
« no previous file with comments | « ash/aura/wm_shell_aura.cc ('k') | ash/common/wm/window_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698