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

Unified Diff: ash/shelf/shelf_layout_manager.h

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/shelf/shelf_layout_manager.h
diff --git a/ash/shelf/shelf_layout_manager.h b/ash/shelf/shelf_layout_manager.h
index 7628b1340b4cd900670579955ef0de72fe5a3c83..bfeda23c25bd4ad5703bc1d3a018ba36be79e6e2 100644
--- a/ash/shelf/shelf_layout_manager.h
+++ b/ash/shelf/shelf_layout_manager.h
@@ -84,19 +84,6 @@ class ASH_EXPORT ShelfLayoutManager
explicit ShelfLayoutManager(ShelfWidget* shelf);
~ShelfLayoutManager() override;
- // Sets the ShelfAutoHideBehavior. See enum description for details.
- void SetAutoHideBehavior(ShelfAutoHideBehavior behavior);
- ShelfAutoHideBehavior auto_hide_behavior() const {
- return auto_hide_behavior_;
- }
-
- // Sets the alignment; changes are delayed if the screen is locked.
- void SetAlignment(ShelfAlignment alignment);
-
- // Returns the desired alignment for the current state, either the user's
- // selected alignment or SHELF_ALIGNMENT_BOTTOM when the screen is locked.
- ShelfAlignment GetAlignment() const;
-
void set_workspace_controller(WorkspaceController* controller) {
workspace_controller_ = controller;
}
@@ -168,6 +155,8 @@ class ASH_EXPORT ShelfLayoutManager
// Overridden from ash::ShellObserver:
void OnLockStateChanged(bool locked) override;
+ void OnShelfAlignmentChanged(aura::Window* root_window) override;
+ void OnShelfAutoHideBehaviorChanged(aura::Window* root_window) override;
// Overriden from aura::client::ActivationChangeObserver:
void OnWindowActivated(
@@ -181,10 +170,22 @@ class ASH_EXPORT ShelfLayoutManager
// Overridden from ash::SessionStateObserver:
void SessionStateChanged(SessionStateDelegate::SessionState state) override;
- // TODO(harrym|oshima): These templates will be moved to
- // new Shelf class.
- // A helper function that provides a shortcut for choosing
- // values specific to a shelf alignment.
+ // TODO(msw): Remove these accessors, kept temporarily to simplify changes.
+ void SetAutoHideBehavior(ShelfAutoHideBehavior behavior) {
+ shelf_->shelf()->SetAutoHideBehavior(behavior);
+ }
+ ShelfAutoHideBehavior auto_hide_behavior() const {
+ return shelf_->shelf()->GetAutoHideBehavior();
+ }
+
+ // TODO(msw): Remove these accessors, kept temporarily to simplify changes.
+ void SetAlignment(ShelfAlignment alignment) {
+ shelf_->shelf()->SetAlignment(alignment);
+ }
+ ShelfAlignment GetAlignment() const { return shelf_->GetAlignment(); }
+
+ // TODO(harrym|oshima): These templates will be moved to a new Shelf class.
+ // A helper function for choosing values specific to a shelf alignment.
template <typename T>
T SelectValueForShelfAlignment(T bottom, T left, T right) const {
switch (GetAlignment()) {
@@ -207,6 +208,11 @@ class ASH_EXPORT ShelfLayoutManager
// Is the shelf's alignment horizontal?
bool IsHorizontalAlignment() const;
+ // Returns true when the alignment is locked. This can be caused by the screen
+ // being locked, or when adding a user. Returns false when transitioning to a
+ // user session, and while the session is active.
+ bool IsAlignmentLocked() const;
+
// Set the height of the ChromeVox panel, which takes away space from the
// available work area from the top of the screen.
void SetChromeVoxPanelHeight(int height);
@@ -321,11 +327,6 @@ class ASH_EXPORT ShelfLayoutManager
// Called when the LoginUI changes from visible to invisible.
void UpdateShelfVisibilityAfterLoginUIChange();
- // Returns true when |alignment_| is locked. This can be caused by the screen
- // being locked, or when adding a user. Returns false when transitioning to a
- // user session, and while the session is active.
- bool IsAlignmentLocked() const;
-
// The RootWindow is cached so that we don't invoke Shell::GetInstance() from
// our destructor. We avoid that as at the time we're deleted Shell is being
// deleted too.
@@ -335,12 +336,6 @@ class ASH_EXPORT ShelfLayoutManager
// UpdateBoundsAndOpacity() again from SetChildBounds().
bool updating_bounds_;
- // See description above setter.
- ShelfAutoHideBehavior auto_hide_behavior_;
-
- // See description above getter.
- ShelfAlignment alignment_;
-
// Current state.
State state_;

Powered by Google App Engine
This is Rietveld 408576698