Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1888)

Unified Diff: ash/shell.cc

Issue 2118593002: mash: Migrate ShellDelegate ownership and access to WmShell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/shell.cc
diff --git a/ash/shell.cc b/ash/shell.cc
index 6e2f60e19a20919411b8694e96d91e5ddb57e910..3183c7ad8f3811ba7e932c3d7ea78e5c49e05b5e 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::ShowContextMenu(const gfx::Point& location_in_screen,
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 @@ ShelfDelegate* Shell::GetShelfDelegate() {
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 @@ void Shell::DoInitialWorkspaceAnimation() {
// Shell, private:
Shell::Shell(ShellDelegate* delegate, base::SequencedWorkerPool* blocking_pool)
- : target_root_window_(nullptr),
+ : wm_shell_(new WmShellAura(delegate)),
James Cook 2016/07/06 21:27:27 It's nice that it works to move this here!
msw 2016/07/06 21:58:56 Acknowledged.
+ 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 @@ Shell::Shell(ShellDelegate* delegate, base::SequencedWorkerPool* blocking_pool)
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 @@ Shell::~Shell() {
user_metrics_recorder_->OnShellShuttingDown();
- delegate_->PreShutdown();
+ wm_shell_->delegate()->PreShutdown();
views::FocusManagerFactory::Install(nullptr);
@@ -812,7 +813,6 @@ void Shell::Init(const ShellInitParams& init_params) {
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 @@ void Shell::Init(const ShellInitParams& init_params) {
#endif
}
- delegate_->PreInit();
+ wm_shell_->delegate()->PreInit();
bool display_initialized = display_manager_->InitFromCommandLine();
display_configuration_controller_.reset(new DisplayConfigurationController(
@@ -870,7 +870,7 @@ void Shell::Init(const ShellInitParams& init_params) {
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 @@ void Shell::Init(const ShellInitParams& init_params) {
// This controller needs to be set before SetupManagedWindowMode.
desktop_background_controller_.reset(
new DesktopBackgroundController(blocking_pool_));
- user_wallpaper_delegate_.reset(delegate_->CreateUserWallpaperDelegate());
-
- session_state_delegate_.reset(delegate_->CreateSessionStateDelegate());
- accessibility_delegate_.reset(delegate_->CreateAccessibilityDelegate());
- new_window_delegate_.reset(delegate_->CreateNewWindowDelegate());
+ user_wallpaper_delegate_.reset(
+ wm_shell_->delegate()->CreateUserWallpaperDelegate());
+
+ 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(
James Cook 2016/07/06 21:27:27 Could the media delegate be created inside WmShell
msw 2016/07/06 21:58:56 Yes, all of these other delegates should be create
- 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()));
James Cook 2016/07/06 21:27:27 ditto
msw 2016/07/06 21:58:56 See comment above.
locale_notification_controller_.reset(new LocaleNotificationController);
@@ -1107,7 +1111,8 @@ void Shell::InitKeyboard() {
}
}
keyboard::KeyboardController::ResetInstance(
- new keyboard::KeyboardController(delegate_->CreateKeyboardUI()));
+ new keyboard::KeyboardController(
+ wm_shell_->delegate()->CreateKeyboardUI()));
}
}

Powered by Google App Engine
This is Rietveld 408576698