| 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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 public: | 29 public: |
| 30 enum OptionalBoolean { | 30 enum OptionalBoolean { |
| 31 BOOLEAN_UNSET, | 31 BOOLEAN_UNSET, |
| 32 BOOLEAN_TRUE, | 32 BOOLEAN_TRUE, |
| 33 BOOLEAN_FALSE | 33 BOOLEAN_FALSE |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 ExtensionSyncData(); | 36 ExtensionSyncData(); |
| 37 ExtensionSyncData(const Extension& extension, | 37 ExtensionSyncData(const Extension& extension, |
| 38 bool enabled, | 38 bool enabled, |
| 39 int disable_reasons, |
| 39 bool incognito_enabled, | 40 bool incognito_enabled, |
| 40 bool remote_install, | 41 bool remote_install, |
| 41 OptionalBoolean all_urls_enabled); | 42 OptionalBoolean all_urls_enabled); |
| 42 ~ExtensionSyncData(); | 43 ~ExtensionSyncData(); |
| 43 | 44 |
| 44 // For constructing an ExtensionSyncData from received sync data. | 45 // For constructing an ExtensionSyncData from received sync data. |
| 45 // May return null if the sync data was invalid. | 46 // May return null if the sync data was invalid. |
| 46 static scoped_ptr<ExtensionSyncData> CreateFromSyncData( | 47 static scoped_ptr<ExtensionSyncData> CreateFromSyncData( |
| 47 const syncer::SyncData& sync_data); | 48 const syncer::SyncData& sync_data); |
| 48 static scoped_ptr<ExtensionSyncData> CreateFromSyncChange( | 49 static scoped_ptr<ExtensionSyncData> CreateFromSyncChange( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 62 | 63 |
| 63 void set_uninstalled(bool uninstalled); | 64 void set_uninstalled(bool uninstalled); |
| 64 | 65 |
| 65 const std::string& id() const { return id_; } | 66 const std::string& id() const { return id_; } |
| 66 | 67 |
| 67 // Version-independent properties (i.e., used even when the | 68 // Version-independent properties (i.e., used even when the |
| 68 // version of the currently-installed extension doesn't match | 69 // version of the currently-installed extension doesn't match |
| 69 // |version|). | 70 // |version|). |
| 70 bool uninstalled() const { return uninstalled_; } | 71 bool uninstalled() const { return uninstalled_; } |
| 71 bool enabled() const { return enabled_; } | 72 bool enabled() const { return enabled_; } |
| 73 int disable_reasons() const { return disable_reasons_; } |
| 72 bool incognito_enabled() const { return incognito_enabled_; } | 74 bool incognito_enabled() const { return incognito_enabled_; } |
| 73 bool remote_install() const { return remote_install_; } | 75 bool remote_install() const { return remote_install_; } |
| 74 OptionalBoolean all_urls_enabled() const { return all_urls_enabled_; } | 76 OptionalBoolean all_urls_enabled() const { return all_urls_enabled_; } |
| 75 bool installed_by_custodian() const { return installed_by_custodian_; } | 77 bool installed_by_custodian() const { return installed_by_custodian_; } |
| 76 | 78 |
| 77 // Version-dependent properties (i.e., should be used only when the | 79 // Version-dependent properties (i.e., should be used only when the |
| 78 // version of the currenty-installed extension matches |version|). | 80 // version of the currently-installed extension matches |version|). |
| 79 const Version& version() const { return version_; } | 81 const Version& version() const { return version_; } |
| 80 const GURL& update_url() const { return update_url_; } | 82 const GURL& update_url() const { return update_url_; } |
| 81 // Used only for debugging. | 83 // Used only for debugging. |
| 82 const std::string& name() const { return name_; } | 84 const std::string& name() const { return name_; } |
| 83 | 85 |
| 84 private: | 86 private: |
| 85 // Populate this class from sync inputs. | 87 // Populate this class from sync inputs. |
| 86 bool PopulateFromSyncData(const syncer::SyncData& sync_data); | 88 bool PopulateFromSyncData(const syncer::SyncData& sync_data); |
| 87 | 89 |
| 88 std::string id_; | 90 std::string id_; |
| 89 bool uninstalled_; | 91 bool uninstalled_; |
| 90 bool enabled_; | 92 bool enabled_; |
| 93 int disable_reasons_; |
| 91 bool incognito_enabled_; | 94 bool incognito_enabled_; |
| 92 bool remote_install_; | 95 bool remote_install_; |
| 93 OptionalBoolean all_urls_enabled_; | 96 OptionalBoolean all_urls_enabled_; |
| 94 bool installed_by_custodian_; | 97 bool installed_by_custodian_; |
| 95 Version version_; | 98 Version version_; |
| 96 GURL update_url_; | 99 GURL update_url_; |
| 97 std::string name_; | 100 std::string name_; |
| 98 }; | 101 }; |
| 99 | 102 |
| 100 } // namespace extensions | 103 } // namespace extensions |
| 101 | 104 |
| 102 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYNC_DATA_H_ | 105 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYNC_DATA_H_ |
| OLD | NEW |