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

Side by Side Diff: ash/wm/window_state.cc

Issue 101013002: Make sure WindowObservers are removed from window before destruction (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix shutdown order Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/window_state.h ('k') | chrome/browser/chromeos/extensions/wallpaper_private_api.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ash/wm/window_state.h" 5 #include "ash/wm/window_state.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/screen_ash.h" 9 #include "ash/screen_ash.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 window_show_type_ = ToWindowShowType(GetShowState()); 263 window_show_type_ = ToWindowShowType(GetShowState());
264 ui::WindowShowState old_state = static_cast<ui::WindowShowState>(old); 264 ui::WindowShowState old_state = static_cast<ui::WindowShowState>(old);
265 // TODO(oshima): Notify only when the state has changed. 265 // TODO(oshima): Notify only when the state has changed.
266 // Doing so break a few tests now. 266 // Doing so break a few tests now.
267 FOR_EACH_OBSERVER( 267 FOR_EACH_OBSERVER(
268 WindowStateObserver, observer_list_, 268 WindowStateObserver, observer_list_,
269 OnWindowShowTypeChanged(this, ToWindowShowType(old_state))); 269 OnWindowShowTypeChanged(this, ToWindowShowType(old_state)));
270 } 270 }
271 } 271 }
272 272
273 void WindowState::OnWindowDestroying(aura::Window* window) {
274 window_->RemoveObserver(this);
275 }
276
277 void WindowState::SnapWindow(WindowShowType left_or_right, 273 void WindowState::SnapWindow(WindowShowType left_or_right,
278 const gfx::Rect& bounds) { 274 const gfx::Rect& bounds) {
279 // Compute the bounds that the window will restore to. If the window does not 275 // Compute the bounds that the window will restore to. If the window does not
280 // already have restore bounds, it will be restored (when un-snapped) to the 276 // already have restore bounds, it will be restored (when un-snapped) to the
281 // last bounds that it had before getting snapped. 277 // last bounds that it had before getting snapped.
282 gfx::Rect restore_bounds_in_screen(HasRestoreBounds() ? 278 gfx::Rect restore_bounds_in_screen(HasRestoreBounds() ?
283 GetRestoreBoundsInScreen() : window_->GetBoundsInScreen()); 279 GetRestoreBoundsInScreen() : window_->GetBoundsInScreen());
284 // Set the window's restore bounds so that WorkspaceLayoutManager knows 280 // Set the window's restore bounds so that WorkspaceLayoutManager knows
285 // which width to use when the snapped window is moved to the edge. 281 // which width to use when the snapped window is moved to the edge.
286 SetRestoreBoundsInParent(bounds); 282 SetRestoreBoundsInParent(bounds);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 } 322 }
327 return settings; 323 return settings;
328 } 324 }
329 325
330 const WindowState* GetWindowState(const aura::Window* window) { 326 const WindowState* GetWindowState(const aura::Window* window) {
331 return GetWindowState(const_cast<aura::Window*>(window)); 327 return GetWindowState(const_cast<aura::Window*>(window));
332 } 328 }
333 329
334 } // namespace wm 330 } // namespace wm
335 } // namespace ash 331 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/window_state.h ('k') | chrome/browser/chromeos/extensions/wallpaper_private_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698