Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Unified Diff: chrome/browser/ui/app_list/app_list_syncable_service.h

Issue 118463002: Sync removal of Default apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 b72d3a7920c5d3884c737e25b92e3c388db09f58..6b928a001e348b775572857fee1d53270693fd31 100644
--- a/chrome/browser/ui/app_list/app_list_syncable_service.h
+++ b/chrome/browser/ui/app_list/app_list_syncable_service.h
@@ -19,7 +19,6 @@
#include "sync/api/syncable_service.h"
#include "sync/protocol/app_list_specifics.pb.h"
-class ExtensionAppItem;
class ExtensionAppModelBuilder;
class ExtensionService;
tapted 2013/12/19 01:20:57 nit: this foward-dec probably isn't needed any lon
stevenjb 2013/12/19 01:48:44 Done.
class Profile;
@@ -33,8 +32,7 @@ namespace app_list {
class AppListModel;
class AppListItemModel;
-// Keyed Service that owns, stores, and syncs an AppListModel for an
-// ExtensionSystem and corresponding profile.
+// Keyed Service that owns, stores, and syncs an AppListModel for a profile.
class AppListSyncableService : public syncer::SyncableService,
public BrowserContextKeyedService,
public content::NotificationObserver {
@@ -53,18 +51,17 @@ class AppListSyncableService : public syncer::SyncableService,
std::string ToString() const;
};
- // Create an empty model. Then, if |extension_service| is non-NULL and ready,
- // populate it. Otherwise populate the model once extensions become ready.
- AppListSyncableService(Profile* profile, ExtensionService* extension_service);
+ // Populates the model when the extension service is ready.
+ explicit AppListSyncableService(Profile* profile);
virtual ~AppListSyncableService();
- // Adds |item| to |sync_items_| and |model_|. Does noting if a sync item
+ // Adds |item| to |sync_items_| and |model_|. Does nothing if a sync item
// already exists.
- void AddExtensionAppItem(ExtensionAppItem* item);
+ void AddItem(AppListItemModel* item);
// Updates existing entry in |sync_items_| from |item|.
- void UpdateExtensionAppItem(ExtensionAppItem* item);
+ void UpdateItem(AppListItemModel* item);
// Removes sync item matching |id|.
void RemoveItem(const std::string& id);
@@ -100,15 +97,19 @@ class AppListSyncableService : public syncer::SyncableService,
// Builds the model once ExtensionService is ready.
void BuildModel();
- // Creates a new Appitem from |sync_item| and adds it to the model.
- void CreateAppItemFromSyncItem(SyncItem* sync_item);
-
// Returns true if sync has restarted, otherwise runs |flare_|.
bool SyncStarted();
- // Creates a SyncItem entry and adds |item| to the model.
- SyncItem* AddItem(sync_pb::AppListSpecifics::AppListItemType type,
- AppListItemModel* item);
+ // Creates or updates a SyncItem from |specifics|. Returns true if a new item
+ // was created.
+ bool ProcessSyncItem(const sync_pb::AppListSpecifics& specifics);
+
+ // Handles a newly created sync item (e.g. creates a new Appitem and adds it
+ // to the model or uninstalls a deleted default item.
+ void ProcessNewSyncItem(SyncItem* sync_item);
+
+ // Handles updating an existing sync item (e.g. updates item positions).
+ void ProcessExistingSyncItem(SyncItem* sync_item);
// Sends ADD or CHANGED for sync item.
void SendSyncChange(SyncItem* sync_item,
@@ -117,16 +118,10 @@ class AppListSyncableService : public syncer::SyncableService,
// Returns an existing SyncItem corresponding to |item_id| or NULL.
SyncItem* FindSyncItem(const std::string& item_id);
- // Returns a SyncItem corresponding to |item_id|. Sets |new_item| if an item
- // was created.
- SyncItem* FindOrCreateSyncItem(
+ // Creates a new sync item for |item_id|.
+ SyncItem* CreateSyncItem(
const std::string& item_id,
- sync_pb::AppListSpecifics::AppListItemType type,
- bool* new_item);
-
- // Creates or updates a SyncItem from |specifics|. Returns true if an item
- // was created.
- bool CreateOrUpdateSyncItem(const sync_pb::AppListSpecifics& specifics);
+ sync_pb::AppListSpecifics::AppListItemType item_type);
// Deletes a SyncItem matching |specifics|.
void DeleteSyncItem(const sync_pb::AppListSpecifics& specifics);

Powered by Google App Engine
This is Rietveld 408576698