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

Side by Side Diff: ash/shell.cc

Issue 1861013004: AppListController refactoring part 3: Switching over to use AppListShower in Ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mus_chrome_delegates_ash_impl
Patch Set: Rebase. Created 4 years, 8 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
« no previous file with comments | « ash/shell.h ('k') | ash/shell/shell_delegate_impl.h » ('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 (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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "ash/shell_delegate.h" 50 #include "ash/shell_delegate.h"
51 #include "ash/shell_factory.h" 51 #include "ash/shell_factory.h"
52 #include "ash/shell_init_params.h" 52 #include "ash/shell_init_params.h"
53 #include "ash/shell_window_ids.h" 53 #include "ash/shell_window_ids.h"
54 #include "ash/system/locale/locale_notification_controller.h" 54 #include "ash/system/locale/locale_notification_controller.h"
55 #include "ash/system/status_area_widget.h" 55 #include "ash/system/status_area_widget.h"
56 #include "ash/system/toast/toast_manager.h" 56 #include "ash/system/toast/toast_manager.h"
57 #include "ash/system/tray/system_tray_delegate.h" 57 #include "ash/system/tray/system_tray_delegate.h"
58 #include "ash/system/tray/system_tray_notifier.h" 58 #include "ash/system/tray/system_tray_notifier.h"
59 #include "ash/utility/partial_screenshot_controller.h" 59 #include "ash/utility/partial_screenshot_controller.h"
60 #include "ash/wm/app_list_controller.h"
61 #include "ash/wm/ash_focus_rules.h" 60 #include "ash/wm/ash_focus_rules.h"
62 #include "ash/wm/ash_native_cursor_manager.h" 61 #include "ash/wm/ash_native_cursor_manager.h"
63 #include "ash/wm/coordinate_conversion.h" 62 #include "ash/wm/coordinate_conversion.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/maximize_mode/maximize_mode_controller.h" 65 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
67 #include "ash/wm/maximize_mode/maximize_mode_window_manager.h" 66 #include "ash/wm/maximize_mode/maximize_mode_window_manager.h"
68 #include "ash/wm/mru_window_tracker.h" 67 #include "ash/wm/mru_window_tracker.h"
69 #include "ash/wm/overlay_event_filter.h" 68 #include "ash/wm/overlay_event_filter.h"
70 #include "ash/wm/overview/window_selector_controller.h" 69 #include "ash/wm/overview/window_selector_controller.h"
71 #include "ash/wm/power_button_controller.h" 70 #include "ash/wm/power_button_controller.h"
72 #include "ash/wm/resize_shadow_controller.h" 71 #include "ash/wm/resize_shadow_controller.h"
73 #include "ash/wm/root_window_layout_manager.h" 72 #include "ash/wm/root_window_layout_manager.h"
74 #include "ash/wm/system_gesture_event_filter.h" 73 #include "ash/wm/system_gesture_event_filter.h"
75 #include "ash/wm/system_modal_container_event_filter.h" 74 #include "ash/wm/system_modal_container_event_filter.h"
76 #include "ash/wm/system_modal_container_layout_manager.h" 75 #include "ash/wm/system_modal_container_layout_manager.h"
77 #include "ash/wm/toplevel_window_event_handler.h" 76 #include "ash/wm/toplevel_window_event_handler.h"
78 #include "ash/wm/video_detector.h" 77 #include "ash/wm/video_detector.h"
79 #include "ash/wm/window_animations.h" 78 #include "ash/wm/window_animations.h"
80 #include "ash/wm/window_cycle_controller.h" 79 #include "ash/wm/window_cycle_controller.h"
81 #include "ash/wm/window_positioner.h" 80 #include "ash/wm/window_positioner.h"
82 #include "ash/wm/window_properties.h" 81 #include "ash/wm/window_properties.h"
83 #include "ash/wm/window_util.h" 82 #include "ash/wm/window_util.h"
84 #include "ash/wm/workspace_controller.h" 83 #include "ash/wm/workspace_controller.h"
85 #include "base/bind.h" 84 #include "base/bind.h"
86 #include "base/memory/ptr_util.h" 85 #include "base/memory/ptr_util.h"
87 #include "base/trace_event/trace_event.h" 86 #include "base/trace_event/trace_event.h"
87 #include "ui/app_list/shower/app_list_shower.h"
88 #include "ui/aura/client/aura_constants.h" 88 #include "ui/aura/client/aura_constants.h"
89 #include "ui/aura/env.h" 89 #include "ui/aura/env.h"
90 #include "ui/aura/layout_manager.h" 90 #include "ui/aura/layout_manager.h"
91 #include "ui/aura/window.h" 91 #include "ui/aura/window.h"
92 #include "ui/aura/window_event_dispatcher.h" 92 #include "ui/aura/window_event_dispatcher.h"
93 #include "ui/base/ui_base_switches.h" 93 #include "ui/base/ui_base_switches.h"
94 #include "ui/base/user_activity/user_activity_detector.h" 94 #include "ui/base/user_activity/user_activity_detector.h"
95 #include "ui/compositor/layer.h" 95 #include "ui/compositor/layer.h"
96 #include "ui/compositor/layer_animator.h" 96 #include "ui/compositor/layer_animator.h"
97 #include "ui/events/event_target_iterator.h" 97 #include "ui/events/event_target_iterator.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 aura::Window* root = 291 aura::Window* root =
292 wm::GetRootWindowMatching(gfx::Rect(location_in_screen, gfx::Size())); 292 wm::GetRootWindowMatching(gfx::Rect(location_in_screen, gfx::Size()));
293 GetRootWindowController(root) 293 GetRootWindowController(root)
294 ->ShowContextMenu(location_in_screen, source_type); 294 ->ShowContextMenu(location_in_screen, source_type);
295 } 295 }
296 296
297 void Shell::ShowAppList(aura::Window* window) { 297 void Shell::ShowAppList(aura::Window* window) {
298 // If the context window is not given, show it on the target root window. 298 // If the context window is not given, show it on the target root window.
299 if (!window) 299 if (!window)
300 window = GetTargetRootWindow(); 300 window = GetTargetRootWindow();
301 if (!app_list_controller_) 301 delegate_->GetAppListShower()->Show(window);
302 app_list_controller_.reset(new AppListController);
303 app_list_controller_->Show(window);
304 } 302 }
305 303
306 void Shell::DismissAppList() { 304 void Shell::DismissAppList() {
307 if (!app_list_controller_) 305 delegate_->GetAppListShower()->Dismiss();
308 return;
309 app_list_controller_->Dismiss();
310 } 306 }
311 307
312 void Shell::ToggleAppList(aura::Window* window) { 308 void Shell::ToggleAppList(aura::Window* window) {
313 if (app_list_controller_ && app_list_controller_->IsVisible()) { 309 if (delegate_->GetAppListShower()->IsVisible()) {
314 DismissAppList(); 310 DismissAppList();
315 return; 311 return;
316 } 312 }
317 313
318 ShowAppList(window); 314 ShowAppList(window);
319 } 315 }
320 316
321 bool Shell::GetAppListTargetVisibility() const { 317 bool Shell::GetAppListTargetVisibility() const {
322 return app_list_controller_.get() && 318 return delegate_->GetAppListShower()->GetTargetVisibility();
323 app_list_controller_->GetTargetVisibility();
324 }
325
326 aura::Window* Shell::GetAppListWindow() {
327 return app_list_controller_.get() ? app_list_controller_->GetWindow()
328 : nullptr;
329 }
330
331 app_list::AppListView* Shell::GetAppListView() {
332 return app_list_controller_.get() ? app_list_controller_->GetView() : nullptr;
333 } 319 }
334 320
335 bool Shell::IsSystemModalWindowOpen() const { 321 bool Shell::IsSystemModalWindowOpen() const {
336 if (simulate_modal_window_open_for_testing_) 322 if (simulate_modal_window_open_for_testing_)
337 return true; 323 return true;
338 const std::vector<aura::Window*> containers = GetContainersFromAllRootWindows( 324 const std::vector<aura::Window*> containers = GetContainersFromAllRootWindows(
339 kShellWindowId_SystemModalContainer, nullptr); 325 kShellWindowId_SystemModalContainer, nullptr);
340 for (std::vector<aura::Window*>::const_iterator cit = containers.begin(); 326 for (std::vector<aura::Window*>::const_iterator cit = containers.begin();
341 cit != containers.end(); ++cit) { 327 cit != containers.end(); ++cit) {
342 for (aura::Window::Windows::const_iterator wit = (*cit)->children().begin(); 328 for (aura::Window::Windows::const_iterator wit = (*cit)->children().begin();
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 // since the latters destructor triggers events that the former is listening 697 // since the latters destructor triggers events that the former is listening
712 // to but no longer cares about. 698 // to but no longer cares about.
713 #if defined(OS_CHROMEOS) 699 #if defined(OS_CHROMEOS)
714 virtual_keyboard_controller_.reset(); 700 virtual_keyboard_controller_.reset();
715 #endif 701 #endif
716 702
717 // Destroy maximize mode controller early on since it has some observers which 703 // Destroy maximize mode controller early on since it has some observers which
718 // need to be removed. 704 // need to be removed.
719 maximize_mode_controller_.reset(); 705 maximize_mode_controller_.reset();
720 706
721 // AppList needs to be released before shelf layout manager, which is
722 // destroyed with shelf container in the loop below. However, app list
723 // container is now on top of shelf container and released after it.
724 // TODO(xiyuan): Move it back when app list container is no longer needed.
725 app_list_controller_.reset();
726
727 #if defined(OS_CHROMEOS) 707 #if defined(OS_CHROMEOS)
728 // Destroy the LastWindowClosedLogoutReminder before the 708 // Destroy the LastWindowClosedLogoutReminder before the
729 // LogoutConfirmationController. 709 // LogoutConfirmationController.
730 last_window_closed_logout_reminder_.reset(); 710 last_window_closed_logout_reminder_.reset();
731 711
732 // Destroy the LogoutConfirmationController before the SystemTrayDelegate. 712 // Destroy the LogoutConfirmationController before the SystemTrayDelegate.
733 logout_confirmation_controller_.reset(); 713 logout_confirmation_controller_.reset();
734 #endif 714 #endif
735 715
736 // Destroy the keyboard before closing the shelf, since it will invoke a shelf 716 // Destroy the keyboard before closing the shelf, since it will invoke a shelf
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 1195
1216 void Shell::OnWindowActivated( 1196 void Shell::OnWindowActivated(
1217 aura::client::ActivationChangeObserver::ActivationReason reason, 1197 aura::client::ActivationChangeObserver::ActivationReason reason,
1218 aura::Window* gained_active, 1198 aura::Window* gained_active,
1219 aura::Window* lost_active) { 1199 aura::Window* lost_active) {
1220 if (gained_active) 1200 if (gained_active)
1221 target_root_window_ = gained_active->GetRootWindow(); 1201 target_root_window_ = gained_active->GetRootWindow();
1222 } 1202 }
1223 1203
1224 } // namespace ash 1204 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell.h ('k') | ash/shell/shell_delegate_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698