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_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 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/version.h" | 10 #include "base/version.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 class Extension; | 24 class Extension; |
25 | 25 |
26 // A class that encapsulates the synced properties of an Extension. | 26 // A class that encapsulates the synced properties of an Extension. |
27 class ExtensionSyncData { | 27 class ExtensionSyncData { |
28 public: | 28 public: |
29 ExtensionSyncData(); | 29 ExtensionSyncData(); |
30 explicit ExtensionSyncData(const syncer::SyncData& sync_data); | 30 explicit ExtensionSyncData(const syncer::SyncData& sync_data); |
31 explicit ExtensionSyncData(const syncer::SyncChange& sync_change); | 31 explicit ExtensionSyncData(const syncer::SyncChange& sync_change); |
32 ExtensionSyncData(const Extension& extension, | 32 ExtensionSyncData(const Extension& extension, |
33 bool enabled, | 33 bool enabled, |
34 bool incognito_enabled); | 34 bool incognito_enabled, |
| 35 bool remote_install); |
35 ~ExtensionSyncData(); | 36 ~ExtensionSyncData(); |
36 | 37 |
37 // Retrieve sync data from this class. | 38 // Retrieve sync data from this class. |
38 syncer::SyncData GetSyncData() const; | 39 syncer::SyncData GetSyncData() const; |
39 syncer::SyncChange GetSyncChange( | 40 syncer::SyncChange GetSyncChange( |
40 syncer::SyncChange::SyncChangeType change_type) const; | 41 syncer::SyncChange::SyncChangeType change_type) const; |
41 | 42 |
42 // Convert an ExtensionSyncData back out to a sync structure. | 43 // Convert an ExtensionSyncData back out to a sync structure. |
43 void PopulateExtensionSpecifics(sync_pb::ExtensionSpecifics* specifics) const; | 44 void PopulateExtensionSpecifics(sync_pb::ExtensionSpecifics* specifics) const; |
44 | 45 |
45 // Populate this class from sync inputs. | 46 // Populate this class from sync inputs. |
46 void PopulateFromExtensionSpecifics( | 47 void PopulateFromExtensionSpecifics( |
47 const sync_pb::ExtensionSpecifics& specifics); | 48 const sync_pb::ExtensionSpecifics& specifics); |
48 | 49 |
49 void set_uninstalled(bool uninstalled); | 50 void set_uninstalled(bool uninstalled); |
50 | 51 |
51 const std::string& id() const { return id_; } | 52 const std::string& id() const { return id_; } |
52 | 53 |
53 // Version-independent properties (i.e., used even when the | 54 // Version-independent properties (i.e., used even when the |
54 // version of the currently-installed extension doesn't match | 55 // version of the currently-installed extension doesn't match |
55 // |version|). | 56 // |version|). |
56 bool uninstalled() const { return uninstalled_; } | 57 bool uninstalled() const { return uninstalled_; } |
57 bool enabled() const { return enabled_; } | 58 bool enabled() const { return enabled_; } |
58 bool incognito_enabled() const { return incognito_enabled_; } | 59 bool incognito_enabled() const { return incognito_enabled_; } |
| 60 bool remote_install() const { return remote_install_; } |
59 | 61 |
60 // Version-dependent properties (i.e., should be used only when the | 62 // Version-dependent properties (i.e., should be used only when the |
61 // version of the currenty-installed extension matches |version|). | 63 // version of the currenty-installed extension matches |version|). |
62 const Version& version() const { return version_; } | 64 const Version& version() const { return version_; } |
63 const GURL& update_url() const { return update_url_; } | 65 const GURL& update_url() const { return update_url_; } |
64 // Used only for debugging. | 66 // Used only for debugging. |
65 const std::string& name() const { return name_; } | 67 const std::string& name() const { return name_; } |
66 | 68 |
67 private: | 69 private: |
68 // Populate this class from sync inputs. | 70 // Populate this class from sync inputs. |
69 void PopulateFromSyncData(const syncer::SyncData& sync_data); | 71 void PopulateFromSyncData(const syncer::SyncData& sync_data); |
70 | 72 |
71 std::string id_; | 73 std::string id_; |
72 bool uninstalled_; | 74 bool uninstalled_; |
73 bool enabled_; | 75 bool enabled_; |
74 bool incognito_enabled_; | 76 bool incognito_enabled_; |
75 bool remote_install_; | 77 bool remote_install_; |
76 Version version_; | 78 Version version_; |
77 GURL update_url_; | 79 GURL update_url_; |
78 std::string name_; | 80 std::string name_; |
79 }; | 81 }; |
80 | 82 |
81 } // namespace extensions | 83 } // namespace extensions |
82 | 84 |
83 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYNC_DATA_H_ | 85 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYNC_DATA_H_ |
OLD | NEW |