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 |
11 #include "base/version.h" | 11 #include "base/version.h" |
12 #include "chrome/browser/sync/api/sync_change.h" | 12 #include "chrome/browser/sync/api/sync_change.h" |
13 #include "chrome/browser/sync/api/sync_data.h" | 13 #include "chrome/browser/sync/api/sync_data.h" |
14 #include "chrome/common/extensions/extension.h" | 14 #include "chrome/common/extensions/extension.h" |
15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
16 | 16 |
17 class ExtensionService; | 17 class ExtensionService; |
18 class SyncData; | 18 class SyncData; |
19 namespace sync_pb { class ExtensionSpecifics; } | 19 namespace sync_pb { |
| 20 class AppSpecifics; |
| 21 class ExtensionSpecifics; |
| 22 } |
20 | 23 |
21 // A class that encapsulates the synced properties of an Extension. | 24 // A class that encapsulates the synced properties of an Extension. |
22 class ExtensionSyncData { | 25 class ExtensionSyncData { |
23 public: | 26 public: |
24 ExtensionSyncData(); | 27 ExtensionSyncData(); |
25 explicit ExtensionSyncData(const SyncData& sync_data); | 28 explicit ExtensionSyncData(const SyncData& sync_data); |
26 explicit ExtensionSyncData(const SyncChange& sync_change); | 29 explicit ExtensionSyncData(const SyncChange& sync_change); |
27 ExtensionSyncData(const Extension& extension, | 30 ExtensionSyncData(const Extension& extension, |
28 bool enabled, | 31 bool enabled, |
29 bool incognito_enabled); | 32 bool incognito_enabled, |
| 33 bool notifications_initial_setup_done, |
| 34 bool notifications_disabled); |
30 ~ExtensionSyncData(); | 35 ~ExtensionSyncData(); |
31 | 36 |
32 // Convert an ExtensionSyncData back out to a sync structure. | 37 // Convert an ExtensionSyncData back out to a sync structure. |
33 void PopulateSyncSpecifics(sync_pb::ExtensionSpecifics* specifics) const; | 38 void PopulateSyncSpecifics(sync_pb::ExtensionSpecifics* specifics) const; |
| 39 void PopulateAppSpecifics(sync_pb::AppSpecifics* specifics) const; |
34 SyncData GetSyncData() const; | 40 SyncData GetSyncData() const; |
35 SyncChange GetSyncChange(SyncChange::SyncChangeType change_type) const; | 41 SyncChange GetSyncChange(SyncChange::SyncChangeType change_type) const; |
36 | 42 |
37 const std::string& id() const { return id_; } | 43 const std::string& id() const { return id_; } |
38 | 44 |
39 // Version-independent properties (i.e., used even when the | 45 // Version-independent properties (i.e., used even when the |
40 // version of the currently-installed extension doesn't match | 46 // version of the currently-installed extension doesn't match |
41 // |version|). | 47 // |version|). |
42 bool uninstalled() const { return uninstalled_; } | 48 bool uninstalled() const { return uninstalled_; } |
43 bool enabled() const { return enabled_; } | 49 bool enabled() const { return enabled_; } |
44 bool incognito_enabled() const { return incognito_enabled_; } | 50 bool incognito_enabled() const { return incognito_enabled_; } |
45 Extension::SyncType type() const { return type_; } | 51 Extension::SyncType type() const { return type_; } |
46 | 52 |
47 // Version-dependent properties (i.e., should be used only when the | 53 // Version-dependent properties (i.e., should be used only when the |
48 // version of the currenty-installed extension matches |version|). | 54 // version of the currenty-installed extension matches |version|). |
49 const Version& version() const { return version_; } | 55 const Version& version() const { return version_; } |
50 const GURL& update_url() const { return update_url_; } | 56 const GURL& update_url() const { return update_url_; } |
51 // Used only for debugging. | 57 // Used only for debugging. |
52 const std::string& name() const { return name_; } | 58 const std::string& name() const { return name_; } |
53 | 59 |
| 60 bool notifications_initial_setup_done() const { |
| 61 return notifications_initial_setup_done_; |
| 62 } |
| 63 |
| 64 bool notifications_disabled() const { |
| 65 return notifications_disabled_; |
| 66 } |
| 67 |
54 private: | 68 private: |
55 void PopulateFromExtensionSpecifics( | 69 void PopulateFromExtensionSpecifics( |
56 const sync_pb::ExtensionSpecifics& specifics); | 70 const sync_pb::ExtensionSpecifics& specifics); |
57 void PopulateFromSyncData(const SyncData& sync_data); | 71 void PopulateFromSyncData(const SyncData& sync_data); |
58 | 72 |
59 std::string id_; | 73 std::string id_; |
60 bool uninstalled_; | 74 bool uninstalled_; |
61 bool enabled_; | 75 bool enabled_; |
62 bool incognito_enabled_; | 76 bool incognito_enabled_; |
63 Extension::SyncType type_; | 77 Extension::SyncType type_; |
64 Version version_; | 78 Version version_; |
65 GURL update_url_; | 79 GURL update_url_; |
66 std::string name_; | 80 std::string name_; |
| 81 bool notifications_initial_setup_done_; |
| 82 bool notifications_disabled_; |
67 }; | 83 }; |
68 | 84 |
69 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYNC_DATA_H_ | 85 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYNC_DATA_H_ |
OLD | NEW |