mash: Migrate ShellDelegate ownership and access to WmShell.

Move ownership of ShellDelegate to WMShell (was in Shell).
(pass via WmShell[Aura|Mus] constructors, create earlier)

TODO: Port and use ShellDelegateMus in ash::mus::WindowManager::Init?
TODO: Move VirtualKeyboardStateObserver out of shell_delegate.h

BUG=619636
TEST=Compiles; unit tests; no behavior changes.
[email protected]
[email protected],[email protected]

Review-Url: https://codereview.chromium.org/2118593002
Cr-Commit-Position: refs/heads/master@{#403964}
diff --git a/ash/accelerators/accelerator_commands.cc b/ash/accelerators/accelerator_commands.cc
index bca8d16..b804d91 100644
--- a/ash/accelerators/accelerator_commands.cc
+++ b/ash/accelerators/accelerator_commands.cc
@@ -12,7 +12,6 @@
 #include "ash/display/display_manager.h"
 #include "ash/display/display_util.h"
 #include "ash/shell.h"
-#include "ash/shell_delegate.h"
 #include "ash/wm/screen_pinning_controller.h"
 #include "ash/wm/window_state_aura.h"
 #include "ash/wm/window_util.h"
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc
index c90b71777..3e5e6c10371 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -18,6 +18,7 @@
 #include "ash/common/media_delegate.h"
 #include "ash/common/session/session_state_delegate.h"
 #include "ash/common/shelf/shelf_model.h"
+#include "ash/common/shell_delegate.h"
 #include "ash/common/shell_window_ids.h"
 #include "ash/common/system/system_notifier.h"
 #include "ash/common/system/tray/system_tray_delegate.h"
@@ -47,7 +48,6 @@
 #include "ash/shelf/shelf_delegate.h"
 #include "ash/shelf/shelf_widget.h"
 #include "ash/shell.h"
-#include "ash/shell_delegate.h"
 #include "ash/system/brightness_control_delegate.h"
 #include "ash/system/keyboard_brightness/keyboard_brightness_control_delegate.h"
 #include "ash/system/status_area_widget.h"
@@ -106,7 +106,7 @@
 
   void Click() override {
     if (!WmShell::Get()->GetSessionStateDelegate()->IsUserSessionBlocked())
-      Shell::GetInstance()->delegate()->OpenKeyboardShortcutHelpPage();
+      WmShell::Get()->delegate()->OpenKeyboardShortcutHelpPage();
   }
 
  private:
@@ -171,7 +171,7 @@
       new message_center::Notification(
           message_center::NOTIFICATION_TYPE_SIMPLE, notification_id,
           base::string16(), message,
-          Shell::GetInstance()->delegate()->GetDeprecatedAcceleratorImage(),
+          WmShell::Get()->delegate()->GetDeprecatedAcceleratorImage(),
           base::string16(), GURL(),
           message_center::NotifierId(
               message_center::NotifierId::SYSTEM_COMPONENT,
@@ -277,7 +277,7 @@
 }
 
 bool CanHandleNewIncognitoWindow() {
-  return Shell::GetInstance()->delegate()->IsIncognitoAllowed();
+  return WmShell::Get()->delegate()->IsIncognitoAllowed();
 }
 
 void HandleNewIncognitoWindow() {
@@ -639,8 +639,7 @@
 }
 
 bool CanHandleCycleUser() {
-  Shell* shell = Shell::GetInstance();
-  return shell->delegate()->IsMultiProfilesEnabled() &&
+  return WmShell::Get()->delegate()->IsMultiProfilesEnabled() &&
          WmShell::Get()->GetSessionStateDelegate()->NumberOfLoggedInUsers() > 1;
 }
 
@@ -1404,7 +1403,6 @@
           actions_allowed_in_pinned_mode_.end()) {
     return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION;
   }
-  Shell* shell = Shell::GetInstance();
   WmShell* wm_shell = WmShell::Get();
   if (!wm_shell->GetSessionStateDelegate()->IsActiveUserSessionStarted() &&
       actions_allowed_at_login_screen_.find(action) ==
@@ -1416,7 +1414,7 @@
           actions_allowed_at_lock_screen_.end()) {
     return RESTRICTION_PREVENT_PROCESSING;
   }
-  if (shell->delegate()->IsRunningInForcedAppMode() &&
+  if (wm_shell->delegate()->IsRunningInForcedAppMode() &&
       actions_allowed_in_app_mode_.find(action) ==
           actions_allowed_in_app_mode_.end()) {
     return RESTRICTION_PREVENT_PROCESSING;
diff --git a/ash/accelerators/debug_commands.cc b/ash/accelerators/debug_commands.cc
index 541d128..cd3d46d1 100644
--- a/ash/accelerators/debug_commands.cc
+++ b/ash/accelerators/debug_commands.cc
@@ -6,6 +6,7 @@
 
 #include "ash/accelerators/accelerator_commands.h"
 #include "ash/common/ash_switches.h"
+#include "ash/common/shell_delegate.h"
 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
 #include "ash/common/wm_shell.h"
 #include "ash/debug.h"
@@ -15,7 +16,6 @@
 #include "ash/host/ash_window_tree_host.h"
 #include "ash/root_window_controller.h"
 #include "ash/shell.h"
-#include "ash/shell_delegate.h"
 #include "ash/system/toast/toast_data.h"
 #include "ash/system/toast/toast_manager.h"
 #include "ash/wm/window_util.h"
@@ -134,14 +134,12 @@
 
 void HandleToggleTouchpad() {
   base::RecordAction(base::UserMetricsAction("Accel_Toggle_Touchpad"));
-
-  ash::Shell::GetInstance()->delegate()->ToggleTouchpad();
+  ash::WmShell::Get()->delegate()->ToggleTouchpad();
 }
 
 void HandleToggleTouchscreen() {
   base::RecordAction(base::UserMetricsAction("Accel_Toggle_Touchscreen"));
-
-  ash::Shell::GetInstance()->delegate()->ToggleTouchscreen();
+  ash::WmShell::Get()->delegate()->ToggleTouchscreen();
 }
 
 void HandleToggleToggleTouchView() {
diff --git a/ash/accelerators/exit_warning_handler.cc b/ash/accelerators/exit_warning_handler.cc
index 82e6d0cb..2b08f20 100644
--- a/ash/accelerators/exit_warning_handler.cc
+++ b/ash/accelerators/exit_warning_handler.cc
@@ -4,10 +4,10 @@
 
 #include "ash/accelerators/exit_warning_handler.h"
 
+#include "ash/common/shell_delegate.h"
 #include "ash/common/shell_window_ids.h"
 #include "ash/common/wm_shell.h"
 #include "ash/shell.h"
-#include "ash/shell_delegate.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/time/time.h"
 #include "base/timer/timer.h"
@@ -106,7 +106,6 @@
 }
 
 void ExitWarningHandler::HandleAccelerator() {
-  ShellDelegate* shell_delegate = Shell::GetInstance()->delegate();
   switch (state_) {
     case IDLE:
       state_ = WAIT_FOR_DOUBLE_PRESS;
@@ -119,7 +118,7 @@
       CancelTimer();
       Hide();
       WmShell::Get()->RecordUserMetricsAction(UMA_ACCEL_EXIT_SECOND_Q);
-      shell_delegate->Exit();
+      WmShell::Get()->delegate()->Exit();
       break;
     case EXITING:
       break;
diff --git a/ash/app_list/app_list_presenter_delegate.cc b/ash/app_list/app_list_presenter_delegate.cc
index 4852740..51cac279 100644
--- a/ash/app_list/app_list_presenter_delegate.cc
+++ b/ash/app_list/app_list_presenter_delegate.cc
@@ -16,7 +16,6 @@
 #include "ash/shelf/shelf.h"
 #include "ash/shelf/shelf_layout_manager.h"
 #include "ash/shell.h"
-#include "ash/shell_delegate.h"
 #include "base/command_line.h"
 #include "ui/app_list/app_list_constants.h"
 #include "ui/app_list/app_list_switches.h"
diff --git a/ash/ash.gyp b/ash/ash.gyp
index a0f7838..41e08610 100644
--- a/ash/ash.gyp
+++ b/ash/ash.gyp
@@ -100,6 +100,7 @@
       'common/shelf/wm_shelf_observer.h',
       'common/shelf/wm_shelf_util.cc',
       'common/shelf/wm_shelf_util.h',
+      'common/shell_delegate.h',
       'common/shell_window_ids.cc',
       'common/shell_window_ids.h',
       'common/system/accessibility_observer.h',
@@ -595,7 +596,6 @@
       'shelf/shelf_window_watcher_item_delegate.h',
       'shell.cc',
       'shell.h',
-      'shell_delegate.h',
       'shell_factory.h',
       'shell_init_params.cc',
       'shell_init_params.h',
diff --git a/ash/aura/wm_shell_aura.cc b/ash/aura/wm_shell_aura.cc
index 90a6d84..19871636 100644
--- a/ash/aura/wm_shell_aura.cc
+++ b/ash/aura/wm_shell_aura.cc
@@ -6,6 +6,7 @@
 
 #include "ash/aura/wm_window_aura.h"
 #include "ash/common/session/session_state_delegate.h"
+#include "ash/common/shell_delegate.h"
 #include "ash/common/shell_observer.h"
 #include "ash/common/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard.h"
 #include "ash/common/wm/mru_window_tracker.h"
@@ -15,7 +16,6 @@
 #include "ash/display/display_manager.h"
 #include "ash/display/window_tree_host_manager.h"
 #include "ash/shell.h"
-#include "ash/shell_delegate.h"
 #include "ash/wm/drag_window_resizer.h"
 #include "ash/wm/maximize_mode/maximize_mode_event_handler_aura.h"
 #include "ash/wm/screen_pinning_controller.h"
@@ -38,7 +38,7 @@
 
 namespace ash {
 
-WmShellAura::WmShellAura() {
+WmShellAura::WmShellAura(ShellDelegate* delegate) : WmShell(delegate) {
   WmShell::Set(this);
 }
 
@@ -93,7 +93,7 @@
 }
 
 bool WmShellAura::IsForceMaximizeOnFirstRun() {
-  return Shell::GetInstance()->delegate()->IsForceMaximizeOnFirstRun();
+  return delegate()->IsForceMaximizeOnFirstRun();
 }
 
 bool WmShellAura::IsPinned() {
@@ -106,7 +106,7 @@
 }
 
 bool WmShellAura::CanShowWindowForUser(WmWindow* window) {
-  return Shell::GetInstance()->delegate()->CanShowWindowForUser(window);
+  return delegate()->CanShowWindowForUser(window);
 }
 
 void WmShellAura::LockCursor() {
diff --git a/ash/aura/wm_shell_aura.h b/ash/aura/wm_shell_aura.h
index 3c227206..228f39a 100644
--- a/ash/aura/wm_shell_aura.h
+++ b/ash/aura/wm_shell_aura.h
@@ -19,7 +19,7 @@
                                public aura::client::ActivationChangeObserver,
                                public WindowTreeHostManager::Observer {
  public:
-  WmShellAura();
+  explicit WmShellAura(ShellDelegate* delegate);
   ~WmShellAura() override;
 
   static WmShellAura* Get();
diff --git a/ash/shell_delegate.h b/ash/common/shell_delegate.h
similarity index 97%
rename from ash/shell_delegate.h
rename to ash/common/shell_delegate.h
index b8da2d51..bf4d000 100644
--- a/ash/shell_delegate.h
+++ b/ash/common/shell_delegate.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef ASH_SHELL_DELEGATE_H_
-#define ASH_SHELL_DELEGATE_H_
+#ifndef ASH_COMMON_SHELL_DELEGATE_H_
+#define ASH_COMMON_SHELL_DELEGATE_H_
 
 #include <memory>
 #include <string>
@@ -166,4 +166,4 @@
 
 }  // namespace ash
 
-#endif  // ASH_SHELL_DELEGATE_H_
+#endif  // ASH_COMMON_SHELL_DELEGATE_H_
diff --git a/ash/common/wm_shell.cc b/ash/common/wm_shell.cc
index bab48cce..8561358 100644
--- a/ash/common/wm_shell.cc
+++ b/ash/common/wm_shell.cc
@@ -6,6 +6,7 @@
 
 #include "ash/common/focus_cycler.h"
 #include "ash/common/keyboard/keyboard_ui.h"
+#include "ash/common/shell_delegate.h"
 #include "ash/common/shell_window_ids.h"
 #include "ash/common/system/chromeos/session/logout_confirmation_controller.h"
 #include "ash/common/system/tray/system_tray_delegate.h"
@@ -53,8 +54,9 @@
   shell_observers_.RemoveObserver(observer);
 }
 
-WmShell::WmShell()
-    : focus_cycler_(new FocusCycler),
+WmShell::WmShell(ShellDelegate* delegate)
+    : delegate_(delegate),
+      focus_cycler_(new FocusCycler),
       system_tray_notifier_(new SystemTrayNotifier),
       window_selector_controller_(new WindowSelectorController()) {}
 
diff --git a/ash/common/wm_shell.h b/ash/common/wm_shell.h
index aa97f46c..aa303687 100644
--- a/ash/common/wm_shell.h
+++ b/ash/common/wm_shell.h
@@ -33,6 +33,7 @@
 class MruWindowTracker;
 class ScopedDisableInternalMouseAndKeyboard;
 class SessionStateDelegate;
+class ShellDelegate;
 class ShellObserver;
 class SystemTrayDelegate;
 class SystemTrayNotifier;
@@ -61,6 +62,8 @@
   static WmShell* Get();
   static bool HasInstance() { return instance_ != nullptr; }
 
+  ShellDelegate* delegate() { return delegate_.get(); }
+
   FocusCycler* focus_cycler() { return focus_cycler_.get(); }
 
   KeyboardUI* keyboard_ui() { return keyboard_ui_.get(); }
@@ -207,7 +210,7 @@
 #endif
 
  protected:
-  WmShell();
+  explicit WmShell(ShellDelegate* delegate);
   virtual ~WmShell();
 
   base::ObserverList<ShellObserver>* shell_observers() {
@@ -236,7 +239,7 @@
   static WmShell* instance_;
 
   base::ObserverList<ShellObserver> shell_observers_;
-
+  std::unique_ptr<ShellDelegate> delegate_;
   std::unique_ptr<FocusCycler> focus_cycler_;
   std::unique_ptr<KeyboardUI> keyboard_ui_;
   std::unique_ptr<MaximizeModeController> maximize_mode_controller_;
diff --git a/ash/content/keyboard_overlay/keyboard_overlay_view_unittest.cc b/ash/content/keyboard_overlay/keyboard_overlay_view_unittest.cc
index 4e129e8..c4e4173 100644
--- a/ash/content/keyboard_overlay/keyboard_overlay_view_unittest.cc
+++ b/ash/content/keyboard_overlay/keyboard_overlay_view_unittest.cc
@@ -9,8 +9,6 @@
 #include "ash/accelerators/accelerator_table.h"
 #include "ash/content/keyboard_overlay/keyboard_overlay_delegate.h"
 #include "ash/content/shell_content_state.h"
-#include "ash/shell.h"
-#include "ash/shell_delegate.h"
 #include "ash/test/ash_test_base.h"
 #include "ui/web_dialogs/test/test_web_contents_handler.h"
 #include "ui/web_dialogs/test/test_web_dialog_delegate.h"
diff --git a/ash/display/window_tree_host_manager.cc b/ash/display/window_tree_host_manager.cc
index 966a33b..233045a 100644
--- a/ash/display/window_tree_host_manager.cc
+++ b/ash/display/window_tree_host_manager.cc
@@ -26,7 +26,6 @@
 #include "ash/root_window_settings.h"
 #include "ash/screen_util.h"
 #include "ash/shell.h"
-#include "ash/shell_delegate.h"
 #include "ash/system/tray/system_tray.h"
 #include "ash/wm/window_util.h"
 #include "base/command_line.h"
diff --git a/ash/mus/bridge/wm_shell_mus.cc b/ash/mus/bridge/wm_shell_mus.cc
index 0ca14db..6c42ca3 100644
--- a/ash/mus/bridge/wm_shell_mus.cc
+++ b/ash/mus/bridge/wm_shell_mus.cc
@@ -92,8 +92,10 @@
 
 }  // namespace
 
-WmShellMus::WmShellMus(::ui::WindowTreeClient* client)
-    : client_(client), session_state_delegate_(new SessionStateDelegateStub) {
+WmShellMus::WmShellMus(ShellDelegate* delegate, ::ui::WindowTreeClient* client)
+    : WmShell(delegate),
+      client_(client),
+      session_state_delegate_(new SessionStateDelegateStub) {
   client_->AddObserver(this);
   WmShell::Set(this);
 
diff --git a/ash/mus/bridge/wm_shell_mus.h b/ash/mus/bridge/wm_shell_mus.h
index 17ad9fb..4ad4d41 100644
--- a/ash/mus/bridge/wm_shell_mus.h
+++ b/ash/mus/bridge/wm_shell_mus.h
@@ -27,7 +27,7 @@
 // WmShell implementation for mus.
 class WmShellMus : public WmShell, public ::ui::WindowTreeClientObserver {
  public:
-  explicit WmShellMus(::ui::WindowTreeClient* client);
+  WmShellMus(ShellDelegate* delegate, ::ui::WindowTreeClient* client);
   ~WmShellMus() override;
 
   static WmShellMus* Get();
diff --git a/ash/mus/window_manager.cc b/ash/mus/window_manager.cc
index 3f11af2..880422b5 100644
--- a/ash/mus/window_manager.cc
+++ b/ash/mus/window_manager.cc
@@ -68,7 +68,8 @@
   window_manager_client_->SetFrameDecorationValues(
       std::move(frame_decoration_values));
 
-  shell_.reset(new WmShellMus(window_tree_client_));
+  // TODO(msw): Provide a valid ShellDelegate here; maybe port ShellDelegateMus?
+  shell_.reset(new WmShellMus(nullptr, window_tree_client_));
   lookup_.reset(new WmLookupMus);
 }
 
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc
index d167f83..1ab4e46e 100644
--- a/ash/root_window_controller.cc
+++ b/ash/root_window_controller.cc
@@ -17,6 +17,7 @@
 #include "ash/common/root_window_controller_common.h"
 #include "ash/common/session/session_state_delegate.h"
 #include "ash/common/shelf/shelf_types.h"
+#include "ash/common/shell_delegate.h"
 #include "ash/common/shell_window_ids.h"
 #include "ash/common/system/tray/system_tray_delegate.h"
 #include "ash/common/wm/always_on_top_controller.h"
@@ -41,7 +42,6 @@
 #include "ash/shelf/shelf_layout_manager.h"
 #include "ash/shelf/shelf_widget.h"
 #include "ash/shell.h"
-#include "ash/shell_delegate.h"
 #include "ash/shell_factory.h"
 #include "ash/system/status_area_widget.h"
 #include "ash/touch/touch_hud_debug.h"
@@ -314,7 +314,7 @@
 void RootWindowController::CreateForPrimaryDisplay(AshWindowTreeHost* host) {
   RootWindowController* controller = new RootWindowController(host);
   controller->Init(RootWindowController::PRIMARY,
-                   Shell::GetInstance()->delegate()->IsFirstRunAfterBoot());
+                   WmShell::Get()->delegate()->IsFirstRunAfterBoot());
 }
 
 void RootWindowController::CreateForSecondaryDisplay(AshWindowTreeHost* host) {
@@ -657,7 +657,7 @@
 
 void RootWindowController::ShowContextMenu(const gfx::Point& location_in_screen,
                                            ui::MenuSourceType source_type) {
-  ShellDelegate* delegate = Shell::GetInstance()->delegate();
+  ShellDelegate* delegate = WmShell::Get()->delegate();
   DCHECK(delegate);
   menu_model_.reset(delegate->CreateContextMenu(wm_shelf_aura_.get(), nullptr));
   if (!menu_model_)
@@ -703,7 +703,7 @@
   keyboard_controller->AddObserver(workspace_controller_->layout_manager());
   keyboard_controller->AddObserver(
       always_on_top_controller_->GetLayoutManager());
-  Shell::GetInstance()->delegate()->VirtualKeyboardActivated(true);
+  WmShell::Get()->delegate()->VirtualKeyboardActivated(true);
   aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer);
   DCHECK(parent);
   aura::Window* keyboard_container = keyboard_controller->GetContainerWindow();
@@ -733,7 +733,7 @@
         workspace_controller_->layout_manager());
     keyboard_controller->RemoveObserver(
         always_on_top_controller_->GetLayoutManager());
-    Shell::GetInstance()->delegate()->VirtualKeyboardActivated(false);
+    WmShell::Get()->delegate()->VirtualKeyboardActivated(false);
   }
 }
 
diff --git a/ash/shelf/shelf.cc b/ash/shelf/shelf.cc
index 2176db2..0392685c2 100644
--- a/ash/shelf/shelf.cc
+++ b/ash/shelf/shelf.cc
@@ -21,7 +21,6 @@
 #include "ash/shelf/shelf_util.h"
 #include "ash/shelf/shelf_view.h"
 #include "ash/shell.h"
-#include "ash/shell_delegate.h"
 #include "ash/wm/window_properties.h"
 #include "ui/aura/window.h"
 #include "ui/aura/window_event_dispatcher.h"
diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc
index 634bb69..964a8b69 100644
--- a/ash/shelf/shelf_view.cc
+++ b/ash/shelf/shelf_view.cc
@@ -14,6 +14,7 @@
 #include "ash/common/shelf/shelf_item_delegate_manager.h"
 #include "ash/common/shelf/shelf_menu_model.h"
 #include "ash/common/shelf/shelf_model.h"
+#include "ash/common/shell_delegate.h"
 #include "ash/common/wm/root_window_finder.h"
 #include "ash/common/wm_shell.h"
 #include "ash/drag_drop/drag_image_view.h"
@@ -28,7 +29,6 @@
 #include "ash/shelf/shelf_icon_observer.h"
 #include "ash/shelf/shelf_widget.h"
 #include "ash/shell.h"
-#include "ash/shell_delegate.h"
 #include "base/auto_reset.h"
 #include "base/metrics/histogram.h"
 #include "grit/ash_strings.h"
@@ -1794,7 +1794,7 @@
   }
 
   std::unique_ptr<ui::MenuModel> context_menu_model(
-      Shell::GetInstance()->delegate()->CreateContextMenu(wm_shelf_, item));
+      WmShell::Get()->delegate()->CreateContextMenu(wm_shelf_, item));
   if (!context_menu_model)
     return;
 
diff --git a/ash/shell.cc b/ash/shell.cc
index 6e2f60e1..3183c7ad 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -22,6 +22,7 @@
 #include "ash/common/shelf/shelf_item_delegate.h"
 #include "ash/common/shelf/shelf_item_delegate_manager.h"
 #include "ash/common/shelf/shelf_model.h"
+#include "ash/common/shell_delegate.h"
 #include "ash/common/shell_window_ids.h"
 #include "ash/common/system/locale/locale_notification_controller.h"
 #include "ash/common/system/tray/system_tray_delegate.h"
@@ -59,7 +60,6 @@
 #include "ash/shelf/shelf_delegate.h"
 #include "ash/shelf/shelf_widget.h"
 #include "ash/shelf/shelf_window_watcher.h"
-#include "ash/shell_delegate.h"
 #include "ash/shell_factory.h"
 #include "ash/shell_init_params.h"
 #include "ash/system/status_area_widget.h"
@@ -320,25 +320,26 @@
 
 void Shell::ShowAppList(aura::Window* window) {
   // If the context window is not given, show it on the target root window.
-  delegate_->GetAppListPresenter()->Show(GetDisplayIdForWindow(window));
+  wm_shell_->delegate()->GetAppListPresenter()->Show(
+      GetDisplayIdForWindow(window));
 }
 
 void Shell::DismissAppList() {
-  delegate_->GetAppListPresenter()->Dismiss();
+  wm_shell_->delegate()->GetAppListPresenter()->Dismiss();
 }
 
 void Shell::ToggleAppList(aura::Window* window) {
   // If the context window is not given, show it on the target root window.
-  delegate_->GetAppListPresenter()->ToggleAppList(
+  wm_shell_->delegate()->GetAppListPresenter()->ToggleAppList(
       GetDisplayIdForWindow(window));
 }
 
 bool Shell::IsApplistVisible() const {
-  return delegate_->GetAppListPresenter()->IsVisible();
+  return wm_shell_->delegate()->GetAppListPresenter()->IsVisible();
 }
 
 bool Shell::GetAppListTargetVisibility() const {
-  return delegate_->GetAppListPresenter()->GetTargetVisibility();
+  return wm_shell_->delegate()->GetAppListPresenter()->GetTargetVisibility();
 }
 
 views::NonClientFrameView* Shell::CreateDefaultNonClientFrameView(
@@ -551,7 +552,8 @@
     shelf_item_delegate_manager_.reset(
         new ShelfItemDelegateManager(shelf_model_.get()));
 
-    shelf_delegate_.reset(delegate_->CreateShelfDelegate(shelf_model_.get()));
+    shelf_delegate_.reset(
+        wm_shell_->delegate()->CreateShelfDelegate(shelf_model_.get()));
     std::unique_ptr<ShelfItemDelegate> controller(new AppListShelfItemDelegate);
 
     // Finding the shelf model's location of the app list and setting its
@@ -599,9 +601,9 @@
 // Shell, private:
 
 Shell::Shell(ShellDelegate* delegate, base::SequencedWorkerPool* blocking_pool)
-    : target_root_window_(nullptr),
+    : wm_shell_(new WmShellAura(delegate)),
+      target_root_window_(nullptr),
       scoped_target_root_window_(nullptr),
-      delegate_(delegate),
       shelf_model_(new ShelfModel),
       link_handler_model_factory_(nullptr),
       activation_client_(nullptr),
@@ -612,9 +614,8 @@
       simulate_modal_window_open_for_testing_(false),
       is_touch_hud_projection_enabled_(false),
       blocking_pool_(blocking_pool) {
-  DCHECK(delegate_.get());
   DCHECK(aura::Env::GetInstanceDontCreate());
-  gpu_support_.reset(delegate_->CreateGPUSupport());
+  gpu_support_.reset(wm_shell_->delegate()->CreateGPUSupport());
   display_manager_.reset(new DisplayManager);
   window_tree_host_manager_.reset(new WindowTreeHostManager);
   user_metrics_recorder_.reset(new UserMetricsRecorder);
@@ -629,7 +630,7 @@
 
   user_metrics_recorder_->OnShellShuttingDown();
 
-  delegate_->PreShutdown();
+  wm_shell_->delegate()->PreShutdown();
 
   views::FocusManagerFactory::Install(nullptr);
 
@@ -812,7 +813,6 @@
   DCHECK(in_mus_) << "linux desktop does not support ash.";
 #endif
 
-  wm_shell_.reset(new WmShellAura);
   scoped_overview_animation_settings_factory_.reset(
       new ScopedOverviewAnimationSettingsFactoryAura);
   window_positioner_.reset(new WindowPositioner(wm_shell_.get()));
@@ -828,7 +828,7 @@
 #endif
   }
 
-  delegate_->PreInit();
+  wm_shell_->delegate()->PreInit();
   bool display_initialized = display_manager_->InitFromCommandLine();
 
   display_configuration_controller_.reset(new DisplayConfigurationController(
@@ -870,7 +870,7 @@
     display_configurator_->set_state_controller(display_change_observer_.get());
     display_configurator_->set_mirroring_controller(display_manager_.get());
     display_configurator_->ForceInitialConfigure(
-        delegate_->IsFirstRunAfterBoot() ? kChromeOsBootColor : 0);
+        wm_shell_->delegate()->IsFirstRunAfterBoot() ? kChromeOsBootColor : 0);
     display_initialized = true;
   }
   display_color_manager_.reset(
@@ -1010,20 +1010,24 @@
   // This controller needs to be set before SetupManagedWindowMode.
   desktop_background_controller_.reset(
       new DesktopBackgroundController(blocking_pool_));
-  user_wallpaper_delegate_.reset(delegate_->CreateUserWallpaperDelegate());
+  user_wallpaper_delegate_.reset(
+      wm_shell_->delegate()->CreateUserWallpaperDelegate());
 
-  session_state_delegate_.reset(delegate_->CreateSessionStateDelegate());
-  accessibility_delegate_.reset(delegate_->CreateAccessibilityDelegate());
-  new_window_delegate_.reset(delegate_->CreateNewWindowDelegate());
+  session_state_delegate_.reset(
+      wm_shell_->delegate()->CreateSessionStateDelegate());
+  accessibility_delegate_.reset(
+      wm_shell_->delegate()->CreateAccessibilityDelegate());
+  new_window_delegate_.reset(wm_shell_->delegate()->CreateNewWindowDelegate());
   wm_shell_->SetMediaDelegate(
-      base::WrapUnique(delegate_->CreateMediaDelegate()));
-  pointer_watcher_delegate_ = delegate_->CreatePointerWatcherDelegate();
+      base::WrapUnique(wm_shell_->delegate()->CreateMediaDelegate()));
+  pointer_watcher_delegate_ =
+      wm_shell_->delegate()->CreatePointerWatcherDelegate();
 
   resize_shadow_controller_.reset(new ResizeShadowController());
   shadow_controller_.reset(new ::wm::ShadowController(activation_client_));
 
   wm_shell_->SetSystemTrayDelegate(
-      base::WrapUnique(delegate()->CreateSystemTrayDelegate()));
+      base::WrapUnique(wm_shell_->delegate()->CreateSystemTrayDelegate()));
 
   locale_notification_controller_.reset(new LocaleNotificationController);
 
@@ -1107,7 +1111,8 @@
       }
     }
     keyboard::KeyboardController::ResetInstance(
-        new keyboard::KeyboardController(delegate_->CreateKeyboardUI()));
+        new keyboard::KeyboardController(
+            wm_shell_->delegate()->CreateKeyboardUI()));
   }
 }
 
