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

Side by Side Diff: components/exo/shell_surface.cc

Issue 2250713006: Allow updating arc widget bounds in maximize/fullscreen state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 4 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/wm/window_state_unittest.cc ('k') | components/exo/shell_surface_unittest.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/exo/shell_surface.h" 5 #include "components/exo/shell_surface.h"
6 6
7 #include "ash/aura/wm_window_aura.h" 7 #include "ash/aura/wm_window_aura.h"
8 #include "ash/common/shell_window_ids.h" 8 #include "ash/common/shell_window_ids.h"
9 #include "ash/common/wm/window_resizer.h" 9 #include "ash/common/wm/window_resizer.h"
10 #include "ash/common/wm/window_state.h" 10 #include "ash/common/wm/window_state.h"
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 window->SetName("ExoShellSurface"); 923 window->SetName("ExoShellSurface");
924 window->AddChild(surface_->window()); 924 window->AddChild(surface_->window());
925 window->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter)); 925 window->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter));
926 SetApplicationId(window, &application_id_); 926 SetApplicationId(window, &application_id_);
927 SetMainSurface(window, surface_); 927 SetMainSurface(window, surface_);
928 928
929 // Start tracking changes to window bounds and window state. 929 // Start tracking changes to window bounds and window state.
930 window->AddObserver(this); 930 window->AddObserver(this);
931 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window); 931 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window);
932 window_state->AddObserver(this); 932 window_state->AddObserver(this);
933
934 // Absolete positioned shell surfaces may request the bounds that does not
935 // fill the entire work area / display in maximized / fullscreen state.
936 // Allow such clients to update the bounds in these states.
937 if (!initial_bounds_.IsEmpty())
938 window_state->set_allow_set_bounds_in_maximized(true);
939
933 // Notify client of initial state if different than normal. 940 // Notify client of initial state if different than normal.
934 if (window_state->GetStateType() != ash::wm::WINDOW_STATE_TYPE_NORMAL && 941 if (window_state->GetStateType() != ash::wm::WINDOW_STATE_TYPE_NORMAL &&
935 !state_changed_callback_.is_null()) { 942 !state_changed_callback_.is_null()) {
936 state_changed_callback_.Run(ash::wm::WINDOW_STATE_TYPE_NORMAL, 943 state_changed_callback_.Run(ash::wm::WINDOW_STATE_TYPE_NORMAL,
937 window_state->GetStateType()); 944 window_state->GetStateType());
938 } 945 }
939 946
940 // Disable movement if initial bounds were specified. 947 // Disable movement if initial bounds were specified.
941 widget_->set_movement_disabled(!initial_bounds_.IsEmpty()); 948 widget_->set_movement_disabled(!initial_bounds_.IsEmpty());
942 window_state->set_ignore_keyboard_bounds_change(!initial_bounds_.IsEmpty()); 949 window_state->set_ignore_keyboard_bounds_change(!initial_bounds_.IsEmpty());
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 default: 1155 default:
1149 NOTREACHED(); 1156 NOTREACHED();
1150 return gfx::Point(); 1157 return gfx::Point();
1151 } 1158 }
1152 } 1159 }
1153 1160
1154 void ShellSurface::UpdateWidgetBounds() { 1161 void ShellSurface::UpdateWidgetBounds() {
1155 DCHECK(widget_); 1162 DCHECK(widget_);
1156 1163
1157 // Return early if the shell is currently managing the bounds of the widget. 1164 // Return early if the shell is currently managing the bounds of the widget.
1158 if (widget_->IsMaximized() || widget_->IsFullscreen() || IsResizing()) 1165 // 1) When a window is either maximized/fullscreen/pinned, and the bounds
1166 // isn't controlled by a client.
1167 ash::wm::WindowState* window_state =
1168 ash::wm::GetWindowState(widget_->GetNativeWindow());
1169 if (window_state->IsMaximizedOrFullscreenOrPinned() &&
1170 !window_state->allow_set_bounds_in_maximized()) {
1171 return;
1172 }
1173
1174 // 2) When a window is being dragged.
1175 if (IsResizing())
1159 return; 1176 return;
1160 1177
1161 // Return early if there is pending configure requests. 1178 // Return early if there is pending configure requests.
1162 if (!pending_configs_.empty() || scoped_configure_) 1179 if (!pending_configs_.empty() || scoped_configure_)
1163 return; 1180 return;
1164 1181
1165 gfx::Rect visible_bounds = GetVisibleBounds(); 1182 gfx::Rect visible_bounds = GetVisibleBounds();
1166 gfx::Rect new_widget_bounds = visible_bounds; 1183 gfx::Rect new_widget_bounds = visible_bounds;
1167 1184
1168 // Avoid changing widget origin unless initial bounds were specificed and 1185 // Avoid changing widget origin unless initial bounds were specificed and
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 shadow_overlay_->layer()->Add(shadow->layer()); 1263 shadow_overlay_->layer()->Add(shadow->layer());
1247 window->AddChild(shadow_overlay_); 1264 window->AddChild(shadow_overlay_);
1248 shadow_overlay_->Show(); 1265 shadow_overlay_->Show();
1249 } 1266 }
1250 shadow_overlay_->SetBounds(shadow_bounds); 1267 shadow_overlay_->SetBounds(shadow_bounds);
1251 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); 1268 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size()));
1252 } 1269 }
1253 } 1270 }
1254 1271
1255 } // namespace exo 1272 } // namespace exo
OLDNEW
« no previous file with comments | « ash/wm/window_state_unittest.cc ('k') | components/exo/shell_surface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698