| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/extensions/extension_sync_data.h" | 9 #include "chrome/browser/extensions/extension_sync_data.h" |
| 10 #include "chrome/common/string_ordinal.h" | 10 #include "chrome/common/string_ordinal.h" |
| 11 #include "sync/api/sync_change.h" | 11 #include "sync/api/sync_change.h" |
| 12 | 12 |
| 13 namespace csync { |
| 13 class SyncData; | 14 class SyncData; |
| 15 } |
| 16 |
| 14 namespace sync_pb { | 17 namespace sync_pb { |
| 15 class AppSpecifics; | 18 class AppSpecifics; |
| 16 } | 19 } |
| 17 | 20 |
| 18 namespace extensions { | 21 namespace extensions { |
| 19 | 22 |
| 20 class Extension; | 23 class Extension; |
| 21 class ExtensionSyncData; | 24 class ExtensionSyncData; |
| 22 | 25 |
| 23 // A class that encapsulates the synced properties of an Application. | 26 // A class that encapsulates the synced properties of an Application. |
| 24 class AppSyncData { | 27 class AppSyncData { |
| 25 public: | 28 public: |
| 26 AppSyncData(); | 29 AppSyncData(); |
| 27 explicit AppSyncData(const SyncData& sync_data); | 30 explicit AppSyncData(const csync::SyncData& sync_data); |
| 28 explicit AppSyncData(const SyncChange& sync_change); | 31 explicit AppSyncData(const csync::SyncChange& sync_change); |
| 29 AppSyncData(const Extension& extension, | 32 AppSyncData(const Extension& extension, |
| 30 bool enabled, | 33 bool enabled, |
| 31 bool incognito_enabled, | 34 bool incognito_enabled, |
| 32 const std::string& notifications_client_id, | 35 const std::string& notifications_client_id, |
| 33 bool notifications_disabled, | 36 bool notifications_disabled, |
| 34 const StringOrdinal& app_launch_ordinal, | 37 const StringOrdinal& app_launch_ordinal, |
| 35 const StringOrdinal& page_ordinal); | 38 const StringOrdinal& page_ordinal); |
| 36 ~AppSyncData(); | 39 ~AppSyncData(); |
| 37 | 40 |
| 38 // Retrive sync data from this class. | 41 // Retrive sync data from this class. |
| 39 SyncData GetSyncData() const; | 42 csync::SyncData GetSyncData() const; |
| 40 SyncChange GetSyncChange(SyncChange::SyncChangeType change_type) const; | 43 csync::SyncChange GetSyncChange( |
| 44 csync::SyncChange::SyncChangeType change_type) const; |
| 41 | 45 |
| 42 const std::string& id() const { return extension_sync_data_.id(); } | 46 const std::string& id() const { return extension_sync_data_.id(); } |
| 43 | 47 |
| 44 bool uninstalled() const { return extension_sync_data_.uninstalled(); } | 48 bool uninstalled() const { return extension_sync_data_.uninstalled(); } |
| 45 | 49 |
| 46 const std::string& notifications_client_id() const { | 50 const std::string& notifications_client_id() const { |
| 47 return notifications_client_id_; | 51 return notifications_client_id_; |
| 48 } | 52 } |
| 49 | 53 |
| 50 bool notifications_disabled() const { | 54 bool notifications_disabled() const { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 62 return extension_sync_data_; | 66 return extension_sync_data_; |
| 63 } | 67 } |
| 64 | 68 |
| 65 private: | 69 private: |
| 66 // Convert an AppSyncData back out to a sync structure. | 70 // Convert an AppSyncData back out to a sync structure. |
| 67 void PopulateAppSpecifics(sync_pb::AppSpecifics* specifics) const; | 71 void PopulateAppSpecifics(sync_pb::AppSpecifics* specifics) const; |
| 68 | 72 |
| 69 // Populate this class from sync inputs. | 73 // Populate this class from sync inputs. |
| 70 void PopulateFromAppSpecifics( | 74 void PopulateFromAppSpecifics( |
| 71 const sync_pb::AppSpecifics& specifics); | 75 const sync_pb::AppSpecifics& specifics); |
| 72 void PopulateFromSyncData(const SyncData& sync_data); | 76 void PopulateFromSyncData(const csync::SyncData& sync_data); |
| 73 | 77 |
| 74 ExtensionSyncData extension_sync_data_; | 78 ExtensionSyncData extension_sync_data_; |
| 75 std::string notifications_client_id_; | 79 std::string notifications_client_id_; |
| 76 bool notifications_disabled_; | 80 bool notifications_disabled_; |
| 77 StringOrdinal app_launch_ordinal_; | 81 StringOrdinal app_launch_ordinal_; |
| 78 StringOrdinal page_ordinal_; | 82 StringOrdinal page_ordinal_; |
| 79 }; | 83 }; |
| 80 | 84 |
| 81 } // namespace extensions | 85 } // namespace extensions |
| 82 | 86 |
| 83 #endif // CHROME_BROWSER_EXTENSIONS_APP_SYNC_DATA_H_ | 87 #endif // CHROME_BROWSER_EXTENSIONS_APP_SYNC_DATA_H_ |
| OLD | NEW |