| Index: ash/shell.cc
|
| diff --git a/ash/shell.cc b/ash/shell.cc
|
| index 6e03f8ecc972d36648cb701c5cd542155a18d90c..a47342532479353817c3d0d6731e38521a4ec360 100644
|
| --- a/ash/shell.cc
|
| +++ b/ash/shell.cc
|
| @@ -28,6 +28,7 @@
|
| #include "ash/common/shelf/shelf_model.h"
|
| #include "ash/common/shelf/wm_shelf.h"
|
| #include "ash/common/shell_delegate.h"
|
| +#include "ash/common/shell_observer.h"
|
| #include "ash/common/system/chromeos/bluetooth/bluetooth_notification_controller.h"
|
| #include "ash/common/system/chromeos/network/sms_observer.h"
|
| #include "ash/common/system/chromeos/power/power_status.h"
|
| @@ -288,17 +289,17 @@ void Shell::SetDisplayWorkAreaInsets(Window* contains,
|
| }
|
|
|
| void Shell::OnLoginStateChanged(LoginStatus status) {
|
| - for (auto& observer : *wm_shell_->shell_observers())
|
| + for (auto& observer : shell_observers_)
|
| observer.OnLoginStateChanged(status);
|
| }
|
|
|
| void Shell::OnAppTerminating() {
|
| - for (auto& observer : *wm_shell_->shell_observers())
|
| + for (auto& observer : shell_observers_)
|
| observer.OnAppTerminating();
|
| }
|
|
|
| void Shell::OnLockStateChanged(bool locked) {
|
| - for (auto& observer : *wm_shell_->shell_observers())
|
| + for (auto& observer : shell_observers_)
|
| observer.OnLockStateChanged(locked);
|
| #ifndef NDEBUG
|
| // Make sure that there is no system modal in Lock layer when unlocked.
|
| @@ -313,12 +314,12 @@ void Shell::OnLockStateChanged(bool locked) {
|
| }
|
|
|
| void Shell::OnCastingSessionStartedOrStopped(bool started) {
|
| - for (auto& observer : *wm_shell_->shell_observers())
|
| + for (auto& observer : shell_observers_)
|
| observer.OnCastingSessionStartedOrStopped(started);
|
| }
|
|
|
| void Shell::OnRootWindowAdded(WmWindow* root_window) {
|
| - for (auto& observer : *wm_shell_->shell_observers())
|
| + for (auto& observer : shell_observers_)
|
| observer.OnRootWindowAdded(root_window);
|
| }
|
|
|
| @@ -372,7 +373,7 @@ void Shell::SetTouchHudProjectionEnabled(bool enabled) {
|
| return;
|
|
|
| is_touch_hud_projection_enabled_ = enabled;
|
| - for (auto& observer : *wm_shell_->shell_observers())
|
| + for (auto& observer : shell_observers_)
|
| observer.OnTouchHudProjectionToggled(enabled);
|
| }
|
|
|
| @@ -397,6 +398,70 @@ void Shell::DoInitialWorkspaceAnimation() {
|
| ->DoInitialAnimation();
|
| }
|
|
|
| +void Shell::AddShellObserver(ShellObserver* observer) {
|
| + shell_observers_.AddObserver(observer);
|
| +}
|
| +
|
| +void Shell::RemoveShellObserver(ShellObserver* observer) {
|
| + shell_observers_.RemoveObserver(observer);
|
| +}
|
| +
|
| +void Shell::OnMaximizeModeStarted() {
|
| + for (auto& observer : shell_observers_)
|
| + observer.OnMaximizeModeStarted();
|
| +}
|
| +
|
| +void Shell::OnMaximizeModeEnding() {
|
| + for (auto& observer : shell_observers_)
|
| + observer.OnMaximizeModeEnding();
|
| +}
|
| +
|
| +void Shell::OnMaximizeModeEnded() {
|
| + for (auto& observer : shell_observers_)
|
| + observer.OnMaximizeModeEnded();
|
| +}
|
| +
|
| +void Shell::OnOverviewModeStarting() {
|
| + for (auto& observer : shell_observers_)
|
| + observer.OnOverviewModeStarting();
|
| +}
|
| +
|
| +void Shell::OnOverviewModeEnded() {
|
| + for (auto& observer : shell_observers_)
|
| + observer.OnOverviewModeEnded();
|
| +}
|
| +
|
| +void Shell::NotifyFullscreenStateChanged(bool is_fullscreen,
|
| + WmWindow* root_window) {
|
| + for (auto& observer : shell_observers_)
|
| + observer.OnFullscreenStateChanged(is_fullscreen, root_window);
|
| +}
|
| +
|
| +void Shell::NotifyPinnedStateChanged(WmWindow* pinned_window) {
|
| + for (auto& observer : shell_observers_)
|
| + observer.OnPinnedStateChanged(pinned_window);
|
| +}
|
| +
|
| +void Shell::NotifyVirtualKeyboardActivated(bool activated) {
|
| + for (auto& observer : shell_observers_)
|
| + observer.OnVirtualKeyboardStateChanged(activated);
|
| +}
|
| +
|
| +void Shell::NotifyShelfCreatedForRootWindow(WmWindow* root_window) {
|
| + for (auto& observer : shell_observers_)
|
| + observer.OnShelfCreatedForRootWindow(root_window);
|
| +}
|
| +
|
| +void Shell::NotifyShelfAlignmentChanged(WmWindow* root_window) {
|
| + for (auto& observer : shell_observers_)
|
| + observer.OnShelfAlignmentChanged(root_window);
|
| +}
|
| +
|
| +void Shell::NotifyShelfAutoHideBehaviorChanged(WmWindow* root_window) {
|
| + for (auto& observer : shell_observers_)
|
| + observer.OnShelfAutoHideBehaviorChanged(root_window);
|
| +}
|
| +
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // Shell, private:
|
|
|
| @@ -565,7 +630,7 @@ Shell::~Shell() {
|
| display_configurator_->RemoveObserver(display_error_observer_.get());
|
| if (projecting_observer_) {
|
| display_configurator_->RemoveObserver(projecting_observer_.get());
|
| - wm_shell_->RemoveShellObserver(projecting_observer_.get());
|
| + RemoveShellObserver(projecting_observer_.get());
|
| }
|
| display_change_observer_.reset();
|
| shutdown_observer_.reset();
|
| @@ -629,7 +694,7 @@ void Shell::Init(const ShellInitParams& init_params) {
|
| projecting_observer_.reset(
|
| new ProjectingObserver(dbus_thread_manager->GetPowerManagerClient()));
|
| display_configurator_->AddObserver(projecting_observer_.get());
|
| - wm_shell_->AddShellObserver(projecting_observer_.get());
|
| + AddShellObserver(projecting_observer_.get());
|
|
|
| if (!display_initialized && chromeos::IsRunningAsSystemCompositor()) {
|
| display_change_observer_ = base::MakeUnique<display::DisplayChangeObserver>(
|
| @@ -726,7 +791,7 @@ void Shell::Init(const ShellInitParams& init_params) {
|
|
|
| overlay_filter_.reset(new OverlayEventFilter);
|
| AddPreTargetHandler(overlay_filter_.get());
|
| - wm_shell_->AddShellObserver(overlay_filter_.get());
|
| + AddShellObserver(overlay_filter_.get());
|
|
|
| accelerator_filter_.reset(new ::wm::AcceleratorFilter(
|
| std::unique_ptr<::wm::AcceleratorDelegate>(new AcceleratorDelegate),
|
| @@ -758,7 +823,7 @@ void Shell::Init(const ShellInitParams& init_params) {
|
| power_button_controller_->OnDisplayModeChanged(
|
| display_configurator_->cached_displays());
|
|
|
| - wm_shell_->AddShellObserver(lock_state_controller_.get());
|
| + AddShellObserver(lock_state_controller_.get());
|
|
|
| // The connector is unavailable in some tests.
|
| if (is_mash && wm_shell_->delegate()->GetShellConnector()) {
|
| @@ -867,7 +932,7 @@ void Shell::Init(const ShellInitParams& init_params) {
|
| if (!is_mash)
|
| display_manager_->CreateMirrorWindowAsyncIfAny();
|
|
|
| - for (auto& observer : *wm_shell_->shell_observers())
|
| + for (auto& observer : shell_observers_)
|
| observer.OnShellInitialized();
|
|
|
| if (!is_mash)
|
|
|