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

Side by Side Diff: ash/shell.cc

Issue 1770993002: wip: Refactoring Ash's AppListController, moving the bulk of the logic to chrome/browser/ui/ash/app… Base URL: https://chromium.googlesource.com/chromium/src.git@small_5_apps
Patch Set: AppListShower to new component: //ui/app_list/shower, GetViewDelegate() in GetViewDelegate(), test … 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/trace_event/trace_event.h" 85 #include "base/trace_event/trace_event.h"
86 #include "ui/app_list/shower/app_list_shower.h"
87 #include "ui/aura/client/aura_constants.h" 87 #include "ui/aura/client/aura_constants.h"
88 #include "ui/aura/env.h" 88 #include "ui/aura/env.h"
89 #include "ui/aura/layout_manager.h" 89 #include "ui/aura/layout_manager.h"
90 #include "ui/aura/window.h" 90 #include "ui/aura/window.h"
91 #include "ui/aura/window_event_dispatcher.h" 91 #include "ui/aura/window_event_dispatcher.h"
92 #include "ui/base/ui_base_switches.h" 92 #include "ui/base/ui_base_switches.h"
93 #include "ui/base/user_activity/user_activity_detector.h" 93 #include "ui/base/user_activity/user_activity_detector.h"
94 #include "ui/compositor/layer.h" 94 #include "ui/compositor/layer.h"
95 #include "ui/compositor/layer_animator.h" 95 #include "ui/compositor/layer_animator.h"
96 #include "ui/events/event_target_iterator.h" 96 #include "ui/events/event_target_iterator.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 aura::Window* root = 290 aura::Window* root =
291 wm::GetRootWindowMatching(gfx::Rect(location_in_screen, gfx::Size())); 291 wm::GetRootWindowMatching(gfx::Rect(location_in_screen, gfx::Size()));
292 GetRootWindowController(root) 292 GetRootWindowController(root)
293 ->ShowContextMenu(location_in_screen, source_type); 293 ->ShowContextMenu(location_in_screen, source_type);
294 } 294 }
295 295
296 void Shell::ShowAppList(aura::Window* window) { 296 void Shell::ShowAppList(aura::Window* window) {
297 // If the context window is not given, show it on the target root window. 297 // If the context window is not given, show it on the target root window.
298 if (!window) 298 if (!window)
299 window = GetTargetRootWindow(); 299 window = GetTargetRootWindow();
300 if (!app_list_controller_) 300 delegate_->GetAppListShower()->Show(window);
301 app_list_controller_.reset(new AppListController);
302 app_list_controller_->Show(window);
303 } 301 }
304 302
305 void Shell::DismissAppList() { 303 void Shell::DismissAppList() {
306 if (!app_list_controller_) 304 delegate_->GetAppListShower()->Dismiss();
307 return;
308 app_list_controller_->Dismiss();
309 } 305 }
310 306
311 void Shell::ToggleAppList(aura::Window* window) { 307 void Shell::ToggleAppList(aura::Window* window) {
312 if (app_list_controller_ && app_list_controller_->IsVisible()) { 308 if (delegate_->GetAppListShower()->IsVisible()) {
313 DismissAppList(); 309 DismissAppList();
314 return; 310 return;
315 } 311 }
316 312
317 ShowAppList(window); 313 ShowAppList(window);
318 } 314 }
319 315
320 bool Shell::GetAppListTargetVisibility() const { 316 bool Shell::GetAppListTargetVisibility() const {
321 return app_list_controller_.get() && 317 return delegate_->GetAppListShower()->GetTargetVisibility();
322 app_list_controller_->GetTargetVisibility();
323 }
324
325 aura::Window* Shell::GetAppListWindow() {
326 return app_list_controller_.get() ? app_list_controller_->GetWindow()
327 : nullptr;
328 }
329
330 app_list::AppListView* Shell::GetAppListView() {
331 return app_list_controller_.get() ? app_list_controller_->GetView() : nullptr;
332 } 318 }
333 319
334 bool Shell::IsSystemModalWindowOpen() const { 320 bool Shell::IsSystemModalWindowOpen() const {
335 if (simulate_modal_window_open_for_testing_) 321 if (simulate_modal_window_open_for_testing_)
336 return true; 322 return true;
337 const std::vector<aura::Window*> containers = GetContainersFromAllRootWindows( 323 const std::vector<aura::Window*> containers = GetContainersFromAllRootWindows(
338 kShellWindowId_SystemModalContainer, nullptr); 324 kShellWindowId_SystemModalContainer, nullptr);
339 for (std::vector<aura::Window*>::const_iterator cit = containers.begin(); 325 for (std::vector<aura::Window*>::const_iterator cit = containers.begin();
340 cit != containers.end(); ++cit) { 326 cit != containers.end(); ++cit) {
341 for (aura::Window::Windows::const_iterator wit = (*cit)->children().begin(); 327 for (aura::Window::Windows::const_iterator wit = (*cit)->children().begin();
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 // since the latters destructor triggers events that the former is listening 695 // since the latters destructor triggers events that the former is listening
710 // to but no longer cares about. 696 // to but no longer cares about.
711 #if defined(OS_CHROMEOS) 697 #if defined(OS_CHROMEOS)
712 virtual_keyboard_controller_.reset(); 698 virtual_keyboard_controller_.reset();
713 #endif 699 #endif
714 700
715 // Destroy maximize mode controller early on since it has some observers which 701 // Destroy maximize mode controller early on since it has some observers which
716 // need to be removed. 702 // need to be removed.
717 maximize_mode_controller_.reset(); 703 maximize_mode_controller_.reset();
718 704
719 // AppList needs to be released before shelf layout manager, which is
720 // destroyed with shelf container in the loop below. However, app list
721 // container is now on top of shelf container and released after it.
722 // TODO(xiyuan): Move it back when app list container is no longer needed.
723 app_list_controller_.reset();
724
725 #if defined(OS_CHROMEOS) 705 #if defined(OS_CHROMEOS)
726 // Destroy the LastWindowClosedLogoutReminder before the 706 // Destroy the LastWindowClosedLogoutReminder before the
727 // LogoutConfirmationController. 707 // LogoutConfirmationController.
728 last_window_closed_logout_reminder_.reset(); 708 last_window_closed_logout_reminder_.reset();
729 709
730 // Destroy the LogoutConfirmationController before the SystemTrayDelegate. 710 // Destroy the LogoutConfirmationController before the SystemTrayDelegate.
731 logout_confirmation_controller_.reset(); 711 logout_confirmation_controller_.reset();
732 #endif 712 #endif
733 713
734 // Destroy the keyboard before closing the shelf, since it will invoke a shelf 714 // 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
1213 1193
1214 void Shell::OnWindowActivated( 1194 void Shell::OnWindowActivated(
1215 aura::client::ActivationChangeObserver::ActivationReason reason, 1195 aura::client::ActivationChangeObserver::ActivationReason reason,
1216 aura::Window* gained_active, 1196 aura::Window* gained_active,
1217 aura::Window* lost_active) { 1197 aura::Window* lost_active) {
1218 if (gained_active) 1198 if (gained_active)
1219 target_root_window_ = gained_active->GetRootWindow(); 1199 target_root_window_ = gained_active->GetRootWindow();
1220 } 1200 }
1221 1201
1222 } // namespace ash 1202 } // 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