Chromium Code Reviews| Index: ash/shell.cc |
| diff --git a/ash/shell.cc b/ash/shell.cc |
| index c12b790bc3bec3a4db87f3b6667ff067f839f259..62c67b7713c05979b6f1e98743dad30930cd0387 100644 |
| --- a/ash/shell.cc |
| +++ b/ash/shell.cc |
| @@ -14,7 +14,6 @@ |
| #include "ash/accelerators/magnifier_key_scroller.h" |
| #include "ash/accelerators/spoken_feedback_toggler.h" |
| #include "ash/accessibility_delegate.h" |
| -#include "ash/app_list/app_list_delegate_impl.h" |
| #include "ash/ash_constants.h" |
| #include "ash/ash_switches.h" |
| #include "ash/aura/shell_port_classic.h" |
| @@ -54,6 +53,7 @@ |
| #include "ash/public/cpp/shell_window_ids.h" |
| #include "ash/root_window_controller.h" |
| #include "ash/session/session_controller.h" |
| +#include "ash/shelf/app_list_button.h" |
| #include "ash/shelf/shelf.h" |
| #include "ash/shelf/shelf_controller.h" |
| #include "ash/shelf/shelf_model.h" |
| @@ -136,7 +136,9 @@ |
| #include "services/preferences/public/interfaces/preferences.mojom.h" |
| #include "services/service_manager/public/cpp/connector.h" |
| #include "services/ui/public/interfaces/constants.mojom.h" |
| +#include "ui/app_list/app_list_features.h" |
| #include "ui/app_list/presenter/app_list.h" |
| +#include "ui/app_list/presenter/app_list_delegate.h" |
| #include "ui/aura/client/aura_constants.h" |
| #include "ui/aura/env.h" |
| #include "ui/aura/layout_manager.h" |
| @@ -486,6 +488,12 @@ void Shell::UpdateAfterLoginStatusChange(LoginStatus status) { |
| } |
| } |
| +void Shell::NotifyAppListShownOrDismissed(bool shown, |
| + aura::Window* root_window) { |
| + for (auto& observer : shell_observers_) |
| + observer.OnAppListShownOrDismissed(shown, root_window); |
| +} |
| + |
| void Shell::NotifyMaximizeModeStarted() { |
| for (auto& observer : shell_observers_) |
| observer.OnMaximizeModeStarted(); |
| @@ -595,6 +603,8 @@ Shell::Shell(std::unique_ptr<ShellDelegate> shell_delegate, |
| display_manager_.reset(ScreenAsh::CreateDisplayManager()); |
| window_tree_host_manager_.reset(new WindowTreeHostManager); |
| user_metrics_recorder_.reset(new UserMetricsRecorder); |
| + } else { |
| + app_list()->set_delegate(this); |
|
xiyuan
2017/06/06 15:51:04
If we unify the app list visibility change notific
newcomer
2017/06/06 16:42:29
Done.
|
| } |
| PowerStatus::Initialize(); |
| @@ -609,6 +619,8 @@ Shell::~Shell() { |
| if (config != Config::MASH) |
| user_metrics_recorder_->OnShellShuttingDown(); |
| + else |
| + app_list()->set_delegate(nullptr); |
| shell_delegate_->PreShutdown(); |
| @@ -726,9 +738,6 @@ Shell::~Shell() { |
| ScreenAsh::CreateScreenForShutdown(); |
| display_configuration_controller_.reset(); |
| - // AppListDelegateImpl depends upon AppList. |
| - app_list_delegate_impl_.reset(); |
| - |
| // These members access Shell in their destructors. |
| wallpaper_controller_.reset(); |
| accessibility_delegate_.reset(); |
| @@ -836,9 +845,6 @@ void Shell::Init(const ShellInitParams& init_params) { |
| devtools_server_->AttachClient(std::move(devtools_client)); |
| } |
| - if (config == Config::MASH) |
| - app_list_delegate_impl_ = base::MakeUnique<AppListDelegateImpl>(); |
| - |
| // TODO(sky): move creation to ShellPort. |
| if (config != Config::MASH) |
| immersive_handler_factory_ = base::MakeUnique<ImmersiveHandlerFactoryAsh>(); |
| @@ -1218,6 +1224,12 @@ void Shell::OnWindowActivated( |
| root_window_for_new_windows_ = gained_active->GetRootWindow(); |
| } |
| +void Shell::OnAppListVisibilityChanged(bool visible, int64_t display_id) { |
| + NotifyAppListShownOrDismissed(visible, |
|
xiyuan
2017/06/06 15:51:04
NotifyAppListShownOrDismissed -> NotifyAppListVisi
newcomer
2017/06/06 16:42:29
Done.
|
| + ShellPort::Get()-> |
| + GetRootWindowForDisplayId(display_id)); |
| +} |
| + |
| void Shell::OnSessionStateChanged(session_manager::SessionState state) { |
| // Initialize the shelf when a session becomes active. It's safe to do this |
| // multiple times (e.g. initial login vs. multiprofile add session). |