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 CHROME_BROWSER_UI_APP_LIST_APP_LIST_SYNCABLE_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_SYNCABLE_SERVICE_H_ |
6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SYNCABLE_SERVICE_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SYNCABLE_SERVICE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 class Observer { | 68 class Observer { |
69 public: | 69 public: |
70 // Notifies that sync model was updated. | 70 // Notifies that sync model was updated. |
71 virtual void OnSyncModelUpdated() = 0; | 71 virtual void OnSyncModelUpdated() = 0; |
72 | 72 |
73 protected: | 73 protected: |
74 virtual ~Observer() = default; | 74 virtual ~Observer() = default; |
75 }; | 75 }; |
76 | 76 |
77 using SyncItemMap = std::map<std::string, SyncItem*>; | 77 using SyncItemMap = std::map<std::string, std::unique_ptr<SyncItem>>; |
78 | 78 |
79 // Populates the model when |extension_system| is ready. | 79 // Populates the model when |extension_system| is ready. |
80 AppListSyncableService(Profile* profile, | 80 AppListSyncableService(Profile* profile, |
81 extensions::ExtensionSystem* extension_system); | 81 extensions::ExtensionSystem* extension_system); |
82 | 82 |
83 ~AppListSyncableService() override; | 83 ~AppListSyncableService() override; |
84 | 84 |
85 // Adds |item| to |sync_items_| and |model_|. If a sync item already exists, | 85 // Adds |item| to |sync_items_| and |model_|. If a sync item already exists, |
86 // updates the existing sync item instead. | 86 // updates the existing sync item instead. |
87 void AddItem(std::unique_ptr<AppListItem> app_item); | 87 void AddItem(std::unique_ptr<AppListItem> app_item); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 // If a sync item for |app_item| already exists, update |app_item| from the | 166 // If a sync item for |app_item| already exists, update |app_item| from the |
167 // sync item, otherwise create a new sync item from |app_item|. | 167 // sync item, otherwise create a new sync item from |app_item|. |
168 void AddOrUpdateFromSyncItem(AppListItem* app_item); | 168 void AddOrUpdateFromSyncItem(AppListItem* app_item); |
169 | 169 |
170 // Either uninstalling a default app or remove the REMOVE_DEFAULT sync item. | 170 // Either uninstalling a default app or remove the REMOVE_DEFAULT sync item. |
171 // Returns true if the app is removed. Otherwise deletes the existing sync | 171 // Returns true if the app is removed. Otherwise deletes the existing sync |
172 // item and returns false. | 172 // item and returns false. |
173 bool RemoveDefaultApp(AppListItem* item, SyncItem* sync_item); | 173 bool RemoveDefaultApp(AppListItem* item, SyncItem* sync_item); |
174 | 174 |
175 // Deletes a sync item from |sync_items_| and sends a DELETE action. | 175 // Deletes a sync item from |sync_items_| and sends a DELETE action. |
176 void DeleteSyncItem(SyncItem* sync_item); | 176 void DeleteSyncItem(const std::string& item_id); |
177 | 177 |
178 // Updates existing entry in |sync_items_| from |app_item|. | 178 // Updates existing entry in |sync_items_| from |app_item|. |
179 void UpdateSyncItem(AppListItem* app_item); | 179 void UpdateSyncItem(AppListItem* app_item); |
180 | 180 |
181 // Removes sync item matching |id|. | 181 // Removes sync item matching |id|. |
182 void RemoveSyncItem(const std::string& id); | 182 void RemoveSyncItem(const std::string& id); |
183 | 183 |
184 // Updates folder items that may get created during initial sync. | 184 // Updates folder items that may get created during initial sync. |
185 void ResolveFolderPositions(); | 185 void ResolveFolderPositions(); |
186 | 186 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 255 |
256 // Provides integration with Drive apps. | 256 // Provides integration with Drive apps. |
257 std::unique_ptr<DriveAppProvider> drive_app_provider_; | 257 std::unique_ptr<DriveAppProvider> drive_app_provider_; |
258 | 258 |
259 DISALLOW_COPY_AND_ASSIGN(AppListSyncableService); | 259 DISALLOW_COPY_AND_ASSIGN(AppListSyncableService); |
260 }; | 260 }; |
261 | 261 |
262 } // namespace app_list | 262 } // namespace app_list |
263 | 263 |
264 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SYNCABLE_SERVICE_H_ | 264 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SYNCABLE_SERVICE_H_ |
OLD | NEW |