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

Side by Side Diff: ash/shell.cc

Issue 101013002: Make sure WindowObservers are removed from window before destruction (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cc 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 | « no previous file | ash/wm/always_on_top_controller.cc » ('j') | ui/aura/window_observer.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/shell.h" 5 #include "ash/shell.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "ash/accelerators/accelerator_controller.h" 10 #include "ash/accelerators/accelerator_controller.h"
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 623
624 // Destroy SystemTrayDelegate before destroying the status area(s). 624 // Destroy SystemTrayDelegate before destroying the status area(s).
625 system_tray_delegate_->Shutdown(); 625 system_tray_delegate_->Shutdown();
626 system_tray_delegate_.reset(); 626 system_tray_delegate_.reset();
627 627
628 locale_notification_controller_.reset(); 628 locale_notification_controller_.reset();
629 629
630 // Drag-and-drop must be canceled prior to close all windows. 630 // Drag-and-drop must be canceled prior to close all windows.
631 drag_drop_controller_.reset(); 631 drag_drop_controller_.reset();
632 632
633
634 #if defined(OS_CHROMEOS)
635 // Destroy VideoActivityNotifier before destroying VideoDetector.
636 video_activity_notifier_.reset();
637 #endif // defined(OS_CHROMEOS)
638 video_detector_.reset();
639
640 shadow_controller_.reset();
641 resize_shadow_controller_.reset();
642
643 window_cycle_controller_.reset();
644 mru_window_tracker_.reset();
645
633 // Destroy all child windows including widgets. 646 // Destroy all child windows including widgets.
634 display_controller_->CloseChildWindows(); 647 display_controller_->CloseChildWindows();
635 display_controller_->CloseNonDesktopDisplay(); 648 display_controller_->CloseNonDesktopDisplay();
636 649
650 launcher_delegate_.reset();
651 focus_client_.reset();
652
637 // Destroy SystemTrayNotifier after destroying SystemTray as TrayItems 653 // Destroy SystemTrayNotifier after destroying SystemTray as TrayItems
638 // needs to remove observers from it. 654 // needs to remove observers from it.
639 system_tray_notifier_.reset(); 655 system_tray_notifier_.reset();
640 656
641 #if defined(OS_CHROMEOS)
642 // Destroy VideoActivityNotifier before destroying VideoDetector.
643 video_activity_notifier_.reset();
644 #endif // defined(OS_CHROMEOS)
645
646 // These need a valid Shell instance to clean up properly, so explicitly 657 // These need a valid Shell instance to clean up properly, so explicitly
647 // delete them before invalidating the instance. 658 // delete them before invalidating the instance.
648 // Alphabetical. TODO(oshima): sort. 659 // Alphabetical. TODO(oshima): sort.
649 magnification_controller_.reset(); 660 magnification_controller_.reset();
650 partial_magnification_controller_.reset(); 661 partial_magnification_controller_.reset();
651 resize_shadow_controller_.reset();
652 shadow_controller_.reset();
653 tooltip_controller_.reset(); 662 tooltip_controller_.reset();
654 event_client_.reset(); 663 event_client_.reset();
655 window_cycle_controller_.reset();
656 nested_dispatcher_controller_.reset(); 664 nested_dispatcher_controller_.reset();
657 user_action_client_.reset(); 665 user_action_client_.reset();
658 visibility_controller_.reset(); 666 visibility_controller_.reset();
659 launcher_delegate_.reset();
660 // |launcher_item_delegate_manager_| observes |shelf_model_|. It must be 667 // |launcher_item_delegate_manager_| observes |shelf_model_|. It must be
661 // destroyed before |shelf_model_| is destroyed. 668 // destroyed before |shelf_model_| is destroyed.
662 launcher_item_delegate_manager_.reset(); 669 launcher_item_delegate_manager_.reset();
663 shelf_model_.reset(); 670 shelf_model_.reset();
664 video_detector_.reset();
665 671
666 power_button_controller_.reset(); 672 power_button_controller_.reset();
667 lock_state_controller_.reset(); 673 lock_state_controller_.reset();
668 mru_window_tracker_.reset();
669 674
670 resolution_notification_controller_.reset(); 675 resolution_notification_controller_.reset();
671 desktop_background_controller_.reset(); 676 desktop_background_controller_.reset();
672 677
673 // This also deletes all RootWindows. Note that we invoke Shutdown() on 678 // This also deletes all RootWindows. Note that we invoke Shutdown() on
674 // DisplayController before resetting |display_controller_|, since destruction 679 // DisplayController before resetting |display_controller_|, since destruction
675 // of its owned RootWindowControllers relies on the value. 680 // of its owned RootWindowControllers relies on the value.
676 display_controller_->Shutdown(); 681 display_controller_->Shutdown();
677 display_controller_.reset(); 682 display_controller_.reset();
678 screen_position_controller_.reset(); 683 screen_position_controller_.reset();
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 //////////////////////////////////////////////////////////////////////////////// 1017 ////////////////////////////////////////////////////////////////////////////////
1013 // Shell, aura::client::ActivationChangeObserver implementation: 1018 // Shell, aura::client::ActivationChangeObserver implementation:
1014 1019
1015 void Shell::OnWindowActivated(aura::Window* gained_active, 1020 void Shell::OnWindowActivated(aura::Window* gained_active,
1016 aura::Window* lost_active) { 1021 aura::Window* lost_active) {
1017 if (gained_active) 1022 if (gained_active)
1018 target_root_window_ = gained_active->GetRootWindow(); 1023 target_root_window_ = gained_active->GetRootWindow();
1019 } 1024 }
1020 1025
1021 } // namespace ash 1026 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/wm/always_on_top_controller.cc » ('j') | ui/aura/window_observer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698