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

Side by Side Diff: ash/shell.cc

Issue 23606016: Refactor LauncherItemController and LauncherItemDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for LauncherTest and observing LauncherModel in DelegateManager Created 7 years, 3 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
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/focus_manager_factory.h" 10 #include "ash/accelerators/focus_manager_factory.h"
(...skipping 10 matching lines...) Expand all
21 #include "ash/display/screen_position_controller.h" 21 #include "ash/display/screen_position_controller.h"
22 #include "ash/drag_drop/drag_drop_controller.h" 22 #include "ash/drag_drop/drag_drop_controller.h"
23 #include "ash/focus_cycler.h" 23 #include "ash/focus_cycler.h"
24 #include "ash/high_contrast/high_contrast_controller.h" 24 #include "ash/high_contrast/high_contrast_controller.h"
25 #include "ash/host/root_window_host_factory.h" 25 #include "ash/host/root_window_host_factory.h"
26 #include "ash/launcher/app_list_launcher_item_delegate.h" 26 #include "ash/launcher/app_list_launcher_item_delegate.h"
27 #include "ash/launcher/launcher_delegate.h" 27 #include "ash/launcher/launcher_delegate.h"
28 #include "ash/launcher/launcher_item_delegate.h" 28 #include "ash/launcher/launcher_item_delegate.h"
29 #include "ash/launcher/launcher_item_delegate_manager.h" 29 #include "ash/launcher/launcher_item_delegate_manager.h"
30 #include "ash/launcher/launcher_model.h" 30 #include "ash/launcher/launcher_model.h"
31 #include "ash/launcher/launcher_util.h"
31 #include "ash/magnifier/magnification_controller.h" 32 #include "ash/magnifier/magnification_controller.h"
32 #include "ash/magnifier/partial_magnification_controller.h" 33 #include "ash/magnifier/partial_magnification_controller.h"
33 #include "ash/root_window_controller.h" 34 #include "ash/root_window_controller.h"
34 #include "ash/screen_ash.h" 35 #include "ash/screen_ash.h"
35 #include "ash/session_state_delegate.h" 36 #include "ash/session_state_delegate.h"
36 #include "ash/shelf/shelf_layout_manager.h" 37 #include "ash/shelf/shelf_layout_manager.h"
37 #include "ash/shelf/shelf_widget.h" 38 #include "ash/shelf/shelf_widget.h"
38 #include "ash/shell_delegate.h" 39 #include "ash/shell_delegate.h"
39 #include "ash/shell_factory.h" 40 #include "ash/shell_factory.h"
40 #include "ash/shell_window_ids.h" 41 #include "ash/shell_window_ids.h"
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 partial_magnification_controller_.reset(); 300 partial_magnification_controller_.reset();
300 resize_shadow_controller_.reset(); 301 resize_shadow_controller_.reset();
301 shadow_controller_.reset(); 302 shadow_controller_.reset();
302 tooltip_controller_.reset(); 303 tooltip_controller_.reset();
303 event_client_.reset(); 304 event_client_.reset();
304 window_cycle_controller_.reset(); 305 window_cycle_controller_.reset();
305 nested_dispatcher_controller_.reset(); 306 nested_dispatcher_controller_.reset();
306 user_action_client_.reset(); 307 user_action_client_.reset();
307 visibility_controller_.reset(); 308 visibility_controller_.reset();
308 launcher_delegate_.reset(); 309 launcher_delegate_.reset();
310 launcher_item_delegate_manager_.reset();
309 launcher_model_.reset(); 311 launcher_model_.reset();
310 video_detector_.reset(); 312 video_detector_.reset();
311 313
312 power_button_controller_.reset(); 314 power_button_controller_.reset();
313 lock_state_controller_.reset(); 315 lock_state_controller_.reset();
314 mru_window_tracker_.reset(); 316 mru_window_tracker_.reset();
315 317
316 resolution_notification_controller_.reset(); 318 resolution_notification_controller_.reset();
317 319
318 // This also deletes all RootWindows. Note that we invoke Shutdown() on 320 // This also deletes all RootWindows. Note that we invoke Shutdown() on
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 ShelfWidget* shelf = GetPrimaryRootWindowController()->shelf(); 848 ShelfWidget* shelf = GetPrimaryRootWindowController()->shelf();
847 return shelf && shelf->status_area_widget(); 849 return shelf && shelf->status_area_widget();
848 } 850 }
849 851
850 SystemTray* Shell::GetPrimarySystemTray() { 852 SystemTray* Shell::GetPrimarySystemTray() {
851 return GetPrimaryRootWindowController()->GetSystemTray(); 853 return GetPrimaryRootWindowController()->GetSystemTray();
852 } 854 }
853 855
854 LauncherDelegate* Shell::GetLauncherDelegate() { 856 LauncherDelegate* Shell::GetLauncherDelegate() {
855 if (!launcher_delegate_) { 857 if (!launcher_delegate_) {
856 // Creates LauncherItemDelegateManager before LauncherDelegate. 858 launcher_model_.reset(new LauncherModel);
859 // Create LauncherItemDelegateManager before LauncherDelegate.
857 launcher_item_delegate_manager_.reset(new LauncherItemDelegateManager); 860 launcher_item_delegate_manager_.reset(new LauncherItemDelegateManager);
858 launcher_model_.reset(new LauncherModel);
859 launcher_delegate_.reset( 861 launcher_delegate_.reset(
860 delegate_->CreateLauncherDelegate(launcher_model_.get())); 862 delegate_->CreateLauncherDelegate(launcher_model_.get()));
861 app_list_launcher_item_delegate_.reset( 863 // Create AppListLauncherItemDelegate and register.
sky 2013/09/11 01:42:57 This comment describes exactly waht the code does
simonhong_ 2013/09/11 09:05:26 Done.
864 launcher_item_delegate_manager_->RegisterLauncherItemDelegate(
865 ash::launcher::GetAppListItemID(*launcher_model_),
862 new internal::AppListLauncherItemDelegate); 866 new internal::AppListLauncherItemDelegate);
863 } 867 }
864 return launcher_delegate_.get(); 868 return launcher_delegate_.get();
865 } 869 }
866 870
867 void Shell::SetTouchHudProjectionEnabled(bool enabled) { 871 void Shell::SetTouchHudProjectionEnabled(bool enabled) {
868 if (is_touch_hud_projection_enabled_ == enabled) 872 if (is_touch_hud_projection_enabled_ == enabled)
869 return; 873 return;
870 874
871 is_touch_hud_projection_enabled_ = enabled; 875 is_touch_hud_projection_enabled_ = enabled;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 //////////////////////////////////////////////////////////////////////////////// 971 ////////////////////////////////////////////////////////////////////////////////
968 // Shell, aura::client::ActivationChangeObserver implementation: 972 // Shell, aura::client::ActivationChangeObserver implementation:
969 973
970 void Shell::OnWindowActivated(aura::Window* gained_active, 974 void Shell::OnWindowActivated(aura::Window* gained_active,
971 aura::Window* lost_active) { 975 aura::Window* lost_active) {
972 if (gained_active) 976 if (gained_active)
973 target_root_window_ = gained_active->GetRootWindow(); 977 target_root_window_ = gained_active->GetRootWindow();
974 } 978 }
975 979
976 } // namespace ash 980 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698