| 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_SHELF_SHELF_ITEM_DELEGATE_MANAGER_H_ | 5 #ifndef ASH_SHELF_SHELF_ITEM_DELEGATE_MANAGER_H_ |
| 6 #define ASH_SHELF_SHELF_ITEM_DELEGATE_MANAGER_H_ | 6 #define ASH_SHELF_SHELF_ITEM_DELEGATE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
| 9 | 10 |
| 10 #include "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
| 11 #include "ash/shelf/shelf_item_types.h" | 12 #include "ash/shelf/shelf_item_types.h" |
| 12 #include "ash/shelf/shelf_model_observer.h" | 13 #include "ash/shelf/shelf_model_observer.h" |
| 13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 15 #include "base/memory/scoped_ptr.h" | |
| 16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
| 17 | 17 |
| 18 namespace ash { | 18 namespace ash { |
| 19 class ShelfItemDelegate; | 19 class ShelfItemDelegate; |
| 20 class ShelfModel; | 20 class ShelfModel; |
| 21 | 21 |
| 22 namespace test { | 22 namespace test { |
| 23 class ShelfItemDelegateManagerTestAPI; | 23 class ShelfItemDelegateManagerTestAPI; |
| 24 } | 24 } |
| 25 | 25 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 44 class ASH_EXPORT ShelfItemDelegateManager : public ShelfModelObserver { | 44 class ASH_EXPORT ShelfItemDelegateManager : public ShelfModelObserver { |
| 45 public: | 45 public: |
| 46 explicit ShelfItemDelegateManager(ShelfModel* model); | 46 explicit ShelfItemDelegateManager(ShelfModel* model); |
| 47 ~ShelfItemDelegateManager() override; | 47 ~ShelfItemDelegateManager() override; |
| 48 | 48 |
| 49 void AddObserver(ShelfItemDelegateManagerObserver* observer); | 49 void AddObserver(ShelfItemDelegateManagerObserver* observer); |
| 50 void RemoveObserver(ShelfItemDelegateManagerObserver* observer); | 50 void RemoveObserver(ShelfItemDelegateManagerObserver* observer); |
| 51 | 51 |
| 52 // Set |item_delegate| for |id| and take an ownership. | 52 // Set |item_delegate| for |id| and take an ownership. |
| 53 void SetShelfItemDelegate(ShelfID id, | 53 void SetShelfItemDelegate(ShelfID id, |
| 54 scoped_ptr<ShelfItemDelegate> item_delegate); | 54 std::unique_ptr<ShelfItemDelegate> item_delegate); |
| 55 | 55 |
| 56 // Returns ShelfItemDelegate for |item_type|. Always returns non-NULL. | 56 // Returns ShelfItemDelegate for |item_type|. Always returns non-NULL. |
| 57 ShelfItemDelegate* GetShelfItemDelegate(ShelfID id); | 57 ShelfItemDelegate* GetShelfItemDelegate(ShelfID id); |
| 58 | 58 |
| 59 // ShelfModelObserver overrides: | 59 // ShelfModelObserver overrides: |
| 60 void ShelfItemAdded(int model_index) override; | 60 void ShelfItemAdded(int model_index) override; |
| 61 void ShelfItemRemoved(int index, ShelfID id) override; | 61 void ShelfItemRemoved(int index, ShelfID id) override; |
| 62 void ShelfItemMoved(int start_index, int targetindex) override; | 62 void ShelfItemMoved(int start_index, int targetindex) override; |
| 63 void ShelfItemChanged(int index, const ShelfItem& old_item) override; | 63 void ShelfItemChanged(int index, const ShelfItem& old_item) override; |
| 64 | 64 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 76 ShelfIDToItemDelegateMap id_to_item_delegate_map_; | 76 ShelfIDToItemDelegateMap id_to_item_delegate_map_; |
| 77 | 77 |
| 78 base::ObserverList<ShelfItemDelegateManagerObserver> observers_; | 78 base::ObserverList<ShelfItemDelegateManagerObserver> observers_; |
| 79 | 79 |
| 80 DISALLOW_COPY_AND_ASSIGN(ShelfItemDelegateManager); | 80 DISALLOW_COPY_AND_ASSIGN(ShelfItemDelegateManager); |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 } // namespace ash | 83 } // namespace ash |
| 84 | 84 |
| 85 #endif // ASH_SHELF_SHELF_ITEM_DELEGATE_MANAGER_H_ | 85 #endif // ASH_SHELF_SHELF_ITEM_DELEGATE_MANAGER_H_ |
| OLD | NEW |