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

Unified Diff: ash/common/shelf/shelf_widget.cc

Issue 2304443002: ash: Move ShelfWidget ownership to WmShelf and refactor access to it (Closed)
Patch Set: review comments Created 4 years, 4 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/common/shelf/shelf_widget.h ('k') | ash/common/shelf/wm_shelf.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/shelf/shelf_widget.cc
diff --git a/ash/common/shelf/shelf_widget.cc b/ash/common/shelf/shelf_widget.cc
index 4d6a79089a3f2fab8abc3d692b5bbb33e140e202..01d4109f45bb570eaff9a4f9d83a8a2400229ad1 100644
--- a/ash/common/shelf/shelf_widget.cc
+++ b/ash/common/shelf/shelf_widget.cc
@@ -287,10 +287,9 @@ void ShelfWidget::DelegateView::UpdateShelfAssetBackground(int alpha) {
SchedulePaint();
}
-ShelfWidget::ShelfWidget(WmWindow* shelf_container,
- WmWindow* status_container,
- WmShelf* wm_shelf)
+ShelfWidget::ShelfWidget(WmWindow* shelf_container, WmShelf* wm_shelf)
: wm_shelf_(wm_shelf),
+ status_area_widget_(nullptr),
delegate_view_(new DelegateView(wm_shelf, this)),
shelf_view_(nullptr),
background_animator_(SHELF_BACKGROUND_DEFAULT, wm_shelf_),
@@ -320,17 +319,6 @@ ShelfWidget::ShelfWidget(WmWindow* shelf_container,
background_animator_.PaintBackground(
shelf_layout_manager_->GetShelfBackgroundType(),
BACKGROUND_CHANGE_IMMEDIATE);
- wm_shelf_->SetShelfLayoutManager(shelf_layout_manager_);
-
- // TODO(jamescook): Move ownership to RootWindowController.
- status_area_widget_ = new StatusAreaWidget(status_container, wm_shelf_);
- status_area_widget_->CreateTrayViews();
- if (WmShell::Get()->GetSessionStateDelegate()->IsActiveUserSessionStarted())
- status_area_widget_->Show();
- WmShell::Get()->focus_cycler()->AddWidget(status_area_widget_);
- background_animator_.AddObserver(status_area_widget_);
- status_container->SetLayoutManager(
- base::MakeUnique<StatusAreaLayoutManager>(this));
views::Widget::AddObserver(this);
}
@@ -345,6 +333,20 @@ ShelfWidget::~ShelfWidget() {
background_animator_.RemoveObserver(this);
}
+void ShelfWidget::CreateStatusAreaWidget(WmWindow* status_container) {
+ DCHECK(status_container);
+ DCHECK(!status_area_widget_);
+ // TODO(jamescook): Move ownership to RootWindowController.
+ status_area_widget_ = new StatusAreaWidget(status_container, wm_shelf_);
+ status_area_widget_->CreateTrayViews();
+ if (WmShell::Get()->GetSessionStateDelegate()->IsActiveUserSessionStarted())
+ status_area_widget_->Show();
+ WmShell::Get()->focus_cycler()->AddWidget(status_area_widget_);
+ background_animator_.AddObserver(status_area_widget_);
+ status_container->SetLayoutManager(
+ base::MakeUnique<StatusAreaLayoutManager>(this));
+}
+
void ShelfWidget::SetPaintsBackground(
ShelfBackgroundType background_type,
BackgroundAnimatorChangeType change_type) {
« no previous file with comments | « ash/common/shelf/shelf_widget.h ('k') | ash/common/shelf/wm_shelf.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698