OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/common/shelf/shelf.h" | 5 #include "ash/common/shelf/shelf.h" |
6 #include "ash/common/shelf/shelf_delegate.h" | 6 #include "ash/common/shelf/shelf_delegate.h" |
7 #include "ash/common/shelf/shelf_layout_manager.h" | 7 #include "ash/common/shelf/shelf_layout_manager.h" |
8 #include "ash/common/shelf/shelf_locking_manager.h" | 8 #include "ash/common/shelf/shelf_locking_manager.h" |
9 #include "ash/common/shelf/shelf_widget.h" | 9 #include "ash/common/shelf/shelf_widget.h" |
10 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 if (shelf_locking_manager_->is_locked() && | 56 if (shelf_locking_manager_->is_locked() && |
57 alignment != SHELF_ALIGNMENT_BOTTOM_LOCKED) { | 57 alignment != SHELF_ALIGNMENT_BOTTOM_LOCKED) { |
58 shelf_locking_manager_->set_stored_alignment(alignment); | 58 shelf_locking_manager_->set_stored_alignment(alignment); |
59 return; | 59 return; |
60 } | 60 } |
61 | 61 |
62 alignment_ = alignment; | 62 alignment_ = alignment; |
63 // The ShelfWidget notifies the ShelfView of the alignment change. | 63 // The ShelfWidget notifies the ShelfView of the alignment change. |
64 shelf_layout_manager_->shelf_widget()->OnShelfAlignmentChanged(); | 64 shelf_layout_manager_->shelf_widget()->OnShelfAlignmentChanged(); |
65 WmShell::Get()->shelf_delegate()->OnShelfAlignmentChanged(shelf_); | 65 WmShell::Get()->shelf_delegate()->OnShelfAlignmentChanged(this); |
66 WmShell::Get()->NotifyShelfAlignmentChanged(GetWindow()->GetRootWindow()); | 66 WmShell::Get()->NotifyShelfAlignmentChanged(GetWindow()->GetRootWindow()); |
67 // ShelfLayoutManager will resize the shelf. | 67 // ShelfLayoutManager will resize the shelf. |
68 } | 68 } |
69 | 69 |
70 bool WmShelf::IsHorizontalAlignment() const { | 70 bool WmShelf::IsHorizontalAlignment() const { |
71 switch (alignment_) { | 71 switch (alignment_) { |
72 case SHELF_ALIGNMENT_BOTTOM: | 72 case SHELF_ALIGNMENT_BOTTOM: |
73 case SHELF_ALIGNMENT_BOTTOM_LOCKED: | 73 case SHELF_ALIGNMENT_BOTTOM_LOCKED: |
74 return true; | 74 return true; |
75 case SHELF_ALIGNMENT_LEFT: | 75 case SHELF_ALIGNMENT_LEFT: |
(...skipping 24 matching lines...) Expand all Loading... |
100 return IsHorizontalAlignment() ? horizontal : vertical; | 100 return IsHorizontalAlignment() ? horizontal : vertical; |
101 } | 101 } |
102 | 102 |
103 void WmShelf::SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide_behavior) { | 103 void WmShelf::SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide_behavior) { |
104 DCHECK(shelf_layout_manager_); | 104 DCHECK(shelf_layout_manager_); |
105 | 105 |
106 if (auto_hide_behavior_ == auto_hide_behavior) | 106 if (auto_hide_behavior_ == auto_hide_behavior) |
107 return; | 107 return; |
108 | 108 |
109 auto_hide_behavior_ = auto_hide_behavior; | 109 auto_hide_behavior_ = auto_hide_behavior; |
110 WmShell::Get()->shelf_delegate()->OnShelfAutoHideBehaviorChanged(shelf_); | 110 WmShell::Get()->shelf_delegate()->OnShelfAutoHideBehaviorChanged(this); |
111 WmShell::Get()->NotifyShelfAutoHideBehaviorChanged( | 111 WmShell::Get()->NotifyShelfAutoHideBehaviorChanged( |
112 GetWindow()->GetRootWindow()); | 112 GetWindow()->GetRootWindow()); |
113 } | 113 } |
114 | 114 |
115 ShelfAutoHideState WmShelf::GetAutoHideState() const { | 115 ShelfAutoHideState WmShelf::GetAutoHideState() const { |
116 return shelf_layout_manager_->auto_hide_state(); | 116 return shelf_layout_manager_->auto_hide_state(); |
117 } | 117 } |
118 | 118 |
119 void WmShelf::UpdateAutoHideState() { | 119 void WmShelf::UpdateAutoHideState() { |
120 shelf_layout_manager_->UpdateAutoHideState(); | 120 shelf_layout_manager_->UpdateAutoHideState(); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 | 224 |
225 void WmShelf::OnBackgroundUpdated(ShelfBackgroundType background_type, | 225 void WmShelf::OnBackgroundUpdated(ShelfBackgroundType background_type, |
226 BackgroundAnimatorChangeType change_type) { | 226 BackgroundAnimatorChangeType change_type) { |
227 if (background_type == GetBackgroundType()) | 227 if (background_type == GetBackgroundType()) |
228 return; | 228 return; |
229 FOR_EACH_OBSERVER(WmShelfObserver, observers_, | 229 FOR_EACH_OBSERVER(WmShelfObserver, observers_, |
230 OnBackgroundTypeChanged(background_type, change_type)); | 230 OnBackgroundTypeChanged(background_type, change_type)); |
231 } | 231 } |
232 | 232 |
233 } // namespace ash | 233 } // namespace ash |
OLD | NEW |