OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_EXTENSION_SYNC_DATA_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SYNC_DATA_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SYNC_DATA_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SYNC_DATA_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 // A class that encapsulates the synced properties of an Extension. | 23 // A class that encapsulates the synced properties of an Extension. |
24 class ExtensionSyncData { | 24 class ExtensionSyncData { |
25 public: | 25 public: |
26 ExtensionSyncData(); | 26 ExtensionSyncData(); |
27 explicit ExtensionSyncData(const SyncData& sync_data); | 27 explicit ExtensionSyncData(const SyncData& sync_data); |
28 explicit ExtensionSyncData(const SyncChange& sync_change); | 28 explicit ExtensionSyncData(const SyncChange& sync_change); |
29 ExtensionSyncData(const Extension& extension, | 29 ExtensionSyncData(const Extension& extension, |
30 bool enabled, | 30 bool enabled, |
31 bool incognito_enabled, | 31 bool incognito_enabled, |
32 bool notifications_initial_setup_done, | 32 const std::string& notifications_client_id, |
33 bool notifications_disabled); | 33 bool notifications_disabled); |
34 ~ExtensionSyncData(); | 34 ~ExtensionSyncData(); |
35 | 35 |
36 // Convert an ExtensionSyncData back out to a sync structure. | 36 // Convert an ExtensionSyncData back out to a sync structure. |
37 void PopulateSyncSpecifics(sync_pb::ExtensionSpecifics* specifics) const; | 37 void PopulateSyncSpecifics(sync_pb::ExtensionSpecifics* specifics) const; |
38 void PopulateAppSpecifics(sync_pb::AppSpecifics* specifics) const; | 38 void PopulateAppSpecifics(sync_pb::AppSpecifics* specifics) const; |
39 SyncData GetSyncData() const; | 39 SyncData GetSyncData() const; |
40 SyncChange GetSyncChange(SyncChange::SyncChangeType change_type) const; | 40 SyncChange GetSyncChange(SyncChange::SyncChangeType change_type) const; |
41 | 41 |
42 const std::string& id() const { return id_; } | 42 const std::string& id() const { return id_; } |
43 | 43 |
44 // Version-independent properties (i.e., used even when the | 44 // Version-independent properties (i.e., used even when the |
45 // version of the currently-installed extension doesn't match | 45 // version of the currently-installed extension doesn't match |
46 // |version|). | 46 // |version|). |
47 bool uninstalled() const { return uninstalled_; } | 47 bool uninstalled() const { return uninstalled_; } |
48 bool enabled() const { return enabled_; } | 48 bool enabled() const { return enabled_; } |
49 bool incognito_enabled() const { return incognito_enabled_; } | 49 bool incognito_enabled() const { return incognito_enabled_; } |
50 Extension::SyncType type() const { return type_; } | 50 Extension::SyncType type() const { return type_; } |
51 | 51 |
52 // Version-dependent properties (i.e., should be used only when the | 52 // Version-dependent properties (i.e., should be used only when the |
53 // version of the currenty-installed extension matches |version|). | 53 // version of the currenty-installed extension matches |version|). |
54 const Version& version() const { return version_; } | 54 const Version& version() const { return version_; } |
55 const GURL& update_url() const { return update_url_; } | 55 const GURL& update_url() const { return update_url_; } |
56 // Used only for debugging. | 56 // Used only for debugging. |
57 const std::string& name() const { return name_; } | 57 const std::string& name() const { return name_; } |
58 | 58 |
59 bool notifications_initial_setup_done() const { | 59 const std::string& notifications_client_id() const { |
60 return notifications_initial_setup_done_; | 60 return notifications_client_id_; |
61 } | 61 } |
62 | 62 |
63 bool notifications_disabled() const { | 63 bool notifications_disabled() const { |
64 return notifications_disabled_; | 64 return notifications_disabled_; |
65 } | 65 } |
66 | 66 |
67 private: | 67 private: |
68 void PopulateFromExtensionSpecifics( | 68 void PopulateFromExtensionSpecifics( |
69 const sync_pb::ExtensionSpecifics& specifics); | 69 const sync_pb::ExtensionSpecifics& specifics); |
70 void PopulateFromSyncData(const SyncData& sync_data); | 70 void PopulateFromSyncData(const SyncData& sync_data); |
71 | 71 |
72 std::string id_; | 72 std::string id_; |
73 bool uninstalled_; | 73 bool uninstalled_; |
74 bool enabled_; | 74 bool enabled_; |
75 bool incognito_enabled_; | 75 bool incognito_enabled_; |
76 Extension::SyncType type_; | 76 Extension::SyncType type_; |
77 Version version_; | 77 Version version_; |
78 GURL update_url_; | 78 GURL update_url_; |
79 std::string name_; | 79 std::string name_; |
80 bool notifications_initial_setup_done_; | 80 std::string notifications_client_id_; |
81 bool notifications_disabled_; | 81 bool notifications_disabled_; |
82 }; | 82 }; |
83 | 83 |
84 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYNC_DATA_H_ | 84 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYNC_DATA_H_ |
OLD | NEW |