| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef ASH_COMMON_SHELF_SHELF_MODEL_OBSERVER_H_ | 5 #ifndef ASH_COMMON_SHELF_SHELF_MODEL_OBSERVER_H_ |
| 6 #define ASH_COMMON_SHELF_SHELF_MODEL_OBSERVER_H_ | 6 #define ASH_COMMON_SHELF_SHELF_MODEL_OBSERVER_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/public/cpp/shelf_types.h" | 9 #include "ash/public/cpp/shelf_types.h" |
| 10 | 10 |
| 11 namespace ash { | 11 namespace ash { |
| 12 | 12 |
| 13 struct ShelfItem; | 13 struct ShelfItem; |
| 14 class ShelfItemDelegate; | |
| 15 | 14 |
| 16 class ASH_EXPORT ShelfModelObserver { | 15 class ASH_EXPORT ShelfModelObserver { |
| 17 public: | 16 public: |
| 18 // Invoked after an item has been added to the model. | 17 // Invoked after an item has been added to the model. |
| 19 virtual void ShelfItemAdded(int index) = 0; | 18 virtual void ShelfItemAdded(int index) = 0; |
| 20 | 19 |
| 21 // Invoked after an item has been removed from the model. |index| is the index | 20 // Invoked after an item has been removed from the model. |index| is the index |
| 22 // the item was at before removal, |old_item| is the item before removal. | 21 // the item was at before removal, |old_item| is the item before removal. |
| 23 virtual void ShelfItemRemoved(int index, const ShelfItem& old_item) = 0; | 22 virtual void ShelfItemRemoved(int index, const ShelfItem& old_item) = 0; |
| 24 | 23 |
| 25 // Invoked after an item has been moved. See ShelfModel::Move() for details | 24 // Invoked after an item has been moved. See ShelfModel::Move() for details |
| 26 // of the arguments. | 25 // of the arguments. |
| 27 virtual void ShelfItemMoved(int start_index, int target_index) = 0; | 26 virtual void ShelfItemMoved(int start_index, int target_index) = 0; |
| 28 | 27 |
| 29 // Invoked when the state of an item changes. |old_item| is the item | 28 // Invoked after an item changes. |old_item| is the item before the change. |
| 30 // before the change. | |
| 31 virtual void ShelfItemChanged(int index, const ShelfItem& old_item) = 0; | 29 virtual void ShelfItemChanged(int index, const ShelfItem& old_item) = 0; |
| 32 | 30 |
| 33 // Gets called when a ShelfItemDelegate gets changed. Note that | |
| 34 // |item_delegate| can be null. | |
| 35 // NOTE: This is added a temporary fix for M39 to fix crbug.com/429870. | |
| 36 // TODO(skuhne): Find the real reason for this problem and remove this fix. | |
| 37 virtual void OnSetShelfItemDelegate(ShelfID id, | |
| 38 ShelfItemDelegate* item_delegate) = 0; | |
| 39 | |
| 40 protected: | 31 protected: |
| 41 virtual ~ShelfModelObserver() {} | 32 virtual ~ShelfModelObserver() {} |
| 42 }; | 33 }; |
| 43 | 34 |
| 44 } // namespace ash | 35 } // namespace ash |
| 45 | 36 |
| 46 #endif // ASH_COMMON_SHELF_SHELF_MODEL_OBSERVER_H_ | 37 #endif // ASH_COMMON_SHELF_SHELF_MODEL_OBSERVER_H_ |
| OLD | NEW |