OLD | NEW |
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 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 #include "ash/first_run/first_run_helper_impl.h" | 49 #include "ash/first_run/first_run_helper_impl.h" |
50 #include "ash/frame/custom_frame_view_ash.h" | 50 #include "ash/frame/custom_frame_view_ash.h" |
51 #include "ash/high_contrast/high_contrast_controller.h" | 51 #include "ash/high_contrast/high_contrast_controller.h" |
52 #include "ash/host/ash_window_tree_host_init_params.h" | 52 #include "ash/host/ash_window_tree_host_init_params.h" |
53 #include "ash/ime/input_method_event_handler.h" | 53 #include "ash/ime/input_method_event_handler.h" |
54 #include "ash/magnifier/magnification_controller.h" | 54 #include "ash/magnifier/magnification_controller.h" |
55 #include "ash/magnifier/partial_magnification_controller.h" | 55 #include "ash/magnifier/partial_magnification_controller.h" |
56 #include "ash/root_window_controller.h" | 56 #include "ash/root_window_controller.h" |
57 #include "ash/shelf/shelf.h" | 57 #include "ash/shelf/shelf.h" |
58 #include "ash/shelf/shelf_widget.h" | 58 #include "ash/shelf/shelf_widget.h" |
59 #include "ash/shelf/shelf_window_watcher.h" | |
60 #include "ash/shell_init_params.h" | 59 #include "ash/shell_init_params.h" |
61 #include "ash/utility/screenshot_controller.h" | 60 #include "ash/utility/screenshot_controller.h" |
62 #include "ash/wm/ash_focus_rules.h" | 61 #include "ash/wm/ash_focus_rules.h" |
63 #include "ash/wm/ash_native_cursor_manager.h" | 62 #include "ash/wm/ash_native_cursor_manager.h" |
64 #include "ash/wm/event_client_impl.h" | 63 #include "ash/wm/event_client_impl.h" |
65 #include "ash/wm/lock_state_controller.h" | 64 #include "ash/wm/lock_state_controller.h" |
66 #include "ash/wm/overlay_event_filter.h" | 65 #include "ash/wm/overlay_event_filter.h" |
67 #include "ash/wm/overview/scoped_overview_animation_settings_factory_aura.h" | 66 #include "ash/wm/overview/scoped_overview_animation_settings_factory_aura.h" |
68 #include "ash/wm/power_button_controller.h" | 67 #include "ash/wm/power_button_controller.h" |
69 #include "ash/wm/resize_shadow_controller.h" | 68 #include "ash/wm/resize_shadow_controller.h" |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), | 360 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), |
362 OnRootWindowAdded(root_window)); | 361 OnRootWindowAdded(root_window)); |
363 } | 362 } |
364 | 363 |
365 void Shell::CreateShelf() { | 364 void Shell::CreateShelf() { |
366 // Must occur after SessionStateDelegate creation and user login. | 365 // Must occur after SessionStateDelegate creation and user login. |
367 DCHECK(session_state_delegate_); | 366 DCHECK(session_state_delegate_); |
368 DCHECK_GT(session_state_delegate_->NumberOfLoggedInUsers(), 0); | 367 DCHECK_GT(session_state_delegate_->NumberOfLoggedInUsers(), 0); |
369 wm_shell_->CreateShelfDelegate(); | 368 wm_shell_->CreateShelfDelegate(); |
370 | 369 |
371 // TODO(jamescook): This is here for historical reasons. Move it to WmShell. | |
372 // http://crbug.com/629257 | |
373 if (!shelf_window_watcher_) { | |
374 shelf_window_watcher_.reset( | |
375 new ShelfWindowWatcher(wm_shell_->shelf_model())); | |
376 } | |
377 | |
378 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 370 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
379 for (RootWindowControllerList::iterator iter = controllers.begin(); | 371 for (RootWindowControllerList::iterator iter = controllers.begin(); |
380 iter != controllers.end(); ++iter) | 372 iter != controllers.end(); ++iter) |
381 (*iter)->CreateShelf(); | 373 (*iter)->CreateShelf(); |
382 } | 374 } |
383 | 375 |
384 void Shell::OnShelfCreatedForRootWindow(WmWindow* root_window) { | 376 void Shell::OnShelfCreatedForRootWindow(WmWindow* root_window) { |
385 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), | 377 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), |
386 OnShelfCreatedForRootWindow(root_window)); | 378 OnShelfCreatedForRootWindow(root_window)); |
387 } | 379 } |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 video_detector_.reset(); | 630 video_detector_.reset(); |
639 high_contrast_controller_.reset(); | 631 high_contrast_controller_.reset(); |
640 | 632 |
641 shadow_controller_.reset(); | 633 shadow_controller_.reset(); |
642 resize_shadow_controller_.reset(); | 634 resize_shadow_controller_.reset(); |
643 | 635 |
644 // Has to happen before ~MruWindowTracker. | 636 // Has to happen before ~MruWindowTracker. |
645 wm_shell_->DeleteWindowCycleController(); | 637 wm_shell_->DeleteWindowCycleController(); |
646 wm_shell_->DeleteWindowSelectorController(); | 638 wm_shell_->DeleteWindowSelectorController(); |
647 | 639 |
648 // |shelf_window_watcher_| has a weak pointer to the shelf model and has | |
649 // window observers. | |
650 shelf_window_watcher_.reset(); | |
651 | |
652 // Destroy all child windows including widgets. | 640 // Destroy all child windows including widgets. |
653 window_tree_host_manager_->CloseChildWindows(); | 641 window_tree_host_manager_->CloseChildWindows(); |
654 // MruWindowTracker must be destroyed after all windows have been deleted to | 642 // MruWindowTracker must be destroyed after all windows have been deleted to |
655 // avoid a possible crash when Shell is destroyed from a non-normal shutdown | 643 // avoid a possible crash when Shell is destroyed from a non-normal shutdown |
656 // path. (crbug.com/485438). | 644 // path. (crbug.com/485438). |
657 wm_shell_->DeleteMruWindowTracker(); | 645 wm_shell_->DeleteMruWindowTracker(); |
658 | 646 |
659 // These need a valid Shell instance to clean up properly, so explicitly | 647 // These need a valid Shell instance to clean up properly, so explicitly |
660 // delete them before invalidating the instance. | 648 // delete them before invalidating the instance. |
661 // Alphabetical. TODO(oshima): sort. | 649 // Alphabetical. TODO(oshima): sort. |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 std::unique_ptr<ui::EventTargetIterator> Shell::GetChildIterator() const { | 1059 std::unique_ptr<ui::EventTargetIterator> Shell::GetChildIterator() const { |
1072 return std::unique_ptr<ui::EventTargetIterator>(); | 1060 return std::unique_ptr<ui::EventTargetIterator>(); |
1073 } | 1061 } |
1074 | 1062 |
1075 ui::EventTargeter* Shell::GetEventTargeter() { | 1063 ui::EventTargeter* Shell::GetEventTargeter() { |
1076 NOTREACHED(); | 1064 NOTREACHED(); |
1077 return nullptr; | 1065 return nullptr; |
1078 } | 1066 } |
1079 | 1067 |
1080 } // namespace ash | 1068 } // namespace ash |
OLD | NEW |