Index: ash/aura/wm_shelf_aura.cc |
diff --git a/ash/aura/wm_shelf_aura.cc b/ash/aura/wm_shelf_aura.cc |
index 25ffb6721edd3ad226d2f156a77043fc7d5f5d1e..533fe95bd472e235775994525011c47c5f4063e2 100644 |
--- a/ash/aura/wm_shelf_aura.cc |
+++ b/ash/aura/wm_shelf_aura.cc |
@@ -52,11 +52,16 @@ void WmShelfAura::ResetShelfLayoutManager() { |
} |
WmWindow* WmShelfAura::GetWindow() { |
- return WmWindowAura::Get(shelf_->shelf_widget()->GetNativeView()); |
+ // Use |shelf_layout_manager_| to access ShelfWidget because it is set |
+ // before |shelf_| is available. |
+ return shelf_layout_manager_ |
+ ? WmWindowAura::Get( |
+ shelf_layout_manager_->shelf_widget()->GetNativeView()) |
+ : nullptr; |
} |
ShelfAlignment WmShelfAura::GetAlignment() const { |
- return shelf_->alignment(); |
+ return shelf_ ? shelf_->alignment() : SHELF_ALIGNMENT_BOTTOM_LOCKED; |
} |
void WmShelfAura::SetAlignment(ShelfAlignment alignment) { |
@@ -64,15 +69,22 @@ void WmShelfAura::SetAlignment(ShelfAlignment alignment) { |
} |
ShelfAutoHideBehavior WmShelfAura::GetAutoHideBehavior() const { |
- return shelf_->auto_hide_behavior(); |
+ return shelf_ ? shelf_->auto_hide_behavior() : SHELF_AUTO_HIDE_BEHAVIOR_NEVER; |
} |
void WmShelfAura::SetAutoHideBehavior(ShelfAutoHideBehavior behavior) { |
shelf_->SetAutoHideBehavior(behavior); |
} |
+ShelfAutoHideState WmShelfAura::GetAutoHideState() const { |
+ return shelf_layout_manager_ ? shelf_layout_manager_->auto_hide_state() |
+ : SHELF_AUTO_HIDE_SHOWN; |
+} |
+ |
ShelfBackgroundType WmShelfAura::GetBackgroundType() const { |
- return shelf_->shelf_widget()->GetBackgroundType(); |
+ return shelf_layout_manager_ |
+ ? shelf_layout_manager_->shelf_widget()->GetBackgroundType() |
+ : SHELF_BACKGROUND_DEFAULT; |
} |
void WmShelfAura::UpdateVisibilityState() { |
@@ -84,6 +96,11 @@ ShelfVisibilityState WmShelfAura::GetVisibilityState() const { |
: SHELF_HIDDEN; |
} |
+gfx::Rect WmShelfAura::GetUserWorkAreaBounds() const { |
+ return shelf_layout_manager_ ? shelf_layout_manager_->user_work_area_bounds() |
+ : gfx::Rect(); |
+} |
+ |
void WmShelfAura::UpdateIconPositionForWindow(WmWindow* window) { |
shelf_->UpdateIconPositionForWindow(WmWindowAura::GetAuraWindow(window)); |
} |
@@ -117,6 +134,11 @@ void WmShelfAura::WillChangeVisibilityState(ShelfVisibilityState new_state) { |
WillChangeVisibilityState(new_state)); |
} |
+void WmShelfAura::OnAutoHideStateChanged(ShelfAutoHideState new_state) { |
+ FOR_EACH_OBSERVER(WmShelfObserver, observers_, |
+ OnAutoHideStateChanged(new_state)); |
+} |
+ |
void WmShelfAura::OnShelfIconPositionsChanged() { |
FOR_EACH_OBSERVER(WmShelfObserver, observers_, OnShelfIconPositionsChanged()); |
} |