| 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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 (*iter)->UpdateAfterLoginStatusChange(status); | 701 (*iter)->UpdateAfterLoginStatusChange(status); |
| 700 } | 702 } |
| 701 | 703 |
| 702 void Shell::OnAppTerminating() { | 704 void Shell::OnAppTerminating() { |
| 703 FOR_EACH_OBSERVER(ShellObserver, observers_, OnAppTerminating()); | 705 FOR_EACH_OBSERVER(ShellObserver, observers_, OnAppTerminating()); |
| 704 } | 706 } |
| 705 | 707 |
| 706 void Shell::OnLockStateChanged(bool locked) { | 708 void Shell::OnLockStateChanged(bool locked) { |
| 707 FOR_EACH_OBSERVER(ShellObserver, observers_, OnLockStateChanged(locked)); | 709 FOR_EACH_OBSERVER(ShellObserver, observers_, OnLockStateChanged(locked)); |
| 708 } | 710 } |
| 709 | |
| 710 void Shell::CreateLauncher() { | 711 void Shell::CreateLauncher() { |
| 711 if (IsLauncherPerDisplayEnabled()) { | 712 if (IsLauncherPerDisplayEnabled()) { |
| 712 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 713 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 713 for (RootWindowControllerList::iterator iter = controllers.begin(); | 714 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 714 iter != controllers.end(); ++iter) | 715 iter != controllers.end(); ++iter) |
| 715 (*iter)->CreateLauncher(); | 716 (*iter)->shelf()->CreateLauncher(); |
| 716 } else { | 717 } else { |
| 717 GetPrimaryRootWindowController()->CreateLauncher(); | 718 GetPrimaryRootWindowController()->shelf()->CreateLauncher(); |
| 718 } | 719 } |
| 719 } | 720 } |
| 720 | 721 |
| 721 void Shell::ShowLauncher() { | 722 void Shell::ShowLauncher() { |
| 722 if (IsLauncherPerDisplayEnabled()) { | 723 if (IsLauncherPerDisplayEnabled()) { |
| 723 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 724 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 724 for (RootWindowControllerList::iterator iter = controllers.begin(); | 725 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 725 iter != controllers.end(); ++iter) | 726 iter != controllers.end(); ++iter) |
| 726 (*iter)->ShowLauncher(); | 727 (*iter)->ShowLauncher(); |
| 727 } else { | 728 } else { |
| 728 GetPrimaryRootWindowController()->ShowLauncher(); | 729 GetPrimaryRootWindowController()->ShowLauncher(); |
| 729 } | 730 } |
| 730 } | 731 } |
| 731 | 732 |
| 732 void Shell::AddShellObserver(ShellObserver* observer) { | 733 void Shell::AddShellObserver(ShellObserver* observer) { |
| 733 observers_.AddObserver(observer); | 734 observers_.AddObserver(observer); |
| 734 } | 735 } |
| 735 | 736 |
| 736 void Shell::RemoveShellObserver(ShellObserver* observer) { | 737 void Shell::RemoveShellObserver(ShellObserver* observer) { |
| 737 observers_.RemoveObserver(observer); | 738 observers_.RemoveObserver(observer); |
| 738 } | 739 } |
| 739 | 740 |
| 740 void Shell::UpdateShelfVisibility() { | 741 void Shell::UpdateShelfVisibility() { |
| 741 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 742 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 742 for (RootWindowControllerList::iterator iter = controllers.begin(); | 743 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 743 iter != controllers.end(); ++iter) | 744 iter != controllers.end(); ++iter) |
| 744 if ((*iter)->shelf()) | 745 if ((*iter)->shelf()) |
| 745 (*iter)->UpdateShelfVisibility(); | 746 (*iter)->UpdateShelfVisibility(); |
| 746 } | 747 } |
| 747 | 748 |
| 748 void Shell::SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior, | 749 void Shell::SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior, |
| 749 aura::RootWindow* root_window) { | 750 aura::RootWindow* root_window) { |
| 750 GetRootWindowController(root_window)->SetShelfAutoHideBehavior(behavior); | 751 ash::internal::ShelfLayoutManager::ForLauncher(root_window)-> |
| 752 SetAutoHideBehavior(behavior); |
| 751 } | 753 } |
| 752 | 754 |
| 753 ShelfAutoHideBehavior Shell::GetShelfAutoHideBehavior( | 755 ShelfAutoHideBehavior Shell::GetShelfAutoHideBehavior( |
| 754 aura::RootWindow* root_window) const { | 756 aura::RootWindow* root_window) const { |
| 755 return GetRootWindowController(root_window)->GetShelfAutoHideBehavior(); | 757 return ash::internal::ShelfLayoutManager::ForLauncher(root_window)-> |
| 758 auto_hide_behavior(); |
| 756 } | 759 } |
| 757 | 760 |
| 758 void Shell::SetShelfAlignment(ShelfAlignment alignment, | 761 void Shell::SetShelfAlignment(ShelfAlignment alignment, |
| 759 aura::RootWindow* root_window) { | 762 aura::RootWindow* root_window) { |
| 760 if (GetRootWindowController(root_window)->SetShelfAlignment(alignment)) { | 763 if (ash::internal::ShelfLayoutManager::ForLauncher(root_window)-> |
| 764 SetAlignment(alignment)) { |
| 761 FOR_EACH_OBSERVER( | 765 FOR_EACH_OBSERVER( |
| 762 ShellObserver, observers_, OnShelfAlignmentChanged(root_window)); | 766 ShellObserver, observers_, OnShelfAlignmentChanged(root_window)); |
| 763 } | 767 } |
| 764 } | 768 } |
| 765 | 769 |
| 766 ShelfAlignment Shell::GetShelfAlignment(aura::RootWindow* root_window) { | 770 ShelfAlignment Shell::GetShelfAlignment(aura::RootWindow* root_window) { |
| 767 return GetRootWindowController(root_window)->GetShelfAlignment(); | 771 return GetRootWindowController(root_window)-> |
| 772 shelf_layout_manager()->GetAlignment(); |
| 768 } | 773 } |
| 769 | 774 |
| 770 void Shell::SetDimming(bool should_dim) { | 775 void Shell::SetDimming(bool should_dim) { |
| 771 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 776 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 772 for (RootWindowControllerList::iterator iter = controllers.begin(); | 777 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 773 iter != controllers.end(); ++iter) | 778 iter != controllers.end(); ++iter) |
| 774 (*iter)->screen_dimmer()->SetDimming(should_dim); | 779 (*iter)->screen_dimmer()->SetDimming(should_dim); |
| 775 } | 780 } |
| 776 | 781 |
| 777 void Shell::CreateModalBackground(aura::Window* window) { | 782 void Shell::CreateModalBackground(aura::Window* window) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 796 if (!activated) { | 801 if (!activated) { |
| 797 RemovePreTargetHandler(modality_filter_.get()); | 802 RemovePreTargetHandler(modality_filter_.get()); |
| 798 modality_filter_.reset(); | 803 modality_filter_.reset(); |
| 799 for (RootWindowControllerList::iterator iter = controllers.begin(); | 804 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 800 iter != controllers.end(); ++iter) | 805 iter != controllers.end(); ++iter) |
| 801 (*iter)->GetSystemModalLayoutManager(removed)->DestroyModalBackground(); | 806 (*iter)->GetSystemModalLayoutManager(removed)->DestroyModalBackground(); |
| 802 } | 807 } |
| 803 } | 808 } |
| 804 | 809 |
| 805 WebNotificationTray* Shell::GetWebNotificationTray() { | 810 WebNotificationTray* Shell::GetWebNotificationTray() { |
| 806 return GetPrimaryRootWindowController()->status_area_widget()-> | 811 return GetPrimaryRootWindowController()->shelf()-> |
| 807 web_notification_tray(); | 812 status_area_widget()->web_notification_tray(); |
| 808 } | 813 } |
| 809 | 814 |
| 810 bool Shell::HasPrimaryStatusArea() { | 815 bool Shell::HasPrimaryStatusArea() { |
| 811 return !!GetPrimaryRootWindowController()->status_area_widget(); | 816 return !!GetPrimaryRootWindowController()-> |
| 817 shelf()->status_area_widget(); |
| 812 } | 818 } |
| 813 | 819 |
| 814 SystemTray* Shell::GetPrimarySystemTray() { | 820 SystemTray* Shell::GetPrimarySystemTray() { |
| 815 return GetPrimaryRootWindowController()->GetSystemTray(); | 821 return GetPrimaryRootWindowController()->GetSystemTray(); |
| 816 } | 822 } |
| 817 | 823 |
| 818 LauncherDelegate* Shell::GetLauncherDelegate() { | 824 LauncherDelegate* Shell::GetLauncherDelegate() { |
| 819 if (!launcher_delegate_.get()) { | 825 if (!launcher_delegate_.get()) { |
| 820 launcher_model_.reset(new LauncherModel); | 826 launcher_model_.reset(new LauncherModel); |
| 821 launcher_delegate_.reset( | 827 launcher_delegate_.reset( |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 939 //////////////////////////////////////////////////////////////////////////////// | 945 //////////////////////////////////////////////////////////////////////////////// |
| 940 // Shell, aura::client::ActivationChangeObserver implementation: | 946 // Shell, aura::client::ActivationChangeObserver implementation: |
| 941 | 947 |
| 942 void Shell::OnWindowActivated(aura::Window* gained_active, | 948 void Shell::OnWindowActivated(aura::Window* gained_active, |
| 943 aura::Window* lost_active) { | 949 aura::Window* lost_active) { |
| 944 if (gained_active) | 950 if (gained_active) |
| 945 active_root_window_ = gained_active->GetRootWindow(); | 951 active_root_window_ = gained_active->GetRootWindow(); |
| 946 } | 952 } |
| 947 | 953 |
| 948 } // namespace ash | 954 } // namespace ash |
| OLD | NEW |