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

Unified Diff: ash/root_window_controller.cc

Issue 2235233006: ash: Refactor Shelf ownership and ShelfView creation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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/root_window_controller.h ('k') | ash/shelf/shelf.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/root_window_controller.cc
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc
index cdd41c0f2952bf362c3f37670697977972e9d4cd..743160facc58f1448272b7cb81cc1872f0f9815a 100644
--- a/ash/root_window_controller.cc
+++ b/ash/root_window_controller.cc
@@ -16,6 +16,7 @@
#include "ash/common/login_status.h"
#include "ash/common/root_window_controller_common.h"
#include "ash/common/session/session_state_delegate.h"
+#include "ash/common/shelf/shelf_delegate.h"
#include "ash/common/shelf/shelf_types.h"
#include "ash/common/shell_delegate.h"
#include "ash/common/shell_window_ids.h"
@@ -460,16 +461,24 @@ const aura::Window* RootWindowController::GetContainer(int container_id) const {
}
void RootWindowController::ShowShelf() {
- if (!shelf_widget_->shelf())
+ if (!shelf_)
return;
- shelf_widget_->shelf()->SetVisible(true);
+ shelf_widget_->SetShelfVisibility(true);
shelf_widget_->status_area_widget()->Show();
}
void RootWindowController::CreateShelf() {
- if (shelf_widget_->shelf())
+ if (shelf_)
return;
- shelf_widget_->CreateShelf();
+ ShelfView* shelf_view = shelf_widget_->CreateShelfView();
+
+ shelf_.reset(
+ new Shelf(wm_shelf_aura_.get(), shelf_view, shelf_widget_.get()));
+ shelf_widget_->set_shelf(shelf_.get());
+ // Must be initialized before the delegate is notified because the delegate
+ // may try to access the WmShelf.
+ wm_shelf_aura_->SetShelf(shelf_.get());
+ WmShell::Get()->shelf_delegate()->OnShelfCreated(shelf_.get());
if (panel_layout_manager_)
panel_layout_manager_->SetShelf(wm_shelf_aura_.get());
@@ -488,8 +497,7 @@ void RootWindowController::CreateShelf() {
}
Shelf* RootWindowController::GetShelf() const {
- // TODO(jamescook): Shelf should be owned by this class, not by ShelfWidget.
- return shelf_widget_->shelf();
+ return shelf_.get();
}
void RootWindowController::UpdateAfterLoginStatusChange(LoginStatus status) {
@@ -608,6 +616,7 @@ void RootWindowController::CloseChildWindows() {
}
shelf_widget_.reset();
+ shelf_.reset();
}
void RootWindowController::MoveWindowsTo(aura::Window* dst) {
« no previous file with comments | « ash/root_window_controller.h ('k') | ash/shelf/shelf.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698