Chromium Code Reviews| Index: chrome/browser/ui/app_list/app_list_syncable_service.h |
| diff --git a/chrome/browser/ui/app_list/app_list_syncable_service.h b/chrome/browser/ui/app_list/app_list_syncable_service.h |
| index 7900f3f664833b85aa6288a0a3d50d218c706599..1548a367e6b5b4fd5d4a38ef0ed5dea08738e035 100644 |
| --- a/chrome/browser/ui/app_list/app_list_syncable_service.h |
| +++ b/chrome/browser/ui/app_list/app_list_syncable_service.h |
| @@ -11,6 +11,7 @@ |
| #include <memory> |
| #include "base/macros.h" |
| +#include "base/memory/weak_ptr.h" |
| #include "base/observer_list.h" |
| #include "build/build_config.h" |
| #include "chrome/browser/apps/drive/drive_app_uninstall_sync_service.h" |
| @@ -39,6 +40,10 @@ namespace sync_pb { |
| class AppListSpecifics; |
| } |
| +namespace user_prefs { |
| +class PrefRegistrySyncable; |
| +} |
| + |
| namespace app_list { |
| class AppListFolderItem; |
| @@ -81,6 +86,9 @@ class AppListSyncableService : public syncer::SyncableService, |
| ~AppListSyncableService() override; |
| + // Registers prefs to support local storage. |
| + static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| + |
| // Adds |item| to |sync_items_| and |model_|. If a sync item already exists, |
| // updates the existing sync item instead. |
| void AddItem(std::unique_ptr<AppListItem> app_item); |
| @@ -110,9 +118,12 @@ class AppListSyncableService : public syncer::SyncableService, |
| void SetPinPosition(const std::string& app_id, |
| const syncer::StringOrdinal& item_pin_ordinal); |
| - // Gets the app list model, building it if it doesn't yet exist. |
| + // Gets the app list model. |
| AppListModel* GetModel(); |
| + // Returns true if this service was initialized. |
| + bool IsInited() const; |
|
stevenjb
2016/10/25 16:21:32
IsInitialized()
|
| + |
| // Registers new observers and makes sure that service is started. |
| void AddObserverAndStart(Observer* observer); |
| void RemoveObserver(Observer* observer); |
| @@ -229,9 +240,20 @@ class AppListSyncableService : public syncer::SyncableService, |
| // an OEM (extension->was_installed_by_oem() is true). |
| bool AppIsOem(const std::string& id); |
| + // Initializes sync items from the local storage while sync service is not |
| + // enabled. |
| + void InitFromLocalStorage(); |
| + |
| // Helper that notifies observers that sync model has been updated. |
| void NotifyObserversSyncUpdated(); |
| + // Handles model update start/finish. |
| + void HandleUpdateStarted(); |
| + void HandleUpdateFinished(); |
| + |
| + // Returns true if extension service is ready. |
| + bool IsExtensionServiceReady() const; |
| + |
| Profile* profile_; |
| extensions::ExtensionSystem* extension_system_; |
| std::unique_ptr<AppListModel> model_; |
| @@ -254,6 +276,8 @@ class AppListSyncableService : public syncer::SyncableService, |
| // Provides integration with Drive apps. |
| std::unique_ptr<DriveAppProvider> drive_app_provider_; |
| + base::WeakPtrFactory<AppListSyncableService> weak_ptr_factory_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(AppListSyncableService); |
| }; |