diff --git a/ash/shell.h b/ash/shell.h
index b2b4304..7b109fe 100644
--- a/ash/shell.h
+++ b/ash/shell.h
@@ -14,7 +14,6 @@
 #include "ash/metrics/user_metrics_recorder.h"
 #include "ash/wm/cursor_manager_chromeos.h"
 #include "ash/wm/system_modal_container_event_filter_delegate.h"
-#include "base/compiler_specific.h"
 #include "base/gtest_prod_util.h"
 #include "base/macros.h"
 #include "base/memory/weak_ptr.h"
@@ -367,8 +366,6 @@
   }
   ::wm::CursorManager* cursor_manager() { return cursor_manager_.get(); }
 
-  ShellDelegate* delegate() { return delegate_.get(); }
-
   UserWallpaperDelegate* user_wallpaper_delegate() {
     return user_wallpaper_delegate_.get();
   }
@@ -595,7 +592,6 @@
 
   std::unique_ptr<UserMetricsRecorder> user_metrics_recorder_;
   std::unique_ptr<AcceleratorController> accelerator_controller_;
-  std::unique_ptr<ShellDelegate> delegate_;
   std::unique_ptr<UserWallpaperDelegate> user_wallpaper_delegate_;
   std::unique_ptr<SessionStateDelegate> session_state_delegate_;
   std::unique_ptr<AccessibilityDelegate> accessibility_delegate_;
