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

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

Issue 2237983002: Allow updating arc widget bounds in maximize/fullscreen state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Allow updating arc widget bounds in maximize/fullscreen state. 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 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 window->SetName("ExoShellSurface"); 925 window->SetName("ExoShellSurface");
926 window->AddChild(surface_->window()); 926 window->AddChild(surface_->window());
927 window->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter)); 927 window->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter));
928 SetApplicationId(window, &application_id_); 928 SetApplicationId(window, &application_id_);
929 SetMainSurface(window, surface_); 929 SetMainSurface(window, surface_);
930 930
931 // Start tracking changes to window bounds and window state. 931 // Start tracking changes to window bounds and window state.
932 window->AddObserver(this); 932 window->AddObserver(this);
933 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window); 933 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window);
934 window_state->AddObserver(this); 934 window_state->AddObserver(this);
935
936 // Absolete positioned shell surfaces may request the bounds that does not
937 // fill the entire work area / display in maximized / fullscreen state.
938 // Allow such clients to update the bounds in these states.
939 if (!initial_bounds_.IsEmpty())
940 window_state->set_allow_set_bounds_in_maximized(true);
941
935 // Notify client of initial state if different than normal. 942 // Notify client of initial state if different than normal.
936 if (window_state->GetStateType() != ash::wm::WINDOW_STATE_TYPE_NORMAL && 943 if (window_state->GetStateType() != ash::wm::WINDOW_STATE_TYPE_NORMAL &&
937 !state_changed_callback_.is_null()) { 944 !state_changed_callback_.is_null()) {
938 state_changed_callback_.Run(ash::wm::WINDOW_STATE_TYPE_NORMAL, 945 state_changed_callback_.Run(ash::wm::WINDOW_STATE_TYPE_NORMAL,
939 window_state->GetStateType()); 946 window_state->GetStateType());
940 } 947 }
941 948
942 // Disable movement if initial bounds were specified. 949 // Disable movement if initial bounds were specified.
943 widget_->set_movement_disabled(!initial_bounds_.IsEmpty()); 950 widget_->set_movement_disabled(!initial_bounds_.IsEmpty());
944 window_state->set_ignore_keyboard_bounds_change(!initial_bounds_.IsEmpty()); 951 window_state->set_ignore_keyboard_bounds_change(!initial_bounds_.IsEmpty());
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 default: 1153 default:
1147 NOTREACHED(); 1154 NOTREACHED();
1148 return gfx::Point(); 1155 return gfx::Point();
1149 } 1156 }
1150 } 1157 }
1151 1158
1152 void ShellSurface::UpdateWidgetBounds() { 1159 void ShellSurface::UpdateWidgetBounds() {
1153 DCHECK(widget_); 1160 DCHECK(widget_);
1154 1161
1155 // Return early if the shell is currently managing the bounds of the widget. 1162 // Return early if the shell is currently managing the bounds of the widget.
1156 if (widget_->IsMaximized() || widget_->IsFullscreen() || IsResizing()) 1163 // 1) When a window is either maximized/fullscreen/pinned, and the bounds
1164 // isn't controlled by a clientt.
reveman 2016/08/15 16:19:37 nit: client
oshima 2016/08/15 17:27:03 Done.
1165 // 2) When a window is being dragged.
reveman 2016/08/15 16:19:37 nit: move this comment below to the IsResizing ear
oshima 2016/08/15 17:27:03 Done.
1166 ash::wm::WindowState* window_state =
1167 ash::wm::GetWindowState(widget_->GetNativeWindow());
1168 if (window_state->IsMaximizedOrFullscreenOrPinned() &&
1169 !window_state->allow_set_bounds_in_maximized()) {
1157 return; 1170 return;
1171 }
1172
1173 if (IsResizing()) {
1174 return;
1175 }
reveman 2016/08/15 16:19:37 nit: no need for {} here
oshima 2016/08/15 17:27:03 Done.
1158 1176
1159 // Return early if there is pending configure requests. 1177 // Return early if there is pending configure requests.
1160 if (!pending_configs_.empty() || scoped_configure_) 1178 if (!pending_configs_.empty() || scoped_configure_)
1161 return; 1179 return;
1162 1180
1163 gfx::Rect visible_bounds = GetVisibleBounds(); 1181 gfx::Rect visible_bounds = GetVisibleBounds();
1164 gfx::Rect new_widget_bounds = visible_bounds; 1182 gfx::Rect new_widget_bounds = visible_bounds;
1165 1183
1166 // Avoid changing widget origin unless initial bounds were specified and 1184 // Avoid changing widget origin unless initial bounds were specified and
1167 // widget origin is always relative to it. 1185 // widget origin is always relative to it.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 shadow_overlay_->layer()->Add(shadow->layer()); 1260 shadow_overlay_->layer()->Add(shadow->layer());
1243 window->AddChild(shadow_overlay_); 1261 window->AddChild(shadow_overlay_);
1244 shadow_overlay_->Show(); 1262 shadow_overlay_->Show();
1245 } 1263 }
1246 shadow_overlay_->SetBounds(shadow_bounds); 1264 shadow_overlay_->SetBounds(shadow_bounds);
1247 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); 1265 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size()));
1248 } 1266 }
1249 } 1267 }
1250 1268
1251 } // namespace exo 1269 } // 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