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

Unified Diff: ash/aura/wm_shelf_aura.cc

Issue 2041583004: mash: Move WmShelfAura ownership to RootWindowController and init it earlier (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@moveshelftypes
Patch Set: . Created 4 years, 6 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
« no previous file with comments | « ash/aura/wm_shelf_aura.h ('k') | ash/common/wm/workspace/workspace_layout_manager_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/aura/wm_shelf_aura.cc
diff --git a/ash/aura/wm_shelf_aura.cc b/ash/aura/wm_shelf_aura.cc
index 2a4ddf5a21aa14a2ff43e7b9061847c6ba68a9c0..c5db74ba9cf1d9db4b52a408c330f0d7d9285ad6 100644
--- a/ash/aura/wm_shelf_aura.cc
+++ b/ash/aura/wm_shelf_aura.cc
@@ -13,16 +13,30 @@
namespace ash {
-WmShelfAura::WmShelfAura(Shelf* shelf)
- : shelf_(shelf), shelf_layout_manager_(shelf->shelf_layout_manager()) {
+WmShelfAura::WmShelfAura() {}
+
+WmShelfAura::~WmShelfAura() {}
+
+void WmShelfAura::SetShelfLayoutManager(
+ ShelfLayoutManager* shelf_layout_manager) {
+ DCHECK(!shelf_layout_manager_);
+ shelf_layout_manager_ = shelf_layout_manager;
shelf_layout_manager_->AddObserver(this);
+}
+
+void WmShelfAura::SetShelf(Shelf* shelf) {
+ DCHECK(!shelf_);
+ shelf_ = shelf;
shelf_->AddIconObserver(this);
}
-WmShelfAura::~WmShelfAura() {
- shelf_->RemoveIconObserver(this);
- if (shelf_layout_manager_)
- shelf_layout_manager_->RemoveObserver(this);
+void WmShelfAura::Shutdown() {
+ if (shelf_) {
+ shelf_->RemoveIconObserver(this);
+ shelf_ = nullptr;
+ }
+
+ ResetShelfLayoutManager();
}
// static
@@ -30,6 +44,13 @@ Shelf* WmShelfAura::GetShelf(WmShelf* shelf) {
return static_cast<WmShelfAura*>(shelf)->shelf_;
}
+void WmShelfAura::ResetShelfLayoutManager() {
+ if (!shelf_layout_manager_)
+ return;
+ shelf_layout_manager_->RemoveObserver(this);
+ shelf_layout_manager_ = nullptr;
+}
+
WmWindow* WmShelfAura::GetWindow() {
return WmWindowAura::Get(shelf_->shelf_widget()->GetNativeView());
}
@@ -69,8 +90,7 @@ void WmShelfAura::RemoveObserver(WmShelfObserver* observer) {
}
void WmShelfAura::WillDeleteShelfLayoutManager() {
- shelf_layout_manager_->RemoveObserver(this);
- shelf_layout_manager_ = nullptr;
+ ResetShelfLayoutManager();
}
void WmShelfAura::OnBackgroundUpdated(
« no previous file with comments | « ash/aura/wm_shelf_aura.h ('k') | ash/common/wm/workspace/workspace_layout_manager_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698