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

Unified Diff: ash/wm/maximize_mode/maximize_mode_window_state.cc

Issue 247363005: Fullscreen/immersive mode is allowed in touch view mode, the shelf gets hidden and an edge swipe br… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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/wm/maximize_mode/maximize_mode_window_state.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/maximize_mode/maximize_mode_window_state.cc
diff --git a/ash/wm/maximize_mode/maximize_mode_window_state.cc b/ash/wm/maximize_mode/maximize_mode_window_state.cc
index e823455d48e15688f8759c3194c0497bf2cd57b9..e2e9b51958fed420c2eae219a85a4bc2c7873a8d 100644
--- a/ash/wm/maximize_mode/maximize_mode_window_state.cc
+++ b/ash/wm/maximize_mode/maximize_mode_window_state.cc
@@ -45,8 +45,11 @@ gfx::Size GetMaximumSizeOfWindow(wm::WindowState* window_state) {
return size;
}
-// Returns the maximized and centered bounds of a window.
+// Returns the maximized/full screen and/or centered bounds of a window.
gfx::Rect GetMaximizedAndCenteredBounds(wm::WindowState* state_object) {
+ if (state_object->IsFullscreen())
+ return ScreenUtil::GetDisplayBoundsInParent(state_object->window());
+
gfx::Rect bounds_in_parent;
// Make the window as big as possible.
if (state_object->CanMaximize() || state_object->CanResize()) {
@@ -116,18 +119,25 @@ void MaximizeModeWindowState::LeaveMaximizeMode(wm::WindowState* window_state) {
void MaximizeModeWindowState::OnWMEvent(wm::WindowState* window_state,
const wm::WMEvent* event) {
switch (event->type()) {
+ case wm::WM_EVENT_TOGGLE_FULLSCREEN:
+ ShowWindow(window_state,
+ current_state_type_ != wm::WINDOW_STATE_TYPE_FULLSCREEN ?
+ FULL_SCREEN : MAXIMIZED_OR_CENTERED,
+ true);
oshima 2014/04/23 15:57:38 can you refactor the code in default_state and use
Mr4D (OOO till 08-26) 2014/04/23 19:20:31 Not quite sure what you want. Either way - that sh
Mr4D (OOO till 08-26) 2014/04/25 17:36:29 Your comment was a bit confusing. It sounded like
oshima 2014/04/25 18:46:55 Yes, that's what I meant. The same code should wor
+ break;
+ case wm::WM_EVENT_FULLSCREEN:
+ ShowWindow(window_state, FULL_SCREEN, true);
+ break;
case wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION:
case wm::WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE:
case wm::WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE:
- case wm::WM_EVENT_TOGGLE_FULLSCREEN:
case wm::WM_EVENT_TOGGLE_MAXIMIZE:
case wm::WM_EVENT_CENTER:
- case wm::WM_EVENT_FULLSCREEN:
case wm::WM_EVENT_SNAP_LEFT:
case wm::WM_EVENT_SNAP_RIGHT:
case wm::WM_EVENT_NORMAL:
case wm::WM_EVENT_MAXIMIZE:
- MaximizeOrCenterWindow(window_state, true);
+ ShowWindow(window_state, MAXIMIZED_OR_CENTERED, true);
return;
case wm::WM_EVENT_MINIMIZE:
if (current_state_type_ != wm::WINDOW_STATE_TYPE_MINIMIZED) {
@@ -142,7 +152,10 @@ void MaximizeModeWindowState::OnWMEvent(wm::WindowState* window_state,
window_state->CanResize()) {
// In case the window is resizable and / or maximized we ignore the
// requested bounds change and resize to the biggest possible size.
- MaximizeOrCenterWindow(window_state, true);
+ ShowWindow(window_state,
+ current_state_type_ == wm::WINDOW_STATE_TYPE_FULLSCREEN ?
+ FULL_SCREEN : MAXIMIZED_OR_CENTERED,
+ true);
} else if (current_state_type_ != wm::WINDOW_STATE_TYPE_MINIMIZED) {
// In all other cases (except for minimized windows) we respect the
// requested bounds and center it to a fully visible area on the screen.
@@ -156,12 +169,18 @@ void MaximizeModeWindowState::OnWMEvent(wm::WindowState* window_state,
}
break;
case wm::WM_EVENT_ADDED_TO_WORKSPACE:
- MaximizeOrCenterWindow(window_state, true);
+ ShowWindow(window_state,
+ current_state_type_ == wm::WINDOW_STATE_TYPE_FULLSCREEN ?
+ FULL_SCREEN : MAXIMIZED_OR_CENTERED,
+ true);
break;
case wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED:
case wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED:
if (current_state_type_ != wm::WINDOW_STATE_TYPE_MINIMIZED)
- MaximizeOrCenterWindow(window_state, false);
+ ShowWindow(window_state,
+ current_state_type_ == wm::WINDOW_STATE_TYPE_FULLSCREEN ?
+ FULL_SCREEN : MAXIMIZED_OR_CENTERED,
+ false);
break;
}
}
@@ -177,8 +196,9 @@ void MaximizeModeWindowState::AttachState(
// Initialize the state to a good preset.
if (current_state_type_ != wm::WINDOW_STATE_TYPE_MAXIMIZED &&
- current_state_type_ != wm::WINDOW_STATE_TYPE_MINIMIZED) {
- MaximizeOrCenterWindow(window_state, true);
+ current_state_type_ != wm::WINDOW_STATE_TYPE_MINIMIZED &&
+ current_state_type_ != wm::WINDOW_STATE_TYPE_FULLSCREEN) {
+ ShowWindow(window_state, MAXIMIZED_OR_CENTERED, true);
}
window_state->set_can_be_dragged(false);
@@ -188,12 +208,14 @@ void MaximizeModeWindowState::DetachState(wm::WindowState* window_state) {
window_state->set_can_be_dragged(true);
}
-void MaximizeModeWindowState::MaximizeOrCenterWindow(
+void MaximizeModeWindowState::ShowWindow(
wm::WindowState* window_state,
+ MaximizeModeWindowState::ShowState show_state,
bool animated) {
const wm::WindowStateType target_state =
- window_state->CanMaximize() ? wm::WINDOW_STATE_TYPE_MAXIMIZED :
- wm::WINDOW_STATE_TYPE_NORMAL;
+ show_state == FULL_SCREEN ? wm::WINDOW_STATE_TYPE_FULLSCREEN :
+ (window_state->CanMaximize() ? wm::WINDOW_STATE_TYPE_MAXIMIZED :
+ wm::WINDOW_STATE_TYPE_NORMAL);
const wm::WindowStateType old_state_type = current_state_type_;
gfx::Rect bounds_in_parent = GetMaximizedAndCenteredBounds(window_state);
« no previous file with comments | « ash/wm/maximize_mode/maximize_mode_window_state.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698