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

Unified Diff: ash/shelf/wm_shelf.cc

Issue 2889673002: chromeos: Refactor shelf to create ShelfView earlier in startup (Closed)
Patch Set: Move ShelfView to initializer list Created 3 years, 7 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/shelf/wm_shelf.cc
diff --git a/ash/shelf/wm_shelf.cc b/ash/shelf/wm_shelf.cc
index 6abaf16ab8075c8dd9c56c24ab28d08efcad4597..df1353a2b49325dc7bfae2bb951c1e752eac277b 100644
--- a/ash/shelf/wm_shelf.cc
+++ b/ash/shelf/wm_shelf.cc
@@ -64,7 +64,13 @@ class WmShelf::AutoHideEventHandler : public ui::EventHandler {
// WmShelf ---------------------------------------------------------------------
-WmShelf::WmShelf() {}
+WmShelf::WmShelf()
+ : shelf_locking_manager_(base::MakeUnique<ShelfLockingManager>(this)) {
msw 2017/05/16 22:42:00 This should no longer be a unique_ptr
James Cook 2017/05/17 16:16:13 Done. Sometimes I wish we used unique_ptr<> a bit
+ // TODO: ShelfBezelEventHandler needs to work with mus too.
+ // http://crbug.com/636647
+ if (Shell::GetAshConfig() != Config::MASH)
+ bezel_event_handler_ = base::MakeUnique<ShelfBezelEventHandler>(this);
+}
WmShelf::~WmShelf() {}
@@ -117,11 +123,6 @@ void WmShelf::CreateShelfWidget(WmWindow* root) {
WmWindow* status_container =
root->GetChildByShellWindowId(kShellWindowId_StatusContainer);
shelf_widget_->CreateStatusAreaWidget(status_container);
-
- // TODO: ShelfBezelEventHandler needs to work with mus too.
- // http://crbug.com/636647
- if (Shell::GetAshConfig() != Config::MASH)
- bezel_event_handler_ = base::MakeUnique<ShelfBezelEventHandler>(this);
James Cook 2017/05/16 21:32:35 The timing here doesn't matter so I moved it up.
msw 2017/05/16 22:42:00 Acknowledged.
}
void WmShelf::ShutdownShelfWidget() {
@@ -133,23 +134,10 @@ void WmShelf::DestroyShelfWidget() {
shelf_widget_.reset();
}
-void WmShelf::CreateShelfView() {
+void WmShelf::NotifyShelfInitialized() {
DCHECK(shelf_layout_manager_);
DCHECK(shelf_widget_);
- DCHECK(!shelf_view_);
- shelf_view_ = shelf_widget_->CreateShelfView();
- shelf_locking_manager_.reset(new ShelfLockingManager(this));
- Shell::Get()->shelf_controller()->NotifyShelfCreated(this);
-}
-
-void WmShelf::ShutdownShelf() {
- DCHECK(shelf_view_);
- shelf_locking_manager_.reset();
- shelf_view_ = nullptr;
-}
-
-bool WmShelf::IsShelfInitialized() const {
- return !!shelf_view_;
+ Shell::Get()->shelf_controller()->NotifyShelfInitialized(this);
}
WmWindow* WmShelf::GetWindow() {
@@ -337,7 +325,7 @@ ShelfLockingManager* WmShelf::GetShelfLockingManagerForTesting() {
}
ShelfView* WmShelf::GetShelfViewForTesting() {
- return shelf_view_;
+ return shelf_widget_->shelf_view_for_testing();
}
void WmShelf::WillDeleteShelfLayoutManager() {

Powered by Google App Engine
This is Rietveld 408576698