| 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> |
| 11 #include <memory> |
| 11 | 12 |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "chrome/browser/apps/drive/drive_app_uninstall_sync_service.h" | 15 #include "chrome/browser/apps/drive/drive_app_uninstall_sync_service.h" |
| 16 #include "chrome/browser/sync/glue/sync_start_util.h" | 16 #include "chrome/browser/sync/glue/sync_start_util.h" |
| 17 #include "components/keyed_service/core/keyed_service.h" | 17 #include "components/keyed_service/core/keyed_service.h" |
| 18 #include "sync/api/string_ordinal.h" | 18 #include "sync/api/string_ordinal.h" |
| 19 #include "sync/api/sync_change.h" | 19 #include "sync/api/sync_change.h" |
| 20 #include "sync/api/sync_change_processor.h" | 20 #include "sync/api/sync_change_processor.h" |
| 21 #include "sync/api/sync_error_factory.h" | 21 #include "sync/api/sync_error_factory.h" |
| 22 #include "sync/api/syncable_service.h" | 22 #include "sync/api/syncable_service.h" |
| 23 #include "sync/protocol/app_list_specifics.pb.h" | 23 #include "sync/protocol/app_list_specifics.pb.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 // Populates the model when |extension_system| is ready. | 66 // Populates the model when |extension_system| is ready. |
| 67 AppListSyncableService(Profile* profile, | 67 AppListSyncableService(Profile* profile, |
| 68 extensions::ExtensionSystem* extension_system); | 68 extensions::ExtensionSystem* extension_system); |
| 69 | 69 |
| 70 ~AppListSyncableService() override; | 70 ~AppListSyncableService() override; |
| 71 | 71 |
| 72 // Adds |item| to |sync_items_| and |model_|. If a sync item already exists, | 72 // Adds |item| to |sync_items_| and |model_|. If a sync item already exists, |
| 73 // updates the existing sync item instead. | 73 // updates the existing sync item instead. |
| 74 void AddItem(scoped_ptr<AppListItem> app_item); | 74 void AddItem(std::unique_ptr<AppListItem> app_item); |
| 75 | 75 |
| 76 // Removes sync item matching |id|. | 76 // Removes sync item matching |id|. |
| 77 void RemoveItem(const std::string& id); | 77 void RemoveItem(const std::string& id); |
| 78 | 78 |
| 79 // Removes sync item matching |id| after item uninstall. | 79 // Removes sync item matching |id| after item uninstall. |
| 80 void RemoveUninstalledItem(const std::string& id); | 80 void RemoveUninstalledItem(const std::string& id); |
| 81 | 81 |
| 82 // Called when properties of an item may have changed, e.g. default/oem state. | 82 // Called when properties of an item may have changed, e.g. default/oem state. |
| 83 void UpdateItem(AppListItem* app_item); | 83 void UpdateItem(AppListItem* app_item); |
| 84 | 84 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 95 size_t GetNumSyncItemsForTest(); | 95 size_t GetNumSyncItemsForTest(); |
| 96 const std::string& GetOemFolderNameForTest() const { | 96 const std::string& GetOemFolderNameForTest() const { |
| 97 return oem_folder_name_; | 97 return oem_folder_name_; |
| 98 } | 98 } |
| 99 void ResetDriveAppProviderForTest(); | 99 void ResetDriveAppProviderForTest(); |
| 100 | 100 |
| 101 // syncer::SyncableService | 101 // syncer::SyncableService |
| 102 syncer::SyncMergeResult MergeDataAndStartSyncing( | 102 syncer::SyncMergeResult MergeDataAndStartSyncing( |
| 103 syncer::ModelType type, | 103 syncer::ModelType type, |
| 104 const syncer::SyncDataList& initial_sync_data, | 104 const syncer::SyncDataList& initial_sync_data, |
| 105 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, | 105 std::unique_ptr<syncer::SyncChangeProcessor> sync_processor, |
| 106 scoped_ptr<syncer::SyncErrorFactory> error_handler) override; | 106 std::unique_ptr<syncer::SyncErrorFactory> error_handler) override; |
| 107 void StopSyncing(syncer::ModelType type) override; | 107 void StopSyncing(syncer::ModelType type) override; |
| 108 syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override; | 108 syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override; |
| 109 syncer::SyncError ProcessSyncChanges( | 109 syncer::SyncError ProcessSyncChanges( |
| 110 const tracked_objects::Location& from_here, | 110 const tracked_objects::Location& from_here, |
| 111 const syncer::SyncChangeList& change_list) override; | 111 const syncer::SyncChangeList& change_list) override; |
| 112 | 112 |
| 113 private: | 113 private: |
| 114 class ModelObserver; | 114 class ModelObserver; |
| 115 typedef std::map<std::string, SyncItem*> SyncItemMap; | 115 typedef std::map<std::string, SyncItem*> SyncItemMap; |
| 116 | 116 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 // Gets the location for the OEM folder. Called when the folder is first | 197 // Gets the location for the OEM folder. Called when the folder is first |
| 198 // created. | 198 // created. |
| 199 syncer::StringOrdinal GetOemFolderPos(); | 199 syncer::StringOrdinal GetOemFolderPos(); |
| 200 | 200 |
| 201 // Returns true if an extension matching |id| exists and was installed by | 201 // Returns true if an extension matching |id| exists and was installed by |
| 202 // an OEM (extension->was_installed_by_oem() is true). | 202 // an OEM (extension->was_installed_by_oem() is true). |
| 203 bool AppIsOem(const std::string& id); | 203 bool AppIsOem(const std::string& id); |
| 204 | 204 |
| 205 Profile* profile_; | 205 Profile* profile_; |
| 206 extensions::ExtensionSystem* extension_system_; | 206 extensions::ExtensionSystem* extension_system_; |
| 207 scoped_ptr<AppListModel> model_; | 207 std::unique_ptr<AppListModel> model_; |
| 208 scoped_ptr<ModelObserver> model_observer_; | 208 std::unique_ptr<ModelObserver> model_observer_; |
| 209 scoped_ptr<ModelPrefUpdater> model_pref_updater_; | 209 std::unique_ptr<ModelPrefUpdater> model_pref_updater_; |
| 210 scoped_ptr<ExtensionAppModelBuilder> apps_builder_; | 210 std::unique_ptr<ExtensionAppModelBuilder> apps_builder_; |
| 211 #if defined(OS_CHROMEOS) | 211 #if defined(OS_CHROMEOS) |
| 212 scoped_ptr<ArcAppModelBuilder> arc_apps_builder_; | 212 std::unique_ptr<ArcAppModelBuilder> arc_apps_builder_; |
| 213 #endif | 213 #endif |
| 214 scoped_ptr<syncer::SyncChangeProcessor> sync_processor_; | 214 std::unique_ptr<syncer::SyncChangeProcessor> sync_processor_; |
| 215 scoped_ptr<syncer::SyncErrorFactory> sync_error_handler_; | 215 std::unique_ptr<syncer::SyncErrorFactory> sync_error_handler_; |
| 216 SyncItemMap sync_items_; | 216 SyncItemMap sync_items_; |
| 217 syncer::SyncableService::StartSyncFlare flare_; | 217 syncer::SyncableService::StartSyncFlare flare_; |
| 218 bool initial_sync_data_processed_; | 218 bool initial_sync_data_processed_; |
| 219 bool first_app_list_sync_; | 219 bool first_app_list_sync_; |
| 220 std::string oem_folder_name_; | 220 std::string oem_folder_name_; |
| 221 | 221 |
| 222 // Provides integration with Drive apps. | 222 // Provides integration with Drive apps. |
| 223 scoped_ptr<DriveAppProvider> drive_app_provider_; | 223 std::unique_ptr<DriveAppProvider> drive_app_provider_; |
| 224 | 224 |
| 225 DISALLOW_COPY_AND_ASSIGN(AppListSyncableService); | 225 DISALLOW_COPY_AND_ASSIGN(AppListSyncableService); |
| 226 }; | 226 }; |
| 227 | 227 |
| 228 } // namespace app_list | 228 } // namespace app_list |
| 229 | 229 |
| 230 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SYNCABLE_SERVICE_H_ | 230 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SYNCABLE_SERVICE_H_ |
| OLD | NEW |