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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 ShelfWidget* shelf = GetPrimaryRootWindowController()->shelf(); | 478 ShelfWidget* shelf = GetPrimaryRootWindowController()->shelf(); |
478 return shelf && shelf->status_area_widget(); | 479 return shelf && shelf->status_area_widget(); |
479 } | 480 } |
480 | 481 |
481 SystemTray* Shell::GetPrimarySystemTray() { | 482 SystemTray* Shell::GetPrimarySystemTray() { |
482 return GetPrimaryRootWindowController()->GetSystemTray(); | 483 return GetPrimaryRootWindowController()->GetSystemTray(); |
483 } | 484 } |
484 | 485 |
485 LauncherDelegate* Shell::GetLauncherDelegate() { | 486 LauncherDelegate* Shell::GetLauncherDelegate() { |
486 if (!launcher_delegate_) { | 487 if (!launcher_delegate_) { |
| 488 launcher_model_.reset(new LauncherModel); |
487 // Creates LauncherItemDelegateManager before LauncherDelegate. | 489 // Creates LauncherItemDelegateManager before LauncherDelegate. |
488 launcher_item_delegate_manager_.reset(new LauncherItemDelegateManager); | 490 launcher_item_delegate_manager_.reset( |
489 launcher_model_.reset(new LauncherModel); | 491 new LauncherItemDelegateManager(launcher_model_.get())); |
| 492 |
490 launcher_delegate_.reset( | 493 launcher_delegate_.reset( |
491 delegate_->CreateLauncherDelegate(launcher_model_.get())); | 494 delegate_->CreateLauncherDelegate(launcher_model_.get())); |
492 app_list_shelf_item_delegate_.reset( | 495 scoped_ptr<LauncherItemDelegate> controller( |
493 new internal::AppListShelfItemDelegate); | 496 new internal::AppListShelfItemDelegate); |
| 497 |
| 498 ash::LauncherID app_list_id = 0; |
| 499 // TODO(simon.hong81): Make function for this in shelf_util.h |
| 500 // Finding the launcher model's location of the app list and setting its |
| 501 // LauncherItemDelegate. |
| 502 for (size_t i = 0; i < launcher_model_->items().size(); ++i) { |
| 503 if (launcher_model_->items()[i].type == ash::TYPE_APP_LIST) { |
| 504 app_list_id = launcher_model_->items()[i].id; |
| 505 break; |
| 506 } |
| 507 } |
| 508 DCHECK(app_list_id); |
| 509 launcher_item_delegate_manager_->SetLauncherItemDelegate( |
| 510 app_list_id, |
| 511 controller.Pass()); |
494 } | 512 } |
495 return launcher_delegate_.get(); | 513 return launcher_delegate_.get(); |
496 } | 514 } |
497 | 515 |
498 void Shell::SetTouchHudProjectionEnabled(bool enabled) { | 516 void Shell::SetTouchHudProjectionEnabled(bool enabled) { |
499 if (is_touch_hud_projection_enabled_ == enabled) | 517 if (is_touch_hud_projection_enabled_ == enabled) |
500 return; | 518 return; |
501 | 519 |
502 is_touch_hud_projection_enabled_ = enabled; | 520 is_touch_hud_projection_enabled_ = enabled; |
503 FOR_EACH_OBSERVER(ShellObserver, observers_, | 521 FOR_EACH_OBSERVER(ShellObserver, observers_, |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 partial_magnification_controller_.reset(); | 655 partial_magnification_controller_.reset(); |
638 resize_shadow_controller_.reset(); | 656 resize_shadow_controller_.reset(); |
639 shadow_controller_.reset(); | 657 shadow_controller_.reset(); |
640 tooltip_controller_.reset(); | 658 tooltip_controller_.reset(); |
641 event_client_.reset(); | 659 event_client_.reset(); |
642 window_cycle_controller_.reset(); | 660 window_cycle_controller_.reset(); |
643 nested_dispatcher_controller_.reset(); | 661 nested_dispatcher_controller_.reset(); |
644 user_action_client_.reset(); | 662 user_action_client_.reset(); |
645 visibility_controller_.reset(); | 663 visibility_controller_.reset(); |
646 launcher_delegate_.reset(); | 664 launcher_delegate_.reset(); |
| 665 // |launcher_item_delegate_manager_| observes |launcher_model_|. It must be |
| 666 // destroyed before |launcher_model_| is destroyed. |
| 667 launcher_item_delegate_manager_.reset(); |
647 launcher_model_.reset(); | 668 launcher_model_.reset(); |
648 video_detector_.reset(); | 669 video_detector_.reset(); |
649 | 670 |
650 power_button_controller_.reset(); | 671 power_button_controller_.reset(); |
651 lock_state_controller_.reset(); | 672 lock_state_controller_.reset(); |
652 mru_window_tracker_.reset(); | 673 mru_window_tracker_.reset(); |
653 | 674 |
654 resolution_notification_controller_.reset(); | 675 resolution_notification_controller_.reset(); |
655 desktop_background_controller_.reset(); | 676 desktop_background_controller_.reset(); |
656 | 677 |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 //////////////////////////////////////////////////////////////////////////////// | 1001 //////////////////////////////////////////////////////////////////////////////// |
981 // Shell, aura::client::ActivationChangeObserver implementation: | 1002 // Shell, aura::client::ActivationChangeObserver implementation: |
982 | 1003 |
983 void Shell::OnWindowActivated(aura::Window* gained_active, | 1004 void Shell::OnWindowActivated(aura::Window* gained_active, |
984 aura::Window* lost_active) { | 1005 aura::Window* lost_active) { |
985 if (gained_active) | 1006 if (gained_active) |
986 target_root_window_ = gained_active->GetRootWindow(); | 1007 target_root_window_ = gained_active->GetRootWindow(); |
987 } | 1008 } |
988 | 1009 |
989 } // namespace ash | 1010 } // namespace ash |
OLD | NEW |