| 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/app_list_shelf_item_delegate.h" | 7 #include "ash/common/shelf/app_list_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_shell.h" | 9 #include "ash/common/wm_shell.h" |
| 10 #include "ash/common/wm_window.h" | 10 #include "ash/common/wm_window.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 void ShelfController::AddObserver( | 87 void ShelfController::AddObserver( |
| 88 mojom::ShelfObserverAssociatedPtrInfo observer) { | 88 mojom::ShelfObserverAssociatedPtrInfo observer) { |
| 89 mojom::ShelfObserverAssociatedPtr observer_ptr; | 89 mojom::ShelfObserverAssociatedPtr observer_ptr; |
| 90 observer_ptr.Bind(std::move(observer)); | 90 observer_ptr.Bind(std::move(observer)); |
| 91 observers_.AddPtr(std::move(observer_ptr)); | 91 observers_.AddPtr(std::move(observer_ptr)); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void ShelfController::SetAlignment(ShelfAlignment alignment, | 94 void ShelfController::SetAlignment(ShelfAlignment alignment, |
| 95 int64_t display_id) { | 95 int64_t display_id) { |
| 96 if (!ash::WmShelf::CanChangeShelfAlignment()) | |
| 97 return; | |
| 98 | |
| 99 WmShelf* shelf = GetShelfForDisplay(display_id); | 96 WmShelf* shelf = GetShelfForDisplay(display_id); |
| 100 // TODO(jamescook): The initialization check should not be necessary, but | 97 // TODO(jamescook): The initialization check should not be necessary, but |
| 101 // otherwise this wrongly tries to set the alignment on a secondary display | 98 // otherwise this wrongly tries to set the alignment on a secondary display |
| 102 // during login before the ShelfLockingManager and ShelfView are created. | 99 // during login before the ShelfLockingManager and ShelfView are created. |
| 103 if (shelf && shelf->IsShelfInitialized()) | 100 if (shelf && shelf->IsShelfInitialized()) |
| 104 shelf->SetAlignment(alignment); | 101 shelf->SetAlignment(alignment); |
| 105 } | 102 } |
| 106 | 103 |
| 107 void ShelfController::SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide, | 104 void ShelfController::SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide, |
| 108 int64_t display_id) { | 105 int64_t display_id) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 130 return; | 127 return; |
| 131 ShelfID shelf_id = app_id_to_shelf_id_[app_id]; | 128 ShelfID shelf_id = app_id_to_shelf_id_[app_id]; |
| 132 int index = model_.ItemIndexByID(shelf_id); | 129 int index = model_.ItemIndexByID(shelf_id); |
| 133 DCHECK_GE(index, 0); | 130 DCHECK_GE(index, 0); |
| 134 ShelfItem item = *model_.ItemByID(shelf_id); | 131 ShelfItem item = *model_.ItemByID(shelf_id); |
| 135 item.image = GetShelfIconFromBitmap(image); | 132 item.image = GetShelfIconFromBitmap(image); |
| 136 model_.Set(index, item); | 133 model_.Set(index, item); |
| 137 } | 134 } |
| 138 | 135 |
| 139 } // namespace ash | 136 } // namespace ash |
| OLD | NEW |