Chromium Code Reviews| 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_item.h" | 9 #include "ash/public/cpp/shelf_item.h" |
| 10 #include "ash/public/cpp/shelf_item_delegate.h" | |
| 10 | 11 |
| 11 namespace ash { | 12 namespace ash { |
| 12 | 13 |
| 13 struct ShelfItem; | 14 struct ShelfItem; |
| 14 | 15 |
| 15 namespace mojom { | 16 namespace mojom { |
| 16 class ShelfItemDelegate; | 17 class ShelfItemDelegate; |
| 17 } | 18 } |
| 18 | 19 |
| 19 class ASH_EXPORT ShelfModelObserver { | 20 class ASH_EXPORT ShelfModelObserver { |
| 20 public: | 21 public: |
| 21 // Invoked after an item has been added to the model. | 22 // Invoked after an item has been added to the model. |
| 22 virtual void ShelfItemAdded(int index) = 0; | 23 virtual void ShelfItemAdded(int index) = 0; |
| 23 | 24 |
| 24 // Invoked after an item has been removed from the model. |index| is the index | 25 // Invoked after an item has been removed from the model. |index| is the index |
| 25 // the item was at before removal, |old_item| is the item before removal. | 26 // the item was at before removal, |old_item| is the item before removal. |
| 26 virtual void ShelfItemRemoved(int index, const ShelfItem& old_item) = 0; | 27 virtual void ShelfItemRemoved(int index, const ShelfItem& old_item) = 0; |
| 27 | 28 |
| 28 // Invoked after an item has been moved. See ShelfModel::Move() for details | 29 // Invoked after an item has been moved. See ShelfModel::Move() for details |
| 29 // of the arguments. | 30 // of the arguments. |
| 30 virtual void ShelfItemMoved(int start_index, int target_index) = 0; | 31 virtual void ShelfItemMoved(int start_index, int target_index) = 0; |
| 31 | 32 |
| 32 // Invoked when the state of an item changes. |old_item| is the item | 33 // Invoked when the state of an item changes. |old_item| is the item |
| 33 // before the change. | 34 // before the change. |
| 34 virtual void ShelfItemChanged(int index, const ShelfItem& old_item) = 0; | 35 virtual void ShelfItemChanged(int index, const ShelfItem& old_item) = 0; |
| 35 | 36 |
| 36 // Gets called when a ShelfItemDelegate gets changed. Note that | 37 // Gets called when a ShelfItemDelegate gets changed. Note that |
| 37 // |item_delegate| can be null. | 38 // |item_delegate| can be null. |
| 38 // NOTE: This is added a temporary fix for M39 to fix crbug.com/429870. | 39 // NOTE: This is added a temporary fix for M39 to fix crbug.com/429870. |
| 39 // TODO(skuhne): Find the real reason for this problem and remove this fix. | 40 // TODO(skuhne): Find the real reason for this problem and remove this fix. |
|
James Cook
2017/04/04 15:34:44
Aside: I wonder if this problem will go away. At s
msw
2017/04/04 18:53:09
I plan to remove the map in my next CL, that shoul
| |
| 40 virtual void OnSetShelfItemDelegate( | 41 virtual void OnSetShelfItemDelegate(ShelfID id, |
| 41 ShelfID id, | 42 ShelfItemDelegate* item_delegate) = 0; |
|
James Cook
2017/04/04 15:34:44
forward declare
msw
2017/04/04 18:53:09
Done.
| |
| 42 mojom::ShelfItemDelegate* item_delegate) = 0; | |
| 43 | 43 |
| 44 protected: | 44 protected: |
| 45 virtual ~ShelfModelObserver() {} | 45 virtual ~ShelfModelObserver() {} |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 } // namespace ash | 48 } // namespace ash |
| 49 | 49 |
| 50 #endif // ASH_COMMON_SHELF_SHELF_MODEL_OBSERVER_H_ | 50 #endif // ASH_COMMON_SHELF_SHELF_MODEL_OBSERVER_H_ |
| OLD | NEW |