Chromium Code Reviews| Index: ash/shell.cc | 
| diff --git a/ash/shell.cc b/ash/shell.cc | 
| index c12b790bc3bec3a4db87f3b6667ff067f839f259..40dab9f71b1d576e1b098f47ed7d2b3e147271f8 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" | 
| 
 
xiyuan
2017/06/06 16:50:19
unused?
 
newcomer
2017/06/06 17:12:56
Done.
 
 | 
| #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" | 
| 
 
xiyuan
2017/06/06 16:50:19
unused?
 
newcomer
2017/06/06 17:12:56
Done.
 
 | 
| #include "ui/app_list/presenter/app_list.h" | 
| +#include "ui/app_list/presenter/app_list_delegate.h" | 
| 
 
xiyuan
2017/06/06 16:50:18
remove since it is included in h already.
 
newcomer
2017/06/06 17:12:56
Done.
 
 | 
| #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::NotifyAppListVisibilityChanged(bool shown, | 
| + aura::Window* root_window) { | 
| + for (auto& observer : shell_observers_) | 
| + observer.OnAppListVisibilityChanged(shown, root_window); | 
| +} | 
| + | 
| void Shell::NotifyMaximizeModeStarted() { | 
| for (auto& observer : shell_observers_) | 
| observer.OnMaximizeModeStarted(); | 
| @@ -596,6 +604,7 @@ Shell::Shell(std::unique_ptr<ShellDelegate> shell_delegate, | 
| window_tree_host_manager_.reset(new WindowTreeHostManager); | 
| user_metrics_recorder_.reset(new UserMetricsRecorder); | 
| } | 
| + app_list()->set_delegate(this); | 
| PowerStatus::Initialize(); | 
| @@ -610,6 +619,8 @@ Shell::~Shell() { | 
| if (config != Config::MASH) | 
| user_metrics_recorder_->OnShellShuttingDown(); | 
| + app_list()->set_delegate(nullptr); | 
| + | 
| shell_delegate_->PreShutdown(); | 
| // Remove the focus from any window. This will prevent overhead and side | 
| @@ -726,9 +737,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 +844,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 +1223,11 @@ void Shell::OnWindowActivated( | 
| root_window_for_new_windows_ = gained_active->GetRootWindow(); | 
| } | 
| +void Shell::OnAppListVisibilityChanged(bool visible, int64_t display_id) { | 
| + NotifyAppListVisibilityChanged( | 
| + visible, 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). |