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

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: . 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
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 913 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 aura::Window* window = widget_->GetNativeWindow(); 924 aura::Window* window = widget_->GetNativeWindow();
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->set_allow_set_bounds_in_maximized(true);
934 window_state->AddObserver(this); 935 window_state->AddObserver(this);
935 // Notify client of initial state if different than normal. 936 // Notify client of initial state if different than normal.
936 if (window_state->GetStateType() != ash::wm::WINDOW_STATE_TYPE_NORMAL && 937 if (window_state->GetStateType() != ash::wm::WINDOW_STATE_TYPE_NORMAL &&
937 !state_changed_callback_.is_null()) { 938 !state_changed_callback_.is_null()) {
938 state_changed_callback_.Run(ash::wm::WINDOW_STATE_TYPE_NORMAL, 939 state_changed_callback_.Run(ash::wm::WINDOW_STATE_TYPE_NORMAL,
939 window_state->GetStateType()); 940 window_state->GetStateType());
940 } 941 }
941 942
942 // Disable movement if initial bounds were specified. 943 // Disable movement if initial bounds were specified.
943 widget_->set_movement_disabled(!initial_bounds_.IsEmpty()); 944 widget_->set_movement_disabled(!initial_bounds_.IsEmpty());
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 default: 1147 default:
1147 NOTREACHED(); 1148 NOTREACHED();
1148 return gfx::Point(); 1149 return gfx::Point();
1149 } 1150 }
1150 } 1151 }
1151 1152
1152 void ShellSurface::UpdateWidgetBounds() { 1153 void ShellSurface::UpdateWidgetBounds() {
1153 DCHECK(widget_); 1154 DCHECK(widget_);
1154 1155
1155 // Return early if the shell is currently managing the bounds of the widget. 1156 // Return early if the shell is currently managing the bounds of the widget.
1156 if (widget_->IsMaximized() || widget_->IsFullscreen() || IsResizing()) 1157 if (IsResizing())
reveman 2016/08/11 19:07:25 I guess it's fine to remove this thanks to the pen
oshima 2016/08/11 22:48:21 Done.
1157 return; 1158 return;
1158 1159
1159 // Return early if there is pending configure requests. 1160 // Return early if there is pending configure requests.
1160 if (!pending_configs_.empty() || scoped_configure_) 1161 if (!pending_configs_.empty() || scoped_configure_)
1161 return; 1162 return;
1162 1163
1163 gfx::Rect visible_bounds = GetVisibleBounds(); 1164 gfx::Rect visible_bounds = GetVisibleBounds();
1164 gfx::Rect new_widget_bounds = visible_bounds; 1165 gfx::Rect new_widget_bounds = visible_bounds;
1165 1166
1166 // Avoid changing widget origin unless initial bounds were specified and 1167 // Avoid changing widget origin unless initial bounds were specified and
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 shadow_overlay_->layer()->Add(shadow->layer()); 1243 shadow_overlay_->layer()->Add(shadow->layer());
1243 window->AddChild(shadow_overlay_); 1244 window->AddChild(shadow_overlay_);
1244 shadow_overlay_->Show(); 1245 shadow_overlay_->Show();
1245 } 1246 }
1246 shadow_overlay_->SetBounds(shadow_bounds); 1247 shadow_overlay_->SetBounds(shadow_bounds);
1247 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); 1248 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size()));
1248 } 1249 }
1249 } 1250 }
1250 1251
1251 } // namespace exo 1252 } // namespace exo
OLDNEW
« ash/wm/window_state_unittest.cc ('K') | « ash/wm/window_state_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698