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

Unified Diff: ash/shell.cc

Issue 1851883002: Cleanup shelf initialization and observation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check for shelf before setting prefs in ChromeLauncherController. Created 4 years, 8 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 2e100f0b942c8c5f1756d08d3f1e05455580f90d..66a9b6227682556ad2a804542b4caa497454f556 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -40,10 +40,10 @@
#include "ash/root_window_controller.h"
#include "ash/session/session_state_delegate.h"
#include "ash/shelf/app_list_shelf_item_delegate.h"
+#include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_delegate.h"
#include "ash/shelf/shelf_item_delegate.h"
#include "ash/shelf/shelf_item_delegate_manager.h"
-#include "ash/shelf/shelf_layout_manager.h"
#include "ash/shelf/shelf_model.h"
#include "ash/shelf/shelf_widget.h"
#include "ash/shelf/shelf_window_watcher.h"
@@ -511,25 +511,21 @@ void Shell::UpdateShelfVisibility() {
void Shell::SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior,
aura::Window* root_window) {
- ShelfWidget* shelf_widget = GetRootWindowController(root_window)->shelf();
- shelf_widget->shelf_layout_manager()->SetAutoHideBehavior(behavior);
+ Shelf::ForWindow(root_window)->SetAutoHideBehavior(behavior);
}
ShelfAutoHideBehavior Shell::GetShelfAutoHideBehavior(
aura::Window* root_window) const {
- ShelfWidget* shelf_widget = GetRootWindowController(root_window)->shelf();
- return shelf_widget->shelf_layout_manager()->auto_hide_behavior();
+ return Shelf::ForWindow(root_window)->GetAutoHideBehavior();
}
void Shell::SetShelfAlignment(ShelfAlignment alignment,
aura::Window* root_window) {
- ShelfWidget* shelf_widget = GetRootWindowController(root_window)->shelf();
- shelf_widget->shelf_layout_manager()->SetAlignment(alignment);
+ Shelf::ForWindow(root_window)->SetAlignment(alignment);
}
ShelfAlignment Shell::GetShelfAlignment(const aura::Window* root_window) const {
- ShelfWidget* shelf_widget = GetRootWindowController(root_window)->shelf();
- return shelf_widget->shelf_layout_manager()->GetAlignment();
+ return Shelf::ForWindow(root_window)->GetAlignment();
}
void Shell::OnShelfAlignmentChanged(aura::Window* root_window) {
@@ -537,6 +533,11 @@ void Shell::OnShelfAlignmentChanged(aura::Window* root_window) {
OnShelfAlignmentChanged(root_window));
}
+void Shell::OnShelfAutoHideBehaviorChanged(aura::Window* root_window) {
+ FOR_EACH_OBSERVER(ShellObserver, observers_,
+ OnShelfAutoHideBehaviorChanged(root_window));
+}
+
void Shell::NotifyFullscreenStateChange(bool is_fullscreen,
aura::Window* root_window) {
FOR_EACH_OBSERVER(ShellObserver, observers_, OnFullscreenStateChanged(
@@ -587,7 +588,6 @@ SystemTray* Shell::GetPrimarySystemTray() {
ShelfDelegate* Shell::GetShelfDelegate() {
if (!shelf_delegate_) {
- shelf_model_.reset(new ShelfModel);
// Creates ShelfItemDelegateManager before ShelfDelegate.
shelf_item_delegate_manager_.reset(
new ShelfItemDelegateManager(shelf_model_.get()));
@@ -642,6 +642,7 @@ Shell::Shell(ShellDelegate* delegate, base::SequencedWorkerPool* blocking_pool)
: target_root_window_(nullptr),
scoped_target_root_window_(nullptr),
delegate_(delegate),
+ shelf_model_(new ShelfModel),
window_positioner_(new WindowPositioner),
activation_client_(nullptr),
#if defined(OS_CHROMEOS)
« ash/shelf/shelf.cc ('K') | « ash/shell.h ('k') | ash/shell/shelf_delegate_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698