| 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_controller.h" | 5 #include "ash/common/shelf/shelf_controller.h" |
| 6 | 6 |
| 7 #include "ash/common/shelf/shelf_item_delegate.h" | 7 #include "ash/common/shelf/shelf_item_delegate.h" |
| 8 #include "ash/common/shelf/wm_shelf.h" | 8 #include "ash/common/shelf/wm_shelf.h" |
| 9 #include "ash/common/wm_lookup.h" | 9 #include "ash/common/wm_lookup.h" |
| 10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 156 |
| 157 void ShelfController::AddObserver( | 157 void ShelfController::AddObserver( |
| 158 mojom::ShelfObserverAssociatedPtrInfo observer) { | 158 mojom::ShelfObserverAssociatedPtrInfo observer) { |
| 159 mojom::ShelfObserverAssociatedPtr observer_ptr; | 159 mojom::ShelfObserverAssociatedPtr observer_ptr; |
| 160 observer_ptr.Bind(std::move(observer)); | 160 observer_ptr.Bind(std::move(observer)); |
| 161 observers_.AddPtr(std::move(observer_ptr)); | 161 observers_.AddPtr(std::move(observer_ptr)); |
| 162 } | 162 } |
| 163 | 163 |
| 164 void ShelfController::SetAlignment(ShelfAlignment alignment, | 164 void ShelfController::SetAlignment(ShelfAlignment alignment, |
| 165 int64_t display_id) { | 165 int64_t display_id) { |
| 166 if (!ash::WmShelf::CanChangeShelfAlignment()) | |
| 167 return; | |
| 168 | |
| 169 WmShelf* shelf = GetShelfForDisplay(display_id); | 166 WmShelf* shelf = GetShelfForDisplay(display_id); |
| 170 // TODO(jamescook): The initialization check should not be necessary, but | 167 // TODO(jamescook): The initialization check should not be necessary, but |
| 171 // otherwise this wrongly tries to set the alignment on a secondary display | 168 // otherwise this wrongly tries to set the alignment on a secondary display |
| 172 // during login before the ShelfLockingManager and ShelfView are created. | 169 // during login before the ShelfLockingManager and ShelfView are created. |
| 173 if (shelf && shelf->IsShelfInitialized()) | 170 if (shelf && shelf->IsShelfInitialized()) |
| 174 shelf->SetAlignment(alignment); | 171 shelf->SetAlignment(alignment); |
| 175 } | 172 } |
| 176 | 173 |
| 177 void ShelfController::SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide, | 174 void ShelfController::SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide, |
| 178 int64_t display_id) { | 175 int64_t display_id) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 return; | 232 return; |
| 236 ShelfID shelf_id = app_id_to_shelf_id_[app_id]; | 233 ShelfID shelf_id = app_id_to_shelf_id_[app_id]; |
| 237 int index = model_.ItemIndexByID(shelf_id); | 234 int index = model_.ItemIndexByID(shelf_id); |
| 238 DCHECK_GE(index, 0); | 235 DCHECK_GE(index, 0); |
| 239 ShelfItem item = *model_.ItemByID(shelf_id); | 236 ShelfItem item = *model_.ItemByID(shelf_id); |
| 240 item.image = GetShelfIconFromBitmap(image); | 237 item.image = GetShelfIconFromBitmap(image); |
| 241 model_.Set(index, item); | 238 model_.Set(index, item); |
| 242 } | 239 } |
| 243 | 240 |
| 244 } // namespace ash | 241 } // namespace ash |
| OLD | NEW |