| 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 13 matching lines...) Expand all Loading... |
| 24 #include "ash/display/resolution_notification_controller.h" | 24 #include "ash/display/resolution_notification_controller.h" |
| 25 #include "ash/display/screen_position_controller.h" | 25 #include "ash/display/screen_position_controller.h" |
| 26 #include "ash/display/virtual_keyboard_window_controller.h" | 26 #include "ash/display/virtual_keyboard_window_controller.h" |
| 27 #include "ash/drag_drop/drag_drop_controller.h" | 27 #include "ash/drag_drop/drag_drop_controller.h" |
| 28 #include "ash/first_run/first_run_helper_impl.h" | 28 #include "ash/first_run/first_run_helper_impl.h" |
| 29 #include "ash/focus_cycler.h" | 29 #include "ash/focus_cycler.h" |
| 30 #include "ash/high_contrast/high_contrast_controller.h" | 30 #include "ash/high_contrast/high_contrast_controller.h" |
| 31 #include "ash/host/root_window_host_factory.h" | 31 #include "ash/host/root_window_host_factory.h" |
| 32 #include "ash/keyboard_uma_event_filter.h" | 32 #include "ash/keyboard_uma_event_filter.h" |
| 33 #include "ash/launcher/launcher_delegate.h" | 33 #include "ash/launcher/launcher_delegate.h" |
| 34 #include "ash/launcher/launcher_item_delegate.h" | |
| 35 #include "ash/launcher/launcher_item_delegate_manager.h" | |
| 36 #include "ash/magnifier/magnification_controller.h" | 34 #include "ash/magnifier/magnification_controller.h" |
| 37 #include "ash/magnifier/partial_magnification_controller.h" | 35 #include "ash/magnifier/partial_magnification_controller.h" |
| 38 #include "ash/media_delegate.h" | 36 #include "ash/media_delegate.h" |
| 39 #include "ash/new_window_delegate.h" | 37 #include "ash/new_window_delegate.h" |
| 40 #include "ash/root_window_controller.h" | 38 #include "ash/root_window_controller.h" |
| 41 #include "ash/screen_ash.h" | 39 #include "ash/screen_ash.h" |
| 42 #include "ash/session_state_delegate.h" | 40 #include "ash/session_state_delegate.h" |
| 43 #include "ash/shelf/app_list_shelf_item_delegate.h" | 41 #include "ash/shelf/app_list_shelf_item_delegate.h" |
| 42 #include "ash/shelf/shelf_item_delegate.h" |
| 43 #include "ash/shelf/shelf_item_delegate_manager.h" |
| 44 #include "ash/shelf/shelf_layout_manager.h" | 44 #include "ash/shelf/shelf_layout_manager.h" |
| 45 #include "ash/shelf/shelf_model.h" | 45 #include "ash/shelf/shelf_model.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" |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 return shelf && shelf->status_area_widget(); | 493 return shelf && shelf->status_area_widget(); |
| 494 } | 494 } |
| 495 | 495 |
| 496 SystemTray* Shell::GetPrimarySystemTray() { | 496 SystemTray* Shell::GetPrimarySystemTray() { |
| 497 return GetPrimaryRootWindowController()->GetSystemTray(); | 497 return GetPrimaryRootWindowController()->GetSystemTray(); |
| 498 } | 498 } |
| 499 | 499 |
| 500 LauncherDelegate* Shell::GetLauncherDelegate() { | 500 LauncherDelegate* Shell::GetLauncherDelegate() { |
| 501 if (!launcher_delegate_) { | 501 if (!launcher_delegate_) { |
| 502 shelf_model_.reset(new ShelfModel); | 502 shelf_model_.reset(new ShelfModel); |
| 503 // Creates LauncherItemDelegateManager before LauncherDelegate. | 503 // Creates ShelfItemDelegateManager before LauncherDelegate. |
| 504 launcher_item_delegate_manager_.reset( | 504 shelf_item_delegate_manager_.reset( |
| 505 new LauncherItemDelegateManager(shelf_model_.get())); | 505 new ShelfItemDelegateManager(shelf_model_.get())); |
| 506 | 506 |
| 507 launcher_delegate_.reset( | 507 launcher_delegate_.reset( |
| 508 delegate_->CreateLauncherDelegate(shelf_model_.get())); | 508 delegate_->CreateLauncherDelegate(shelf_model_.get())); |
| 509 scoped_ptr<LauncherItemDelegate> controller( | 509 scoped_ptr<ShelfItemDelegate> controller( |
| 510 new internal::AppListShelfItemDelegate); | 510 new internal::AppListShelfItemDelegate); |
| 511 | 511 |
| 512 // Finding the shelf model's location of the app list and setting its | 512 // Finding the shelf model's location of the app list and setting its |
| 513 // LauncherItemDelegate. | 513 // ShelfItemDelegate. |
| 514 int app_list_index = shelf_model_->GetItemIndexForType(TYPE_APP_LIST); | 514 int app_list_index = shelf_model_->GetItemIndexForType(TYPE_APP_LIST); |
| 515 DCHECK_GE(app_list_index, 0); | 515 DCHECK_GE(app_list_index, 0); |
| 516 LauncherID app_list_id = shelf_model_->items()[app_list_index].id; | 516 LauncherID app_list_id = shelf_model_->items()[app_list_index].id; |
| 517 DCHECK(app_list_id); | 517 DCHECK(app_list_id); |
| 518 launcher_item_delegate_manager_->SetLauncherItemDelegate( | 518 shelf_item_delegate_manager_->SetShelfItemDelegate(app_list_id, |
| 519 app_list_id, | 519 controller.Pass()); |
| 520 controller.Pass()); | |
| 521 } | 520 } |
| 522 return launcher_delegate_.get(); | 521 return launcher_delegate_.get(); |
| 523 } | 522 } |
| 524 | 523 |
| 525 void Shell::SetTouchHudProjectionEnabled(bool enabled) { | 524 void Shell::SetTouchHudProjectionEnabled(bool enabled) { |
| 526 if (is_touch_hud_projection_enabled_ == enabled) | 525 if (is_touch_hud_projection_enabled_ == enabled) |
| 527 return; | 526 return; |
| 528 | 527 |
| 529 is_touch_hud_projection_enabled_ = enabled; | 528 is_touch_hud_projection_enabled_ = enabled; |
| 530 FOR_EACH_OBSERVER(ShellObserver, observers_, | 529 FOR_EACH_OBSERVER(ShellObserver, observers_, |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 partial_magnification_controller_.reset(); | 649 partial_magnification_controller_.reset(); |
| 651 resize_shadow_controller_.reset(); | 650 resize_shadow_controller_.reset(); |
| 652 shadow_controller_.reset(); | 651 shadow_controller_.reset(); |
| 653 tooltip_controller_.reset(); | 652 tooltip_controller_.reset(); |
| 654 event_client_.reset(); | 653 event_client_.reset(); |
| 655 window_cycle_controller_.reset(); | 654 window_cycle_controller_.reset(); |
| 656 nested_dispatcher_controller_.reset(); | 655 nested_dispatcher_controller_.reset(); |
| 657 user_action_client_.reset(); | 656 user_action_client_.reset(); |
| 658 visibility_controller_.reset(); | 657 visibility_controller_.reset(); |
| 659 launcher_delegate_.reset(); | 658 launcher_delegate_.reset(); |
| 660 // |launcher_item_delegate_manager_| observes |shelf_model_|. It must be | 659 // |shelf_item_delegate_manager_| observes |shelf_model_|. It must be |
| 661 // destroyed before |shelf_model_| is destroyed. | 660 // destroyed before |shelf_model_| is destroyed. |
| 662 launcher_item_delegate_manager_.reset(); | 661 shelf_item_delegate_manager_.reset(); |
| 663 shelf_model_.reset(); | 662 shelf_model_.reset(); |
| 664 video_detector_.reset(); | 663 video_detector_.reset(); |
| 665 | 664 |
| 666 power_button_controller_.reset(); | 665 power_button_controller_.reset(); |
| 667 lock_state_controller_.reset(); | 666 lock_state_controller_.reset(); |
| 668 mru_window_tracker_.reset(); | 667 mru_window_tracker_.reset(); |
| 669 | 668 |
| 670 resolution_notification_controller_.reset(); | 669 resolution_notification_controller_.reset(); |
| 671 desktop_background_controller_.reset(); | 670 desktop_background_controller_.reset(); |
| 672 | 671 |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1012 //////////////////////////////////////////////////////////////////////////////// | 1011 //////////////////////////////////////////////////////////////////////////////// |
| 1013 // Shell, aura::client::ActivationChangeObserver implementation: | 1012 // Shell, aura::client::ActivationChangeObserver implementation: |
| 1014 | 1013 |
| 1015 void Shell::OnWindowActivated(aura::Window* gained_active, | 1014 void Shell::OnWindowActivated(aura::Window* gained_active, |
| 1016 aura::Window* lost_active) { | 1015 aura::Window* lost_active) { |
| 1017 if (gained_active) | 1016 if (gained_active) |
| 1018 target_root_window_ = gained_active->GetRootWindow(); | 1017 target_root_window_ = gained_active->GetRootWindow(); |
| 1019 } | 1018 } |
| 1020 | 1019 |
| 1021 } // namespace ash | 1020 } // namespace ash |
| OLD | NEW |