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 14 matching lines...) Expand all Loading... |
25 #include "ash/display/screen_position_controller.h" | 25 #include "ash/display/screen_position_controller.h" |
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" | |
36 #include "ash/magnifier/magnification_controller.h" | 35 #include "ash/magnifier/magnification_controller.h" |
37 #include "ash/magnifier/partial_magnification_controller.h" | 36 #include "ash/magnifier/partial_magnification_controller.h" |
38 #include "ash/media_delegate.h" | 37 #include "ash/media_delegate.h" |
39 #include "ash/new_window_delegate.h" | 38 #include "ash/new_window_delegate.h" |
40 #include "ash/root_window_controller.h" | 39 #include "ash/root_window_controller.h" |
41 #include "ash/screen_ash.h" | 40 #include "ash/screen_ash.h" |
42 #include "ash/session_state_delegate.h" | 41 #include "ash/session_state_delegate.h" |
43 #include "ash/shelf/app_list_shelf_item_delegate.h" | 42 #include "ash/shelf/app_list_shelf_item_delegate.h" |
44 #include "ash/shelf/shelf_layout_manager.h" | 43 #include "ash/shelf/shelf_layout_manager.h" |
| 44 #include "ash/shelf/shelf_model.h" |
45 #include "ash/shelf/shelf_model_util.h" | 45 #include "ash/shelf/shelf_model_util.h" |
46 #include "ash/shelf/shelf_widget.h" | 46 #include "ash/shelf/shelf_widget.h" |
47 #include "ash/shell_delegate.h" | 47 #include "ash/shell_delegate.h" |
48 #include "ash/shell_factory.h" | 48 #include "ash/shell_factory.h" |
49 #include "ash/shell_window_ids.h" | 49 #include "ash/shell_window_ids.h" |
50 #include "ash/system/locale/locale_notification_controller.h" | 50 #include "ash/system/locale/locale_notification_controller.h" |
51 #include "ash/system/status_area_widget.h" | 51 #include "ash/system/status_area_widget.h" |
52 #include "ash/system/tray/system_tray_delegate.h" | 52 #include "ash/system/tray/system_tray_delegate.h" |
53 #include "ash/system/tray/system_tray_notifier.h" | 53 #include "ash/system/tray/system_tray_notifier.h" |
54 #include "ash/wm/app_list_controller.h" | 54 #include "ash/wm/app_list_controller.h" |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 ShelfWidget* shelf = GetPrimaryRootWindowController()->shelf(); | 480 ShelfWidget* shelf = GetPrimaryRootWindowController()->shelf(); |
481 return shelf && shelf->status_area_widget(); | 481 return shelf && shelf->status_area_widget(); |
482 } | 482 } |
483 | 483 |
484 SystemTray* Shell::GetPrimarySystemTray() { | 484 SystemTray* Shell::GetPrimarySystemTray() { |
485 return GetPrimaryRootWindowController()->GetSystemTray(); | 485 return GetPrimaryRootWindowController()->GetSystemTray(); |
486 } | 486 } |
487 | 487 |
488 LauncherDelegate* Shell::GetLauncherDelegate() { | 488 LauncherDelegate* Shell::GetLauncherDelegate() { |
489 if (!launcher_delegate_) { | 489 if (!launcher_delegate_) { |
490 launcher_model_.reset(new LauncherModel); | 490 shelf_model_.reset(new ShelfModel); |
491 // Creates LauncherItemDelegateManager before LauncherDelegate. | 491 // Creates LauncherItemDelegateManager before LauncherDelegate. |
492 launcher_item_delegate_manager_.reset( | 492 launcher_item_delegate_manager_.reset( |
493 new LauncherItemDelegateManager(launcher_model_.get())); | 493 new LauncherItemDelegateManager(shelf_model_.get())); |
494 | 494 |
495 launcher_delegate_.reset( | 495 launcher_delegate_.reset( |
496 delegate_->CreateLauncherDelegate(launcher_model_.get())); | 496 delegate_->CreateLauncherDelegate(shelf_model_.get())); |
497 scoped_ptr<LauncherItemDelegate> controller( | 497 scoped_ptr<LauncherItemDelegate> controller( |
498 new internal::AppListShelfItemDelegate); | 498 new internal::AppListShelfItemDelegate); |
499 | 499 |
500 // Finding the launcher model's location of the app list and setting its | 500 // Finding the shelf model's location of the app list and setting its |
501 // LauncherItemDelegate. | 501 // LauncherItemDelegate. |
502 int app_list_index = | 502 int app_list_index = GetShelfItemIndexForType(TYPE_APP_LIST, *shelf_model_); |
503 GetShelfItemIndexForType(ash::TYPE_APP_LIST, *launcher_model_); | |
504 DCHECK_GE(app_list_index, 0); | 503 DCHECK_GE(app_list_index, 0); |
505 ash::LauncherID app_list_id = launcher_model_->items()[app_list_index].id; | 504 LauncherID app_list_id = shelf_model_->items()[app_list_index].id; |
506 DCHECK(app_list_id); | 505 DCHECK(app_list_id); |
507 launcher_item_delegate_manager_->SetLauncherItemDelegate( | 506 launcher_item_delegate_manager_->SetLauncherItemDelegate( |
508 app_list_id, | 507 app_list_id, |
509 controller.Pass()); | 508 controller.Pass()); |
510 } | 509 } |
511 return launcher_delegate_.get(); | 510 return launcher_delegate_.get(); |
512 } | 511 } |
513 | 512 |
514 void Shell::SetTouchHudProjectionEnabled(bool enabled) { | 513 void Shell::SetTouchHudProjectionEnabled(bool enabled) { |
515 if (is_touch_hud_projection_enabled_ == enabled) | 514 if (is_touch_hud_projection_enabled_ == enabled) |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 partial_magnification_controller_.reset(); | 636 partial_magnification_controller_.reset(); |
638 resize_shadow_controller_.reset(); | 637 resize_shadow_controller_.reset(); |
639 shadow_controller_.reset(); | 638 shadow_controller_.reset(); |
640 tooltip_controller_.reset(); | 639 tooltip_controller_.reset(); |
641 event_client_.reset(); | 640 event_client_.reset(); |
642 window_cycle_controller_.reset(); | 641 window_cycle_controller_.reset(); |
643 nested_dispatcher_controller_.reset(); | 642 nested_dispatcher_controller_.reset(); |
644 user_action_client_.reset(); | 643 user_action_client_.reset(); |
645 visibility_controller_.reset(); | 644 visibility_controller_.reset(); |
646 launcher_delegate_.reset(); | 645 launcher_delegate_.reset(); |
647 // |launcher_item_delegate_manager_| observes |launcher_model_|. It must be | 646 // |launcher_item_delegate_manager_| observes |shelf_model_|. It must be |
648 // destroyed before |launcher_model_| is destroyed. | 647 // destroyed before |shelf_model_| is destroyed. |
649 launcher_item_delegate_manager_.reset(); | 648 launcher_item_delegate_manager_.reset(); |
650 launcher_model_.reset(); | 649 shelf_model_.reset(); |
651 video_detector_.reset(); | 650 video_detector_.reset(); |
652 | 651 |
653 power_button_controller_.reset(); | 652 power_button_controller_.reset(); |
654 lock_state_controller_.reset(); | 653 lock_state_controller_.reset(); |
655 mru_window_tracker_.reset(); | 654 mru_window_tracker_.reset(); |
656 | 655 |
657 resolution_notification_controller_.reset(); | 656 resolution_notification_controller_.reset(); |
658 desktop_background_controller_.reset(); | 657 desktop_background_controller_.reset(); |
659 | 658 |
660 // This also deletes all RootWindows. Note that we invoke Shutdown() on | 659 // This also deletes all RootWindows. Note that we invoke Shutdown() on |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 //////////////////////////////////////////////////////////////////////////////// | 995 //////////////////////////////////////////////////////////////////////////////// |
997 // Shell, aura::client::ActivationChangeObserver implementation: | 996 // Shell, aura::client::ActivationChangeObserver implementation: |
998 | 997 |
999 void Shell::OnWindowActivated(aura::Window* gained_active, | 998 void Shell::OnWindowActivated(aura::Window* gained_active, |
1000 aura::Window* lost_active) { | 999 aura::Window* lost_active) { |
1001 if (gained_active) | 1000 if (gained_active) |
1002 target_root_window_ = gained_active->GetRootWindow(); | 1001 target_root_window_ = gained_active->GetRootWindow(); |
1003 } | 1002 } |
1004 | 1003 |
1005 } // namespace ash | 1004 } // namespace ash |
OLD | NEW |