| 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 return shelf && shelf->status_area_widget(); | 492 return shelf && shelf->status_area_widget(); |
| 493 } | 493 } |
| 494 | 494 |
| 495 SystemTray* Shell::GetPrimarySystemTray() { | 495 SystemTray* Shell::GetPrimarySystemTray() { |
| 496 return GetPrimaryRootWindowController()->GetSystemTray(); | 496 return GetPrimaryRootWindowController()->GetSystemTray(); |
| 497 } | 497 } |
| 498 | 498 |
| 499 LauncherDelegate* Shell::GetLauncherDelegate() { | 499 LauncherDelegate* Shell::GetLauncherDelegate() { |
| 500 if (!launcher_delegate_) { | 500 if (!launcher_delegate_) { |
| 501 shelf_model_.reset(new ShelfModel); | 501 shelf_model_.reset(new ShelfModel); |
| 502 // Creates LauncherItemDelegateManager before LauncherDelegate. | 502 // Creates ShelfItemDelegateManager before LauncherDelegate. |
| 503 launcher_item_delegate_manager_.reset( | 503 shelf_item_delegate_manager_.reset( |
| 504 new LauncherItemDelegateManager(shelf_model_.get())); | 504 new ShelfItemDelegateManager(shelf_model_.get())); |
| 505 | 505 |
| 506 launcher_delegate_.reset( | 506 launcher_delegate_.reset( |
| 507 delegate_->CreateLauncherDelegate(shelf_model_.get())); | 507 delegate_->CreateLauncherDelegate(shelf_model_.get())); |
| 508 scoped_ptr<LauncherItemDelegate> controller( | 508 scoped_ptr<ShelfItemDelegate> controller( |
| 509 new internal::AppListShelfItemDelegate); | 509 new internal::AppListShelfItemDelegate); |
| 510 | 510 |
| 511 // Finding the shelf model's location of the app list and setting its | 511 // Finding the shelf model's location of the app list and setting its |
| 512 // LauncherItemDelegate. | 512 // ShelfItemDelegate. |
| 513 int app_list_index = shelf_model_->GetItemIndexForType(TYPE_APP_LIST); | 513 int app_list_index = shelf_model_->GetItemIndexForType(TYPE_APP_LIST); |
| 514 DCHECK_GE(app_list_index, 0); | 514 DCHECK_GE(app_list_index, 0); |
| 515 LauncherID app_list_id = shelf_model_->items()[app_list_index].id; | 515 LauncherID app_list_id = shelf_model_->items()[app_list_index].id; |
| 516 DCHECK(app_list_id); | 516 DCHECK(app_list_id); |
| 517 launcher_item_delegate_manager_->SetLauncherItemDelegate( | 517 shelf_item_delegate_manager_->SetShelfItemDelegate(app_list_id, |
| 518 app_list_id, | 518 controller.Pass()); |
| 519 controller.Pass()); | |
| 520 } | 519 } |
| 521 return launcher_delegate_.get(); | 520 return launcher_delegate_.get(); |
| 522 } | 521 } |
| 523 | 522 |
| 524 void Shell::SetTouchHudProjectionEnabled(bool enabled) { | 523 void Shell::SetTouchHudProjectionEnabled(bool enabled) { |
| 525 if (is_touch_hud_projection_enabled_ == enabled) | 524 if (is_touch_hud_projection_enabled_ == enabled) |
| 526 return; | 525 return; |
| 527 | 526 |
| 528 is_touch_hud_projection_enabled_ = enabled; | 527 is_touch_hud_projection_enabled_ = enabled; |
| 529 FOR_EACH_OBSERVER(ShellObserver, observers_, | 528 FOR_EACH_OBSERVER(ShellObserver, observers_, |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 partial_magnification_controller_.reset(); | 648 partial_magnification_controller_.reset(); |
| 650 resize_shadow_controller_.reset(); | 649 resize_shadow_controller_.reset(); |
| 651 shadow_controller_.reset(); | 650 shadow_controller_.reset(); |
| 652 tooltip_controller_.reset(); | 651 tooltip_controller_.reset(); |
| 653 event_client_.reset(); | 652 event_client_.reset(); |
| 654 window_cycle_controller_.reset(); | 653 window_cycle_controller_.reset(); |
| 655 nested_dispatcher_controller_.reset(); | 654 nested_dispatcher_controller_.reset(); |
| 656 user_action_client_.reset(); | 655 user_action_client_.reset(); |
| 657 visibility_controller_.reset(); | 656 visibility_controller_.reset(); |
| 658 launcher_delegate_.reset(); | 657 launcher_delegate_.reset(); |
| 659 // |launcher_item_delegate_manager_| observes |shelf_model_|. It must be | 658 // |shelf_item_delegate_manager_| observes |shelf_model_|. It must be |
| 660 // destroyed before |shelf_model_| is destroyed. | 659 // destroyed before |shelf_model_| is destroyed. |
| 661 launcher_item_delegate_manager_.reset(); | 660 shelf_item_delegate_manager_.reset(); |
| 662 shelf_model_.reset(); | 661 shelf_model_.reset(); |
| 663 video_detector_.reset(); | 662 video_detector_.reset(); |
| 664 | 663 |
| 665 power_button_controller_.reset(); | 664 power_button_controller_.reset(); |
| 666 lock_state_controller_.reset(); | 665 lock_state_controller_.reset(); |
| 667 mru_window_tracker_.reset(); | 666 mru_window_tracker_.reset(); |
| 668 | 667 |
| 669 resolution_notification_controller_.reset(); | 668 resolution_notification_controller_.reset(); |
| 670 desktop_background_controller_.reset(); | 669 desktop_background_controller_.reset(); |
| 671 | 670 |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 //////////////////////////////////////////////////////////////////////////////// | 1001 //////////////////////////////////////////////////////////////////////////////// |
| 1003 // Shell, aura::client::ActivationChangeObserver implementation: | 1002 // Shell, aura::client::ActivationChangeObserver implementation: |
| 1004 | 1003 |
| 1005 void Shell::OnWindowActivated(aura::Window* gained_active, | 1004 void Shell::OnWindowActivated(aura::Window* gained_active, |
| 1006 aura::Window* lost_active) { | 1005 aura::Window* lost_active) { |
| 1007 if (gained_active) | 1006 if (gained_active) |
| 1008 target_root_window_ = gained_active->GetRootWindow(); | 1007 target_root_window_ = gained_active->GetRootWindow(); |
| 1009 } | 1008 } |
| 1010 | 1009 |
| 1011 } // namespace ash | 1010 } // namespace ash |
| OLD | NEW |