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

Side by Side Diff: chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.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
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 "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" 5 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h"
6 6
7 #include "apps/shell_window.h" 7 #include "apps/shell_window.h"
8 #include "apps/shell_window_registry.h" 8 #include "apps/shell_window_registry.h"
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/multi_profile_uma.h" 10 #include "ash/multi_profile_uma.h"
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 409
410 void MultiUserWindowManagerChromeOS::OnWindowDestroyed(aura::Window* window) { 410 void MultiUserWindowManagerChromeOS::OnWindowDestroyed(aura::Window* window) {
411 if (GetWindowOwner(window).empty()) { 411 if (GetWindowOwner(window).empty()) {
412 // This must be a window in the transient chain - remove it and its 412 // This must be a window in the transient chain - remove it and its
413 // children from the owner. 413 // children from the owner.
414 RemoveTransientOwnerRecursive(window); 414 RemoveTransientOwnerRecursive(window);
415 return; 415 return;
416 } 416 }
417 // Remove the state and the window observer. 417 // Remove the state and the window observer.
418 ash::wm::GetWindowState(window)->RemoveObserver(this); 418 ash::wm::GetWindowState(window)->RemoveObserver(this);
419 window->RemoveObserver(this);
420 // Remove the window from the owners list. 419 // Remove the window from the owners list.
421 delete window_to_entry_[window]; 420 delete window_to_entry_[window];
422 window_to_entry_.erase(window); 421 window_to_entry_.erase(window);
423 } 422 }
424 423
425 void MultiUserWindowManagerChromeOS::OnWindowVisibilityChanging( 424 void MultiUserWindowManagerChromeOS::OnWindowVisibilityChanging(
426 aura::Window* window, bool visible) { 425 aura::Window* window, bool visible) {
427 // This command gets called first and immediately when show or hide gets 426 // This command gets called first and immediately when show or hide gets
428 // called. We remember here the desired state for restoration IF we were 427 // called. We remember here the desired state for restoration IF we were
429 // not ourselves issuing the call. 428 // not ourselves issuing the call.
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 // To prevent these commands from being recorded as any other commands, we 637 // To prevent these commands from being recorded as any other commands, we
639 // are suppressing any window entry changes while this is going on. 638 // are suppressing any window entry changes while this is going on.
640 // Instead of calling SetWindowVisible, only show gets called here since all 639 // Instead of calling SetWindowVisible, only show gets called here since all
641 // dependents have been shown previously already. 640 // dependents have been shown previously already.
642 base::AutoReset<bool> suppressor(&suppress_visibility_changes_, true); 641 base::AutoReset<bool> suppressor(&suppress_visibility_changes_, true);
643 window->Show(); 642 window->Show();
644 } 643 }
645 } 644 }
646 645
647 } // namespace chrome 646 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698