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/focus_manager_factory.h" | 10 #include "ash/accelerators/focus_manager_factory.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "ash/drag_drop/drag_drop_controller.h" | 21 #include "ash/drag_drop/drag_drop_controller.h" |
22 #include "ash/focus_cycler.h" | 22 #include "ash/focus_cycler.h" |
23 #include "ash/high_contrast/high_contrast_controller.h" | 23 #include "ash/high_contrast/high_contrast_controller.h" |
24 #include "ash/host/root_window_host_factory.h" | 24 #include "ash/host/root_window_host_factory.h" |
25 #include "ash/launcher/launcher_delegate.h" | 25 #include "ash/launcher/launcher_delegate.h" |
26 #include "ash/launcher/launcher_model.h" | 26 #include "ash/launcher/launcher_model.h" |
27 #include "ash/magnifier/magnification_controller.h" | 27 #include "ash/magnifier/magnification_controller.h" |
28 #include "ash/magnifier/partial_magnification_controller.h" | 28 #include "ash/magnifier/partial_magnification_controller.h" |
29 #include "ash/root_window_controller.h" | 29 #include "ash/root_window_controller.h" |
30 #include "ash/screen_ash.h" | 30 #include "ash/screen_ash.h" |
| 31 #include "ash/shelf/shelf_layout_manager.h" |
| 32 #include "ash/shelf/shelf_widget.h" |
31 #include "ash/shell_delegate.h" | 33 #include "ash/shell_delegate.h" |
32 #include "ash/shell_factory.h" | 34 #include "ash/shell_factory.h" |
33 #include "ash/shell_window_ids.h" | 35 #include "ash/shell_window_ids.h" |
34 #include "ash/system/status_area_widget.h" | 36 #include "ash/system/status_area_widget.h" |
35 #include "ash/system/tray/system_tray_delegate.h" | 37 #include "ash/system/tray/system_tray_delegate.h" |
36 #include "ash/system/tray/system_tray_notifier.h" | 38 #include "ash/system/tray/system_tray_notifier.h" |
37 #include "ash/touch/touch_observer_hud.h" | 39 #include "ash/touch/touch_observer_hud.h" |
38 #include "ash/wm/activation_controller.h" | 40 #include "ash/wm/activation_controller.h" |
39 #include "ash/wm/always_on_top_controller.h" | 41 #include "ash/wm/always_on_top_controller.h" |
40 #include "ash/wm/app_list_controller.h" | 42 #include "ash/wm/app_list_controller.h" |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 | 716 |
715 void Shell::OnLockStateChanged(bool locked) { | 717 void Shell::OnLockStateChanged(bool locked) { |
716 FOR_EACH_OBSERVER(ShellObserver, observers_, OnLockStateChanged(locked)); | 718 FOR_EACH_OBSERVER(ShellObserver, observers_, OnLockStateChanged(locked)); |
717 } | 719 } |
718 | 720 |
719 void Shell::CreateLauncher() { | 721 void Shell::CreateLauncher() { |
720 if (IsLauncherPerDisplayEnabled()) { | 722 if (IsLauncherPerDisplayEnabled()) { |
721 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 723 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
722 for (RootWindowControllerList::iterator iter = controllers.begin(); | 724 for (RootWindowControllerList::iterator iter = controllers.begin(); |
723 iter != controllers.end(); ++iter) | 725 iter != controllers.end(); ++iter) |
724 (*iter)->CreateLauncher(); | 726 (*iter)->shelf()->CreateLauncher(); |
725 } else { | 727 } else { |
726 GetPrimaryRootWindowController()->CreateLauncher(); | 728 GetPrimaryRootWindowController()->shelf()->CreateLauncher(); |
727 } | 729 } |
728 } | 730 } |
729 | 731 |
730 void Shell::ShowLauncher() { | 732 void Shell::ShowLauncher() { |
731 if (IsLauncherPerDisplayEnabled()) { | 733 if (IsLauncherPerDisplayEnabled()) { |
732 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 734 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
733 for (RootWindowControllerList::iterator iter = controllers.begin(); | 735 for (RootWindowControllerList::iterator iter = controllers.begin(); |
734 iter != controllers.end(); ++iter) | 736 iter != controllers.end(); ++iter) |
735 (*iter)->ShowLauncher(); | 737 (*iter)->ShowLauncher(); |
736 } else { | 738 } else { |
(...skipping 12 matching lines...) Expand all Loading... |
749 void Shell::UpdateShelfVisibility() { | 751 void Shell::UpdateShelfVisibility() { |
750 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 752 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
751 for (RootWindowControllerList::iterator iter = controllers.begin(); | 753 for (RootWindowControllerList::iterator iter = controllers.begin(); |
752 iter != controllers.end(); ++iter) | 754 iter != controllers.end(); ++iter) |
753 if ((*iter)->shelf()) | 755 if ((*iter)->shelf()) |
754 (*iter)->UpdateShelfVisibility(); | 756 (*iter)->UpdateShelfVisibility(); |
755 } | 757 } |
756 | 758 |
757 void Shell::SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior, | 759 void Shell::SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior, |
758 aura::RootWindow* root_window) { | 760 aura::RootWindow* root_window) { |
759 GetRootWindowController(root_window)->SetShelfAutoHideBehavior(behavior); | 761 ash::internal::ShelfLayoutManager::ForLauncher(root_window)-> |
| 762 SetAutoHideBehavior(behavior); |
760 } | 763 } |
761 | 764 |
762 ShelfAutoHideBehavior Shell::GetShelfAutoHideBehavior( | 765 ShelfAutoHideBehavior Shell::GetShelfAutoHideBehavior( |
763 aura::RootWindow* root_window) const { | 766 aura::RootWindow* root_window) const { |
764 return GetRootWindowController(root_window)->GetShelfAutoHideBehavior(); | 767 return ash::internal::ShelfLayoutManager::ForLauncher(root_window)-> |
| 768 auto_hide_behavior(); |
765 } | 769 } |
766 | 770 |
767 void Shell::SetShelfAlignment(ShelfAlignment alignment, | 771 void Shell::SetShelfAlignment(ShelfAlignment alignment, |
768 aura::RootWindow* root_window) { | 772 aura::RootWindow* root_window) { |
769 if (GetRootWindowController(root_window)->SetShelfAlignment(alignment)) { | 773 if (ash::internal::ShelfLayoutManager::ForLauncher(root_window)-> |
| 774 SetAlignment(alignment)) { |
770 FOR_EACH_OBSERVER( | 775 FOR_EACH_OBSERVER( |
771 ShellObserver, observers_, OnShelfAlignmentChanged(root_window)); | 776 ShellObserver, observers_, OnShelfAlignmentChanged(root_window)); |
772 } | 777 } |
773 } | 778 } |
774 | 779 |
775 ShelfAlignment Shell::GetShelfAlignment(aura::RootWindow* root_window) { | 780 ShelfAlignment Shell::GetShelfAlignment(aura::RootWindow* root_window) { |
776 return GetRootWindowController(root_window)->GetShelfAlignment(); | 781 return GetRootWindowController(root_window)-> |
| 782 GetShelfLayoutManager()->GetAlignment(); |
777 } | 783 } |
778 | 784 |
779 void Shell::SetDimming(bool should_dim) { | 785 void Shell::SetDimming(bool should_dim) { |
780 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 786 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
781 for (RootWindowControllerList::iterator iter = controllers.begin(); | 787 for (RootWindowControllerList::iterator iter = controllers.begin(); |
782 iter != controllers.end(); ++iter) | 788 iter != controllers.end(); ++iter) |
783 (*iter)->screen_dimmer()->SetDimming(should_dim); | 789 (*iter)->screen_dimmer()->SetDimming(should_dim); |
784 } | 790 } |
785 | 791 |
786 void Shell::CreateModalBackground(aura::Window* window) { | 792 void Shell::CreateModalBackground(aura::Window* window) { |
(...skipping 18 matching lines...) Expand all Loading... |
805 if (!activated) { | 811 if (!activated) { |
806 RemovePreTargetHandler(modality_filter_.get()); | 812 RemovePreTargetHandler(modality_filter_.get()); |
807 modality_filter_.reset(); | 813 modality_filter_.reset(); |
808 for (RootWindowControllerList::iterator iter = controllers.begin(); | 814 for (RootWindowControllerList::iterator iter = controllers.begin(); |
809 iter != controllers.end(); ++iter) | 815 iter != controllers.end(); ++iter) |
810 (*iter)->GetSystemModalLayoutManager(removed)->DestroyModalBackground(); | 816 (*iter)->GetSystemModalLayoutManager(removed)->DestroyModalBackground(); |
811 } | 817 } |
812 } | 818 } |
813 | 819 |
814 WebNotificationTray* Shell::GetWebNotificationTray() { | 820 WebNotificationTray* Shell::GetWebNotificationTray() { |
815 return GetPrimaryRootWindowController()->status_area_widget()-> | 821 return GetPrimaryRootWindowController()->shelf()-> |
816 web_notification_tray(); | 822 status_area_widget()->web_notification_tray(); |
817 } | 823 } |
818 | 824 |
819 bool Shell::HasPrimaryStatusArea() { | 825 bool Shell::HasPrimaryStatusArea() { |
820 return !!GetPrimaryRootWindowController()->status_area_widget(); | 826 return !!GetPrimaryRootWindowController()-> |
| 827 shelf()->status_area_widget(); |
821 } | 828 } |
822 | 829 |
823 SystemTray* Shell::GetPrimarySystemTray() { | 830 SystemTray* Shell::GetPrimarySystemTray() { |
824 return GetPrimaryRootWindowController()->GetSystemTray(); | 831 return GetPrimaryRootWindowController()->GetSystemTray(); |
825 } | 832 } |
826 | 833 |
827 LauncherDelegate* Shell::GetLauncherDelegate() { | 834 LauncherDelegate* Shell::GetLauncherDelegate() { |
828 if (!launcher_delegate_.get()) { | 835 if (!launcher_delegate_.get()) { |
829 launcher_model_.reset(new LauncherModel); | 836 launcher_model_.reset(new LauncherModel); |
830 launcher_delegate_.reset( | 837 launcher_delegate_.reset( |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 //////////////////////////////////////////////////////////////////////////////// | 949 //////////////////////////////////////////////////////////////////////////////// |
943 // Shell, aura::client::ActivationChangeObserver implementation: | 950 // Shell, aura::client::ActivationChangeObserver implementation: |
944 | 951 |
945 void Shell::OnWindowActivated(aura::Window* gained_active, | 952 void Shell::OnWindowActivated(aura::Window* gained_active, |
946 aura::Window* lost_active) { | 953 aura::Window* lost_active) { |
947 if (gained_active) | 954 if (gained_active) |
948 active_root_window_ = gained_active->GetRootWindow(); | 955 active_root_window_ = gained_active->GetRootWindow(); |
949 } | 956 } |
950 | 957 |
951 } // namespace ash | 958 } // namespace ash |
OLD | NEW |