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 | 9 |
10 #include "ash/accelerators/accelerator_controller.h" | 10 #include "ash/accelerators/accelerator_controller.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "ash/launcher/launcher_item_delegate.h" | 31 #include "ash/launcher/launcher_item_delegate.h" |
32 #include "ash/launcher/launcher_item_delegate_manager.h" | 32 #include "ash/launcher/launcher_item_delegate_manager.h" |
33 #include "ash/launcher/launcher_model.h" | 33 #include "ash/launcher/launcher_model.h" |
34 #include "ash/magnifier/magnification_controller.h" | 34 #include "ash/magnifier/magnification_controller.h" |
35 #include "ash/magnifier/partial_magnification_controller.h" | 35 #include "ash/magnifier/partial_magnification_controller.h" |
36 #include "ash/root_window_controller.h" | 36 #include "ash/root_window_controller.h" |
37 #include "ash/screen_ash.h" | 37 #include "ash/screen_ash.h" |
38 #include "ash/session_state_delegate.h" | 38 #include "ash/session_state_delegate.h" |
39 #include "ash/shelf/app_list_shelf_item_delegate.h" | 39 #include "ash/shelf/app_list_shelf_item_delegate.h" |
40 #include "ash/shelf/shelf_layout_manager.h" | 40 #include "ash/shelf/shelf_layout_manager.h" |
| 41 #include "ash/shelf/shelf_util.h" |
41 #include "ash/shelf/shelf_widget.h" | 42 #include "ash/shelf/shelf_widget.h" |
42 #include "ash/shell_delegate.h" | 43 #include "ash/shell_delegate.h" |
43 #include "ash/shell_factory.h" | 44 #include "ash/shell_factory.h" |
44 #include "ash/shell_window_ids.h" | 45 #include "ash/shell_window_ids.h" |
45 #include "ash/system/locale/locale_notification_controller.h" | 46 #include "ash/system/locale/locale_notification_controller.h" |
46 #include "ash/system/status_area_widget.h" | 47 #include "ash/system/status_area_widget.h" |
47 #include "ash/system/tray/system_tray_delegate.h" | 48 #include "ash/system/tray/system_tray_delegate.h" |
48 #include "ash/system/tray/system_tray_notifier.h" | 49 #include "ash/system/tray/system_tray_notifier.h" |
49 #include "ash/wm/app_list_controller.h" | 50 #include "ash/wm/app_list_controller.h" |
50 #include "ash/wm/ash_focus_rules.h" | 51 #include "ash/wm/ash_focus_rules.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 partial_magnification_controller_.reset(); | 255 partial_magnification_controller_.reset(); |
255 resize_shadow_controller_.reset(); | 256 resize_shadow_controller_.reset(); |
256 shadow_controller_.reset(); | 257 shadow_controller_.reset(); |
257 tooltip_controller_.reset(); | 258 tooltip_controller_.reset(); |
258 event_client_.reset(); | 259 event_client_.reset(); |
259 window_cycle_controller_.reset(); | 260 window_cycle_controller_.reset(); |
260 nested_dispatcher_controller_.reset(); | 261 nested_dispatcher_controller_.reset(); |
261 user_action_client_.reset(); | 262 user_action_client_.reset(); |
262 visibility_controller_.reset(); | 263 visibility_controller_.reset(); |
263 launcher_delegate_.reset(); | 264 launcher_delegate_.reset(); |
| 265 // |launcher_item_delegate_manager_| observes |launcher_model_|. It must be |
| 266 // destroyed before |launcher_model_| is destroyed. |
| 267 launcher_item_delegate_manager_.reset(); |
264 launcher_model_.reset(); | 268 launcher_model_.reset(); |
265 video_detector_.reset(); | 269 video_detector_.reset(); |
266 | 270 |
267 power_button_controller_.reset(); | 271 power_button_controller_.reset(); |
268 lock_state_controller_.reset(); | 272 lock_state_controller_.reset(); |
269 mru_window_tracker_.reset(); | 273 mru_window_tracker_.reset(); |
270 | 274 |
271 resolution_notification_controller_.reset(); | 275 resolution_notification_controller_.reset(); |
272 desktop_background_controller_.reset(); | 276 desktop_background_controller_.reset(); |
273 | 277 |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 ShelfWidget* shelf = GetPrimaryRootWindowController()->shelf(); | 814 ShelfWidget* shelf = GetPrimaryRootWindowController()->shelf(); |
811 return shelf && shelf->status_area_widget(); | 815 return shelf && shelf->status_area_widget(); |
812 } | 816 } |
813 | 817 |
814 SystemTray* Shell::GetPrimarySystemTray() { | 818 SystemTray* Shell::GetPrimarySystemTray() { |
815 return GetPrimaryRootWindowController()->GetSystemTray(); | 819 return GetPrimaryRootWindowController()->GetSystemTray(); |
816 } | 820 } |
817 | 821 |
818 LauncherDelegate* Shell::GetLauncherDelegate() { | 822 LauncherDelegate* Shell::GetLauncherDelegate() { |
819 if (!launcher_delegate_) { | 823 if (!launcher_delegate_) { |
| 824 launcher_model_.reset(new LauncherModel); |
820 // Creates LauncherItemDelegateManager before LauncherDelegate. | 825 // Creates LauncherItemDelegateManager before LauncherDelegate. |
821 launcher_item_delegate_manager_.reset(new LauncherItemDelegateManager); | 826 launcher_item_delegate_manager_.reset( |
822 launcher_model_.reset(new LauncherModel); | 827 new LauncherItemDelegateManager(launcher_model_.get())); |
| 828 |
823 launcher_delegate_.reset( | 829 launcher_delegate_.reset( |
824 delegate_->CreateLauncherDelegate(launcher_model_.get())); | 830 delegate_->CreateLauncherDelegate(launcher_model_.get())); |
825 app_list_shelf_item_delegate_.reset( | 831 scoped_ptr<LauncherItemDelegate> controller( |
826 new internal::AppListShelfItemDelegate); | 832 new internal::AppListShelfItemDelegate); |
| 833 |
| 834 ash::LauncherID app_list_id = 0; |
| 835 // TODO(simon.hong81): Make function for this in shelf_util.h |
| 836 for (size_t i = 0; i < launcher_model_->items().size(); ++i) { |
| 837 if (launcher_model_->items()[i].type == ash::TYPE_APP_LIST) { |
| 838 app_list_id = launcher_model_->items()[i].id; |
| 839 break; |
| 840 } |
| 841 } |
| 842 DCHECK(app_list_id); |
| 843 launcher_item_delegate_manager_->SetLauncherItemDelegate( |
| 844 app_list_id, |
| 845 controller.Pass()); |
827 } | 846 } |
828 return launcher_delegate_.get(); | 847 return launcher_delegate_.get(); |
829 } | 848 } |
830 | 849 |
831 void Shell::SetTouchHudProjectionEnabled(bool enabled) { | 850 void Shell::SetTouchHudProjectionEnabled(bool enabled) { |
832 if (is_touch_hud_projection_enabled_ == enabled) | 851 if (is_touch_hud_projection_enabled_ == enabled) |
833 return; | 852 return; |
834 | 853 |
835 is_touch_hud_projection_enabled_ = enabled; | 854 is_touch_hud_projection_enabled_ = enabled; |
836 FOR_EACH_OBSERVER(ShellObserver, observers_, | 855 FOR_EACH_OBSERVER(ShellObserver, observers_, |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 //////////////////////////////////////////////////////////////////////////////// | 948 //////////////////////////////////////////////////////////////////////////////// |
930 // Shell, aura::client::ActivationChangeObserver implementation: | 949 // Shell, aura::client::ActivationChangeObserver implementation: |
931 | 950 |
932 void Shell::OnWindowActivated(aura::Window* gained_active, | 951 void Shell::OnWindowActivated(aura::Window* gained_active, |
933 aura::Window* lost_active) { | 952 aura::Window* lost_active) { |
934 if (gained_active) | 953 if (gained_active) |
935 target_root_window_ = gained_active->GetRootWindow(); | 954 target_root_window_ = gained_active->GetRootWindow(); |
936 } | 955 } |
937 | 956 |
938 } // namespace ash | 957 } // namespace ash |
OLD | NEW |