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 15 matching lines...) Expand all Loading... |
26 #include "ash/drag_drop/drag_drop_controller.h" | 26 #include "ash/drag_drop/drag_drop_controller.h" |
27 #include "ash/first_run/first_run_helper_impl.h" | 27 #include "ash/first_run/first_run_helper_impl.h" |
28 #include "ash/focus_cycler.h" | 28 #include "ash/focus_cycler.h" |
29 #include "ash/high_contrast/high_contrast_controller.h" | 29 #include "ash/high_contrast/high_contrast_controller.h" |
30 #include "ash/host/root_window_host_factory.h" | 30 #include "ash/host/root_window_host_factory.h" |
31 #include "ash/keyboard_uma_event_filter.h" | 31 #include "ash/keyboard_uma_event_filter.h" |
32 #include "ash/launcher/launcher_delegate.h" | 32 #include "ash/launcher/launcher_delegate.h" |
33 #include "ash/launcher/launcher_item_delegate.h" | 33 #include "ash/launcher/launcher_item_delegate.h" |
34 #include "ash/launcher/launcher_item_delegate_manager.h" | 34 #include "ash/launcher/launcher_item_delegate_manager.h" |
35 #include "ash/launcher/launcher_model.h" | 35 #include "ash/launcher/launcher_model.h" |
| 36 #include "ash/launcher/launcher_model_util.h" |
36 #include "ash/magnifier/magnification_controller.h" | 37 #include "ash/magnifier/magnification_controller.h" |
37 #include "ash/magnifier/partial_magnification_controller.h" | 38 #include "ash/magnifier/partial_magnification_controller.h" |
38 #include "ash/root_window_controller.h" | 39 #include "ash/root_window_controller.h" |
39 #include "ash/screen_ash.h" | 40 #include "ash/screen_ash.h" |
40 #include "ash/session_state_delegate.h" | 41 #include "ash/session_state_delegate.h" |
41 #include "ash/shelf/app_list_shelf_item_delegate.h" | 42 #include "ash/shelf/app_list_shelf_item_delegate.h" |
42 #include "ash/shelf/shelf_layout_manager.h" | 43 #include "ash/shelf/shelf_layout_manager.h" |
43 #include "ash/shelf/shelf_util.h" | |
44 #include "ash/shelf/shelf_widget.h" | 44 #include "ash/shelf/shelf_widget.h" |
45 #include "ash/shell_delegate.h" | 45 #include "ash/shell_delegate.h" |
46 #include "ash/shell_factory.h" | 46 #include "ash/shell_factory.h" |
47 #include "ash/shell_window_ids.h" | 47 #include "ash/shell_window_ids.h" |
48 #include "ash/system/locale/locale_notification_controller.h" | 48 #include "ash/system/locale/locale_notification_controller.h" |
49 #include "ash/system/status_area_widget.h" | 49 #include "ash/system/status_area_widget.h" |
50 #include "ash/system/tray/system_tray_delegate.h" | 50 #include "ash/system/tray/system_tray_delegate.h" |
51 #include "ash/system/tray/system_tray_notifier.h" | 51 #include "ash/system/tray/system_tray_notifier.h" |
52 #include "ash/wm/app_list_controller.h" | 52 #include "ash/wm/app_list_controller.h" |
53 #include "ash/wm/ash_focus_rules.h" | 53 #include "ash/wm/ash_focus_rules.h" |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 launcher_model_.reset(new LauncherModel); | 484 launcher_model_.reset(new LauncherModel); |
485 // Creates LauncherItemDelegateManager before LauncherDelegate. | 485 // Creates LauncherItemDelegateManager before LauncherDelegate. |
486 launcher_item_delegate_manager_.reset( | 486 launcher_item_delegate_manager_.reset( |
487 new LauncherItemDelegateManager(launcher_model_.get())); | 487 new LauncherItemDelegateManager(launcher_model_.get())); |
488 | 488 |
489 launcher_delegate_.reset( | 489 launcher_delegate_.reset( |
490 delegate_->CreateLauncherDelegate(launcher_model_.get())); | 490 delegate_->CreateLauncherDelegate(launcher_model_.get())); |
491 scoped_ptr<LauncherItemDelegate> controller( | 491 scoped_ptr<LauncherItemDelegate> controller( |
492 new internal::AppListShelfItemDelegate); | 492 new internal::AppListShelfItemDelegate); |
493 | 493 |
494 ash::LauncherID app_list_id = 0; | |
495 // TODO(simon.hong81): Make function for this in shelf_util.h | |
496 // Finding the launcher model's location of the app list and setting its | 494 // Finding the launcher model's location of the app list and setting its |
497 // LauncherItemDelegate. | 495 // LauncherItemDelegate. |
498 for (size_t i = 0; i < launcher_model_->items().size(); ++i) { | 496 int app_list_index = |
499 if (launcher_model_->items()[i].type == ash::TYPE_APP_LIST) { | 497 ash::GetLauncherItemIndexForType(ash::TYPE_APP_LIST, *launcher_model_); |
500 app_list_id = launcher_model_->items()[i].id; | 498 DCHECK_GE(app_list_index, 0); |
501 break; | 499 ash::LauncherID app_list_id = launcher_model_->items()[app_list_index].id; |
502 } | |
503 } | |
504 DCHECK(app_list_id); | 500 DCHECK(app_list_id); |
505 launcher_item_delegate_manager_->SetLauncherItemDelegate( | 501 launcher_item_delegate_manager_->SetLauncherItemDelegate( |
506 app_list_id, | 502 app_list_id, |
507 controller.Pass()); | 503 controller.Pass()); |
508 } | 504 } |
509 return launcher_delegate_.get(); | 505 return launcher_delegate_.get(); |
510 } | 506 } |
511 | 507 |
512 void Shell::SetTouchHudProjectionEnabled(bool enabled) { | 508 void Shell::SetTouchHudProjectionEnabled(bool enabled) { |
513 if (is_touch_hud_projection_enabled_ == enabled) | 509 if (is_touch_hud_projection_enabled_ == enabled) |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 //////////////////////////////////////////////////////////////////////////////// | 971 //////////////////////////////////////////////////////////////////////////////// |
976 // Shell, aura::client::ActivationChangeObserver implementation: | 972 // Shell, aura::client::ActivationChangeObserver implementation: |
977 | 973 |
978 void Shell::OnWindowActivated(aura::Window* gained_active, | 974 void Shell::OnWindowActivated(aura::Window* gained_active, |
979 aura::Window* lost_active) { | 975 aura::Window* lost_active) { |
980 if (gained_active) | 976 if (gained_active) |
981 target_root_window_ = gained_active->GetRootWindow(); | 977 target_root_window_ = gained_active->GetRootWindow(); |
982 } | 978 } |
983 | 979 |
984 } // namespace ash | 980 } // namespace ash |
OLD | NEW |