diff --git a/ash/shell/app_list.cc b/ash/shell/app_list.cc
index f180b3b1..6b238a87 100644
--- a/ash/shell/app_list.cc
+++ b/ash/shell/app_list.cc
@@ -12,7 +12,6 @@
 #include "ash/shell.h"
 #include "ash/shell/example_factory.h"
 #include "ash/shell/toplevel_window.h"
-#include "ash/shell_delegate.h"
 #include "base/callback.h"
 #include "base/files/file_path.h"
 #include "base/i18n/case_conversion.h"
diff --git a/ash/shell/shell_delegate_impl.h b/ash/shell/shell_delegate_impl.h
index 17999741..ce80c0c0 100644
--- a/ash/shell/shell_delegate_impl.h
+++ b/ash/shell/shell_delegate_impl.h
@@ -8,7 +8,7 @@
 #include <memory>
 #include <string>
 
-#include "ash/shell_delegate.h"
+#include "ash/common/shell_delegate.h"
 #include "base/compiler_specific.h"
 #include "base/macros.h"
 
@@ -26,7 +26,7 @@
 
 class ShelfDelegateImpl;
 
-class ShellDelegateImpl : public ash::ShellDelegate {
+class ShellDelegateImpl : public ShellDelegate {
  public:
   ShellDelegateImpl();
   ~ShellDelegateImpl() override;
@@ -49,12 +49,12 @@
   void OpenUrl(const GURL& url) override;
   app_list::AppListPresenter* GetAppListPresenter() override;
   ShelfDelegate* CreateShelfDelegate(ShelfModel* model) override;
-  ash::SystemTrayDelegate* CreateSystemTrayDelegate() override;
-  ash::UserWallpaperDelegate* CreateUserWallpaperDelegate() override;
-  ash::SessionStateDelegate* CreateSessionStateDelegate() override;
-  ash::AccessibilityDelegate* CreateAccessibilityDelegate() override;
-  ash::NewWindowDelegate* CreateNewWindowDelegate() override;
-  ash::MediaDelegate* CreateMediaDelegate() override;
+  SystemTrayDelegate* CreateSystemTrayDelegate() override;
+  UserWallpaperDelegate* CreateUserWallpaperDelegate() override;
+  SessionStateDelegate* CreateSessionStateDelegate() override;
+  AccessibilityDelegate* CreateAccessibilityDelegate() override;
+  NewWindowDelegate* CreateNewWindowDelegate() override;
+  MediaDelegate* CreateMediaDelegate() override;
   std::unique_ptr<PointerWatcherDelegate> CreatePointerWatcherDelegate()
       override;
   ui::MenuModel* CreateContextMenu(WmShelf* wm_shelf,
diff --git a/ash/shell/window_type_launcher.cc b/ash/shell/window_type_launcher.cc
index 20a8ca4f..c5c5052 100644
--- a/ash/shell/window_type_launcher.cc
+++ b/ash/shell/window_type_launcher.cc
@@ -17,7 +17,6 @@
 #include "ash/shell/example_factory.h"
 #include "ash/shell/panel_window.h"
 #include "ash/shell/toplevel_window.h"
-#include "ash/shell_delegate.h"
 #include "ash/system/status_area_widget.h"
 #include "ash/test/child_modal_window.h"
 #include "base/strings/utf_string_conversions.h"
diff --git a/ash/shell_init_params.cc b/ash/shell_init_params.cc
index 5df9eb7..b5071262 100644
--- a/ash/shell_init_params.cc
+++ b/ash/shell_init_params.cc
@@ -4,8 +4,6 @@
 
 #include "ash/shell_init_params.h"
 
-#include "ash/shell_delegate.h"
-
 namespace ash {
 
 ShellInitParams::ShellInitParams()
diff --git a/ash/shell_unittest.cc b/ash/shell_unittest.cc
index f8419c9..8d659eda 100644
--- a/ash/shell_unittest.cc
+++ b/ash/shell_unittest.cc
@@ -18,7 +18,6 @@
 #include "ash/shelf/shelf.h"
 #include "ash/shelf/shelf_layout_manager.h"
 #include "ash/shelf/shelf_widget.h"
-#include "ash/shell_delegate.h"
 #include "ash/test/ash_test_base.h"
 #include "ash/test/shell_test_api.h"
 #include "ash/wm/window_util.h"
diff --git a/ash/system/user/tray_user_unittest.cc b/ash/system/user/tray_user_unittest.cc
index 0cd7a08..39adf62 100644
--- a/ash/system/user/tray_user_unittest.cc
+++ b/ash/system/user/tray_user_unittest.cc
@@ -4,11 +4,12 @@
 
 #include <vector>
 
+#include "ash/common/shell_delegate.h"
 #include "ash/common/system/tray/tray_constants.h"
 #include "ash/common/system/user/tray_user_separator.h"
+#include "ash/common/wm_shell.h"
 #include "ash/root_window_controller.h"
 #include "ash/shell.h"
-#include "ash/shell_delegate.h"
 #include "ash/system/tray/system_tray.h"
 #include "ash/system/user/tray_user.h"
 #include "ash/system/user/user_view.h"
@@ -78,7 +79,7 @@
   // after everything was created.
   delegate_->set_logged_in_users(users_logged_in);
   test::TestShellDelegate* shell_delegate =
-      static_cast<test::TestShellDelegate*>(Shell::GetInstance()->delegate());
+      static_cast<test::TestShellDelegate*>(WmShell::Get()->delegate());
   shell_delegate->set_multi_profiles_enabled(multiprofile);
 
   // Instead of using the existing tray panels we create new ones which makes
diff --git a/ash/system/user/user_view.cc b/ash/system/user/user_view.cc
index f20ba28..5b5050a 100644
--- a/ash/system/user/user_view.cc
+++ b/ash/system/user/user_view.cc
@@ -8,6 +8,7 @@
 #include <utility>
 
 #include "ash/common/session/session_state_delegate.h"
+#include "ash/common/shell_delegate.h"
 #include "ash/common/shell_window_ids.h"
 #include "ash/common/system/tray/system_tray_delegate.h"
 #include "ash/common/system/tray/tray_constants.h"
@@ -22,8 +23,6 @@
 #include "ash/common/wm_window.h"
 #include "ash/multi_profile_uma.h"
 #include "ash/popup_message.h"
-#include "ash/shell.h"
-#include "ash/shell_delegate.h"
 #include "ash/system/tray/system_tray.h"
 #include "ash/system/user/user_card_view.h"
 #include "components/signin/core/account_id/account_id.h"
@@ -85,7 +84,7 @@
 }
 
 bool IsMultiProfileSupportedAndUserActive() {
-  return Shell::GetInstance()->delegate()->IsMultiProfilesEnabled() &&
+  return WmShell::Get()->delegate()->IsMultiProfilesEnabled() &&
          !WmShell::Get()->GetSessionStateDelegate()->IsUserSessionBlocked();
 }
 
diff --git a/ash/sysui/keyboard_ui_mus.cc b/ash/sysui/keyboard_ui_mus.cc
index 00f1864..6b859a9 100644
--- a/ash/sysui/keyboard_ui_mus.cc
+++ b/ash/sysui/keyboard_ui_mus.cc
@@ -5,8 +5,6 @@
 #include "ash/sysui/keyboard_ui_mus.h"
 
 #include "ash/common/keyboard/keyboard_ui_observer.h"
-#include "ash/shell.h"
-#include "ash/shell_delegate.h"
 #include "base/memory/ptr_util.h"
 #include "services/shell/public/cpp/connector.h"
 
diff --git a/ash/sysui/shell_delegate_mus.h b/ash/sysui/shell_delegate_mus.h
index f6077a0f..a9fdb52ce 100644
--- a/ash/sysui/shell_delegate_mus.h
+++ b/ash/sysui/shell_delegate_mus.h
@@ -7,7 +7,7 @@
 
 #include <memory>
 
-#include "ash/shell_delegate.h"
+#include "ash/common/shell_delegate.h"
 #include "base/macros.h"
 
 namespace keyboard {
@@ -20,7 +20,7 @@
 
 namespace sysui {
 
-class ShellDelegateMus : public ash::ShellDelegate {
+class ShellDelegateMus : public ShellDelegate {
  public:
   explicit ShellDelegateMus(std::unique_ptr<AppListPresenterMus>);
   ~ShellDelegateMus() override;
@@ -43,12 +43,12 @@
   void OpenUrl(const GURL& url) override;
   app_list::AppListPresenter* GetAppListPresenter() override;
   ShelfDelegate* CreateShelfDelegate(ShelfModel* model) override;
-  ash::SystemTrayDelegate* CreateSystemTrayDelegate() override;
-  ash::UserWallpaperDelegate* CreateUserWallpaperDelegate() override;
-  ash::SessionStateDelegate* CreateSessionStateDelegate() override;
-  ash::AccessibilityDelegate* CreateAccessibilityDelegate() override;
-  ash::NewWindowDelegate* CreateNewWindowDelegate() override;
-  ash::MediaDelegate* CreateMediaDelegate() override;
+  SystemTrayDelegate* CreateSystemTrayDelegate() override;
+  UserWallpaperDelegate* CreateUserWallpaperDelegate() override;
+  SessionStateDelegate* CreateSessionStateDelegate() override;
+  AccessibilityDelegate* CreateAccessibilityDelegate() override;
+  NewWindowDelegate* CreateNewWindowDelegate() override;
+  MediaDelegate* CreateMediaDelegate() override;
   std::unique_ptr<PointerWatcherDelegate> CreatePointerWatcherDelegate()
       override;
   ui::MenuModel* CreateContextMenu(WmShelf* wm_shelf,
diff --git a/ash/test/shell_test_api.cc b/ash/test/shell_test_api.cc
index b369223..f64bc30 100644
--- a/ash/test/shell_test_api.cc
+++ b/ash/test/shell_test_api.cc
@@ -4,12 +4,13 @@
 
 #include "ash/test/shell_test_api.h"
 
+#include "ash/aura/wm_shell_aura.h"
 #include "ash/common/session/session_state_delegate.h"
+#include "ash/common/shell_delegate.h"
 #include "ash/display/display_configuration_controller.h"
 #include "ash/root_window_controller.h"
 #include "ash/shelf/shelf_delegate.h"
 #include "ash/shell.h"
-#include "ash/shell_delegate.h"
 
 namespace ash {
 namespace test {
@@ -41,7 +42,7 @@
 }
 
 app_list::AppListPresenter* ShellTestApi::app_list_presenter() {
-  return shell_->delegate_->GetAppListPresenter();
+  return shell_->wm_shell_->delegate()->GetAppListPresenter();
 }
 
 void ShellTestApi::DisableDisplayAnimator() {
diff --git a/ash/test/test_keyboard_ui.cc b/ash/test/test_keyboard_ui.cc
index 20f9b44..46558a8e 100644
--- a/ash/test/test_keyboard_ui.cc
+++ b/ash/test/test_keyboard_ui.cc
@@ -5,7 +5,6 @@
 #include "ash/test/test_keyboard_ui.h"
 
 #include "ash/shell.h"
-#include "ash/shell_delegate.h"
 #include "ash/wm/window_util.h"
 #include "ui/aura/window.h"
 #include "ui/aura/window_tree_host.h"
diff --git a/ash/test/test_shell_delegate.h b/ash/test/test_shell_delegate.h
index 704d83d..fb0d5558 100644
--- a/ash/test/test_shell_delegate.h
+++ b/ash/test/test_shell_delegate.h
@@ -9,7 +9,7 @@
 #include <string>
 
 #include "ash/common/media_delegate.h"
-#include "ash/shell_delegate.h"
+#include "ash/common/shell_delegate.h"
 #include "ash/test/test_session_state_delegate.h"
 #include "base/macros.h"
 #include "base/observer_list.h"
@@ -88,7 +88,7 @@
       app_list_presenter_delegate_factory_;
   std::unique_ptr<app_list::AppListPresenterImpl> app_list_presenter_;
 
-  base::ObserverList<ash::VirtualKeyboardStateObserver>
+  base::ObserverList<VirtualKeyboardStateObserver>
       keyboard_state_observer_list_;
 
   DISALLOW_COPY_AND_ASSIGN(TestShellDelegate);
diff --git a/ash/wm/ash_focus_rules.cc b/ash/wm/ash_focus_rules.cc
index e6e1c63f..2225610 100644
--- a/ash/wm/ash_focus_rules.cc
+++ b/ash/wm/ash_focus_rules.cc
@@ -11,7 +11,6 @@
 #include "ash/common/wm/window_state.h"
 #include "ash/common/wm_shell.h"
 #include "ash/shell.h"
-#include "ash/shell_delegate.h"
 #include "ash/wm/window_state_aura.h"
 #include "ui/aura/window.h"
 
diff --git a/ash/wm/lock_layout_manager.cc b/ash/wm/lock_layout_manager.cc
index 8691654..e8d7da91 100644
--- a/ash/wm/lock_layout_manager.cc
+++ b/ash/wm/lock_layout_manager.cc
@@ -4,10 +4,10 @@
 
 #include "ash/wm/lock_layout_manager.h"
 
+#include "ash/common/shell_delegate.h"
 #include "ash/common/wm/window_state.h"
 #include "ash/common/wm/wm_event.h"
-#include "ash/shell.h"
-#include "ash/shell_delegate.h"
+#include "ash/common/wm_shell.h"
 #include "ash/wm/lock_window_state.h"
 #include "ash/wm/window_state_aura.h"
 #include "ui/aura/window.h"
@@ -23,7 +23,7 @@
       window_(window),
       root_window_(window->GetRootWindow()),
       is_observing_keyboard_(false) {
-  Shell::GetInstance()->delegate()->AddVirtualKeyboardStateObserver(this);
+  WmShell::Get()->delegate()->AddVirtualKeyboardStateObserver(this);
   root_window_->AddObserver(this);
   if (keyboard::KeyboardController::GetInstance()) {
     keyboard::KeyboardController::GetInstance()->AddObserver(this);
@@ -40,7 +40,7 @@
     (*it)->RemoveObserver(this);
   }
 
-  Shell::GetInstance()->delegate()->RemoveVirtualKeyboardStateObserver(this);
+  WmShell::Get()->delegate()->RemoveVirtualKeyboardStateObserver(this);
 
   if (keyboard::KeyboardController::GetInstance() && is_observing_keyboard_) {
     keyboard::KeyboardController::GetInstance()->RemoveObserver(this);
diff --git a/ash/wm/lock_layout_manager.h b/ash/wm/lock_layout_manager.h
index ff57989..6eb0cae1a 100644
--- a/ash/wm/lock_layout_manager.h
+++ b/ash/wm/lock_layout_manager.h
@@ -6,10 +6,9 @@
 #define ASH_WM_LOCK_LAYOUT_MANAGER_H_
 
 #include "ash/ash_export.h"
+#include "ash/common/shell_delegate.h"
 #include "ash/common/wm/wm_types.h"
-#include "ash/shell_delegate.h"
 #include "ash/snap_to_pixel_layout_manager.h"
-#include "base/compiler_specific.h"
 #include "base/macros.h"
 #include "ui/aura/layout_manager.h"
 #include "ui/aura/window_observer.h"
diff --git a/ash/wm/lock_state_controller.cc b/ash/wm/lock_state_controller.cc
index 08c314c..2ad8a59 100644
--- a/ash/wm/lock_state_controller.cc
+++ b/ash/wm/lock_state_controller.cc
@@ -11,10 +11,10 @@
 #include "ash/cancel_mode.h"
 #include "ash/common/accessibility_delegate.h"
 #include "ash/common/ash_switches.h"
+#include "ash/common/shell_delegate.h"
 #include "ash/common/shell_window_ids.h"
 #include "ash/common/wm_shell.h"
 #include "ash/shell.h"
-#include "ash/shell_delegate.h"
 #include "ash/wm/session_state_animator.h"
 #include "ash/wm/session_state_animator_impl.h"
 #include "base/bind.h"
@@ -214,7 +214,7 @@
 
 void LockStateController::OnHostCloseRequested(
     const aura::WindowTreeHost* host) {
-  Shell::GetInstance()->delegate()->Exit();
+  WmShell::Get()->delegate()->Exit();
 }
 
 void LockStateController::OnLoginStateChanged(LoginStatus status) {
@@ -333,7 +333,7 @@
   DCHECK(shutting_down_);
 #if defined(OS_CHROMEOS)
   if (!base::SysInfo::IsRunningOnChromeOS()) {
-    ShellDelegate* delegate = Shell::GetInstance()->delegate();
+    ShellDelegate* delegate = WmShell::Get()->delegate();
     if (delegate) {
       delegate->Exit();
       return;
diff --git a/ash/wm/lock_state_controller_unittest.cc b/ash/wm/lock_state_controller_unittest.cc
index 812a5ed..48d5535e 100644
--- a/ash/wm/lock_state_controller_unittest.cc
+++ b/ash/wm/lock_state_controller_unittest.cc
@@ -70,7 +70,7 @@
     power_button_controller_ = Shell::GetInstance()->power_button_controller();
 
     shell_delegate_ =
-        static_cast<TestShellDelegate*>(Shell::GetInstance()->delegate());
+        static_cast<TestShellDelegate*>(WmShell::Get()->delegate());
   }
 
  protected:
diff --git a/ash/wm/window_positioner_unittest.cc b/ash/wm/window_positioner_unittest.cc
index 839607cf..32502241 100644
--- a/ash/wm/window_positioner_unittest.cc
+++ b/ash/wm/window_positioner_unittest.cc
@@ -9,6 +9,7 @@
 #include "ash/common/material_design/material_design_controller.h"
 #include "ash/common/wm/window_positioner.h"
 #include "ash/common/wm/window_state.h"
+#include "ash/common/wm_shell.h"
 #include "ash/shell.h"
 #include "ash/shell/toplevel_window.h"
 #include "ash/test/ash_md_test_base.h"
@@ -174,7 +175,7 @@
   ui::WindowShowState show_state_out = ui::SHOW_STATE_DEFAULT;
 
   test::TestShellDelegate* const delegate =
-      static_cast<test::TestShellDelegate*>(Shell::GetInstance()->delegate());
+      static_cast<test::TestShellDelegate*>(WmShell::Get()->delegate());
   delegate->SetForceMaximizeOnFirstRun(true);
 
   WindowPositioner::GetBoundsAndShowStateForNewWindow(
@@ -193,7 +194,7 @@
   ui::WindowShowState show_state_out = ui::SHOW_STATE_DEFAULT;
 
   test::TestShellDelegate* const delegate =
-      static_cast<test::TestShellDelegate*>(Shell::GetInstance()->delegate());
+      static_cast<test::TestShellDelegate*>(WmShell::Get()->delegate());
   delegate->SetForceMaximizeOnFirstRun(true);
 
   WindowPositioner::GetBoundsAndShowStateForNewWindow(