| 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 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 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 std::string& notifications_client_id, | |
| 35 bool notifications_disabled, | |
| 36 const syncer::StringOrdinal& app_launch_ordinal, | 34 const syncer::StringOrdinal& app_launch_ordinal, |
| 37 const syncer::StringOrdinal& page_ordinal); | 35 const syncer::StringOrdinal& page_ordinal); |
| 38 ~AppSyncData(); | 36 ~AppSyncData(); |
| 39 | 37 |
| 40 // Retrive sync data from this class. | 38 // Retrive sync data from this class. |
| 41 syncer::SyncData GetSyncData() const; | 39 syncer::SyncData GetSyncData() const; |
| 42 syncer::SyncChange GetSyncChange( | 40 syncer::SyncChange GetSyncChange( |
| 43 syncer::SyncChange::SyncChangeType change_type) const; | 41 syncer::SyncChange::SyncChangeType change_type) const; |
| 44 | 42 |
| 45 const std::string& id() const { return extension_sync_data_.id(); } | 43 const std::string& id() const { return extension_sync_data_.id(); } |
| 46 | 44 |
| 47 bool uninstalled() const { return extension_sync_data_.uninstalled(); } | 45 bool uninstalled() const { return extension_sync_data_.uninstalled(); } |
| 48 | 46 |
| 49 const std::string& notifications_client_id() const { | |
| 50 return notifications_client_id_; | |
| 51 } | |
| 52 | |
| 53 bool notifications_disabled() const { | |
| 54 return notifications_disabled_; | |
| 55 } | |
| 56 | |
| 57 // These ordinals aren't necessarily valid. Some applications don't have | 47 // These ordinals aren't necessarily valid. Some applications don't have |
| 58 // valid ordinals because they don't appear on the new tab page. | 48 // valid ordinals because they don't appear on the new tab page. |
| 59 const syncer::StringOrdinal& app_launch_ordinal() const { | 49 const syncer::StringOrdinal& app_launch_ordinal() const { |
| 60 return app_launch_ordinal_; | 50 return app_launch_ordinal_; |
| 61 } | 51 } |
| 62 const syncer::StringOrdinal& page_ordinal() const { return page_ordinal_; } | 52 const syncer::StringOrdinal& page_ordinal() const { return page_ordinal_; } |
| 63 | 53 |
| 64 const ExtensionSyncData& extension_sync_data() const { | 54 const ExtensionSyncData& extension_sync_data() const { |
| 65 return extension_sync_data_; | 55 return extension_sync_data_; |
| 66 } | 56 } |
| 67 | 57 |
| 68 private: | 58 private: |
| 69 // Convert an AppSyncData back out to a sync structure. | 59 // Convert an AppSyncData back out to a sync structure. |
| 70 void PopulateAppSpecifics(sync_pb::AppSpecifics* specifics) const; | 60 void PopulateAppSpecifics(sync_pb::AppSpecifics* specifics) const; |
| 71 | 61 |
| 72 // Populate this class from sync inputs. | 62 // Populate this class from sync inputs. |
| 73 void PopulateFromAppSpecifics( | 63 void PopulateFromAppSpecifics( |
| 74 const sync_pb::AppSpecifics& specifics); | 64 const sync_pb::AppSpecifics& specifics); |
| 75 void PopulateFromSyncData(const syncer::SyncData& sync_data); | 65 void PopulateFromSyncData(const syncer::SyncData& sync_data); |
| 76 | 66 |
| 77 ExtensionSyncData extension_sync_data_; | 67 ExtensionSyncData extension_sync_data_; |
| 78 std::string notifications_client_id_; | |
| 79 bool notifications_disabled_; | |
| 80 syncer::StringOrdinal app_launch_ordinal_; | 68 syncer::StringOrdinal app_launch_ordinal_; |
| 81 syncer::StringOrdinal page_ordinal_; | 69 syncer::StringOrdinal page_ordinal_; |
| 82 }; | 70 }; |
| 83 | 71 |
| 84 } // namespace extensions | 72 } // namespace extensions |
| 85 | 73 |
| 86 #endif // CHROME_BROWSER_EXTENSIONS_APP_SYNC_DATA_H_ | 74 #endif // CHROME_BROWSER_EXTENSIONS_APP_SYNC_DATA_H_ |
| 75 |
| OLD | NEW |