| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_EXTENSIONS_APP_SYNC_DATA_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_APP_SYNC_DATA_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_APP_SYNC_DATA_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_APP_SYNC_DATA_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/extensions/extension_sync_data.h" | 8 #include "chrome/browser/extensions/extension_sync_data.h" |
| 9 #include "sync/api/string_ordinal.h" | 9 #include "sync/api/string_ordinal.h" |
| 10 #include "sync/api/sync_change.h" | 10 #include "sync/api/sync_change.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // A class that encapsulates the synced properties of an Application. | 25 // A class that encapsulates the synced properties of an Application. |
| 26 class AppSyncData { | 26 class AppSyncData { |
| 27 public: | 27 public: |
| 28 AppSyncData(); | 28 AppSyncData(); |
| 29 explicit AppSyncData(const syncer::SyncData& sync_data); | 29 explicit AppSyncData(const syncer::SyncData& sync_data); |
| 30 explicit AppSyncData(const syncer::SyncChange& sync_change); | 30 explicit AppSyncData(const syncer::SyncChange& sync_change); |
| 31 AppSyncData(const Extension& extension, | 31 AppSyncData(const Extension& extension, |
| 32 bool enabled, | 32 bool enabled, |
| 33 bool incognito_enabled, | 33 bool incognito_enabled, |
| 34 const syncer::StringOrdinal& app_launch_ordinal, | 34 const syncer::StringOrdinal& app_launch_ordinal, |
| 35 const syncer::StringOrdinal& page_ordinal); | 35 const syncer::StringOrdinal& page_ordinal, |
| 36 const syncer::StringOrdinal& app_list_ordinal); |
| 36 ~AppSyncData(); | 37 ~AppSyncData(); |
| 37 | 38 |
| 38 // Retrive sync data from this class. | 39 // Retrive sync data from this class. |
| 39 syncer::SyncData GetSyncData() const; | 40 syncer::SyncData GetSyncData() const; |
| 40 syncer::SyncChange GetSyncChange( | 41 syncer::SyncChange GetSyncChange( |
| 41 syncer::SyncChange::SyncChangeType change_type) const; | 42 syncer::SyncChange::SyncChangeType change_type) const; |
| 42 | 43 |
| 43 const std::string& id() const { return extension_sync_data_.id(); } | 44 const std::string& id() const { return extension_sync_data_.id(); } |
| 44 | 45 |
| 45 bool uninstalled() const { return extension_sync_data_.uninstalled(); } | 46 bool uninstalled() const { return extension_sync_data_.uninstalled(); } |
| 46 | 47 |
| 47 // These ordinals aren't necessarily valid. Some applications don't have | 48 // These ordinals aren't necessarily valid. Some applications don't have |
| 48 // valid ordinals because they don't appear on the new tab page. | 49 // valid ordinals because they don't appear on the new tab page. |
| 49 const syncer::StringOrdinal& app_launch_ordinal() const { | 50 const syncer::StringOrdinal& app_launch_ordinal() const { |
| 50 return app_launch_ordinal_; | 51 return app_launch_ordinal_; |
| 51 } | 52 } |
| 52 const syncer::StringOrdinal& page_ordinal() const { return page_ordinal_; } | 53 const syncer::StringOrdinal& page_ordinal() const { return page_ordinal_; } |
| 53 | 54 const syncer::StringOrdinal& app_list_ordinal() const { |
| 55 return app_list_ordinal_; |
| 56 } |
| 54 const ExtensionSyncData& extension_sync_data() const { | 57 const ExtensionSyncData& extension_sync_data() const { |
| 55 return extension_sync_data_; | 58 return extension_sync_data_; |
| 56 } | 59 } |
| 57 | 60 |
| 58 private: | 61 private: |
| 59 // Convert an AppSyncData back out to a sync structure. | 62 // Convert an AppSyncData back out to a sync structure. |
| 60 void PopulateAppSpecifics(sync_pb::AppSpecifics* specifics) const; | 63 void PopulateAppSpecifics(sync_pb::AppSpecifics* specifics) const; |
| 61 | 64 |
| 62 // Populate this class from sync inputs. | 65 // Populate this class from sync inputs. |
| 63 void PopulateFromAppSpecifics( | 66 void PopulateFromAppSpecifics( |
| 64 const sync_pb::AppSpecifics& specifics); | 67 const sync_pb::AppSpecifics& specifics); |
| 65 void PopulateFromSyncData(const syncer::SyncData& sync_data); | 68 void PopulateFromSyncData(const syncer::SyncData& sync_data); |
| 66 | 69 |
| 67 ExtensionSyncData extension_sync_data_; | 70 ExtensionSyncData extension_sync_data_; |
| 68 syncer::StringOrdinal app_launch_ordinal_; | 71 syncer::StringOrdinal app_launch_ordinal_; |
| 69 syncer::StringOrdinal page_ordinal_; | 72 syncer::StringOrdinal page_ordinal_; |
| 73 syncer::StringOrdinal app_list_ordinal_; |
| 70 }; | 74 }; |
| 71 | 75 |
| 72 } // namespace extensions | 76 } // namespace extensions |
| 73 | 77 |
| 74 #endif // CHROME_BROWSER_EXTENSIONS_APP_SYNC_DATA_H_ | 78 #endif // CHROME_BROWSER_EXTENSIONS_APP_SYNC_DATA_H_ |
| 75 | 79 |
| OLD | NEW |