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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
480 ShelfWidget* shelf = GetPrimaryRootWindowController()->shelf(); | 481 ShelfWidget* shelf = GetPrimaryRootWindowController()->shelf(); |
481 return shelf && shelf->status_area_widget(); | 482 return shelf && shelf->status_area_widget(); |
482 } | 483 } |
483 | 484 |
484 SystemTray* Shell::GetPrimarySystemTray() { | 485 SystemTray* Shell::GetPrimarySystemTray() { |
485 return GetPrimaryRootWindowController()->GetSystemTray(); | 486 return GetPrimaryRootWindowController()->GetSystemTray(); |
486 } | 487 } |
487 | 488 |
488 LauncherDelegate* Shell::GetLauncherDelegate() { | 489 LauncherDelegate* Shell::GetLauncherDelegate() { |
489 if (!launcher_delegate_) { | 490 if (!launcher_delegate_) { |
491 launcher_model_.reset(new LauncherModel); | |
490 // Creates LauncherItemDelegateManager before LauncherDelegate. | 492 // Creates LauncherItemDelegateManager before LauncherDelegate. |
491 launcher_item_delegate_manager_.reset(new LauncherItemDelegateManager); | 493 launcher_item_delegate_manager_.reset( |
492 launcher_model_.reset(new LauncherModel); | 494 new LauncherItemDelegateManager(launcher_model_.get())); |
495 | |
493 launcher_delegate_.reset( | 496 launcher_delegate_.reset( |
494 delegate_->CreateLauncherDelegate(launcher_model_.get())); | 497 delegate_->CreateLauncherDelegate(launcher_model_.get())); |
495 app_list_shelf_item_delegate_.reset( | 498 scoped_ptr<LauncherItemDelegate> controller( |
496 new internal::AppListShelfItemDelegate); | 499 new internal::AppListShelfItemDelegate); |
500 | |
501 ash::LauncherID app_list_id = 0; | |
502 // TODO(simon.hong81): Make function for this in shelf_util.h | |
Mr4D (OOO till 08-26)
2013/10/09 16:14:08
Would be nice to add a comment here like:
// Findi
simonhong_
2013/10/09 22:14:10
Done.
| |
503 for (size_t i = 0; i < launcher_model_->items().size(); ++i) { | |
504 if (launcher_model_->items()[i].type == ash::TYPE_APP_LIST) { | |
505 app_list_id = launcher_model_->items()[i].id; | |
506 break; | |
507 } | |
508 } | |
509 DCHECK(app_list_id); | |
510 launcher_item_delegate_manager_->SetLauncherItemDelegate( | |
511 app_list_id, | |
512 controller.Pass()); | |
497 } | 513 } |
498 return launcher_delegate_.get(); | 514 return launcher_delegate_.get(); |
499 } | 515 } |
500 | 516 |
501 void Shell::SetTouchHudProjectionEnabled(bool enabled) { | 517 void Shell::SetTouchHudProjectionEnabled(bool enabled) { |
502 if (is_touch_hud_projection_enabled_ == enabled) | 518 if (is_touch_hud_projection_enabled_ == enabled) |
503 return; | 519 return; |
504 | 520 |
505 is_touch_hud_projection_enabled_ = enabled; | 521 is_touch_hud_projection_enabled_ = enabled; |
506 FOR_EACH_OBSERVER(ShellObserver, observers_, | 522 FOR_EACH_OBSERVER(ShellObserver, observers_, |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
635 partial_magnification_controller_.reset(); | 651 partial_magnification_controller_.reset(); |
636 resize_shadow_controller_.reset(); | 652 resize_shadow_controller_.reset(); |
637 shadow_controller_.reset(); | 653 shadow_controller_.reset(); |
638 tooltip_controller_.reset(); | 654 tooltip_controller_.reset(); |
639 event_client_.reset(); | 655 event_client_.reset(); |
640 window_cycle_controller_.reset(); | 656 window_cycle_controller_.reset(); |
641 nested_dispatcher_controller_.reset(); | 657 nested_dispatcher_controller_.reset(); |
642 user_action_client_.reset(); | 658 user_action_client_.reset(); |
643 visibility_controller_.reset(); | 659 visibility_controller_.reset(); |
644 launcher_delegate_.reset(); | 660 launcher_delegate_.reset(); |
661 // |launcher_item_delegate_manager_| observes |launcher_model_|. It must be | |
662 // destroyed before |launcher_model_| is destroyed. | |
663 launcher_item_delegate_manager_.reset(); | |
645 launcher_model_.reset(); | 664 launcher_model_.reset(); |
646 video_detector_.reset(); | 665 video_detector_.reset(); |
647 | 666 |
648 power_button_controller_.reset(); | 667 power_button_controller_.reset(); |
649 lock_state_controller_.reset(); | 668 lock_state_controller_.reset(); |
650 mru_window_tracker_.reset(); | 669 mru_window_tracker_.reset(); |
651 | 670 |
652 resolution_notification_controller_.reset(); | 671 resolution_notification_controller_.reset(); |
653 desktop_background_controller_.reset(); | 672 desktop_background_controller_.reset(); |
654 | 673 |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
971 //////////////////////////////////////////////////////////////////////////////// | 990 //////////////////////////////////////////////////////////////////////////////// |
972 // Shell, aura::client::ActivationChangeObserver implementation: | 991 // Shell, aura::client::ActivationChangeObserver implementation: |
973 | 992 |
974 void Shell::OnWindowActivated(aura::Window* gained_active, | 993 void Shell::OnWindowActivated(aura::Window* gained_active, |
975 aura::Window* lost_active) { | 994 aura::Window* lost_active) { |
976 if (gained_active) | 995 if (gained_active) |
977 target_root_window_ = gained_active->GetRootWindow(); | 996 target_root_window_ = gained_active->GetRootWindow(); |
978 } | 997 } |
979 | 998 |
980 } // namespace ash | 999 } // namespace ash |
OLD | NEW |