OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 SYNC_INTERNAL_API_PUBLIC_WRITE_NODE_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_WRITE_NODE_H_ |
6 #define SYNC_INTERNAL_API_PUBLIC_WRITE_NODE_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_WRITE_NODE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "sync/base/sync_export.h" | 13 #include "sync/base/sync_export.h" |
14 #include "sync/internal_api/public/base/model_type.h" | 14 #include "sync/internal_api/public/base/model_type.h" |
15 #include "sync/internal_api/public/base_node.h" | 15 #include "sync/internal_api/public/base_node.h" |
16 | 16 |
17 namespace sync_pb { | 17 namespace sync_pb { |
18 class AppSpecifics; | |
19 class AutofillSpecifics; | |
20 class AutofillProfileSpecifics; | |
21 class BookmarkSpecifics; | 18 class BookmarkSpecifics; |
22 class EntitySpecifics; | 19 class EntitySpecifics; |
23 class ExtensionSpecifics; | |
24 class SessionSpecifics; | |
25 class NigoriSpecifics; | 20 class NigoriSpecifics; |
26 class PasswordSpecificsData; | 21 class PasswordSpecificsData; |
27 class ThemeSpecifics; | |
28 class TypedUrlSpecifics; | 22 class TypedUrlSpecifics; |
29 } | 23 } |
30 | 24 |
31 namespace syncer { | 25 namespace syncer { |
32 | 26 |
33 class Cryptographer; | 27 class Cryptographer; |
34 class WriteTransaction; | 28 class WriteTransaction; |
35 | 29 |
36 namespace syncable { | 30 namespace syncable { |
37 class Id; | 31 class Id; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 // Generic set specifics method. Will extract the model type from |specifics|. | 118 // Generic set specifics method. Will extract the model type from |specifics|. |
125 void SetEntitySpecifics(const sync_pb::EntitySpecifics& specifics); | 119 void SetEntitySpecifics(const sync_pb::EntitySpecifics& specifics); |
126 | 120 |
127 // Resets the EntitySpecifics for this node based on the unencrypted data. | 121 // Resets the EntitySpecifics for this node based on the unencrypted data. |
128 // Will encrypt if necessary. | 122 // Will encrypt if necessary. |
129 void ResetFromSpecifics(); | 123 void ResetFromSpecifics(); |
130 | 124 |
131 // TODO(sync): Remove the setters below when the corresponding data | 125 // TODO(sync): Remove the setters below when the corresponding data |
132 // types are ported to the new sync service API. | 126 // types are ported to the new sync service API. |
133 | 127 |
134 // Set the app specifics (id, update url, enabled state, etc). | |
135 // Should only be called if GetModelType() == APPS. | |
136 void SetAppSpecifics(const sync_pb::AppSpecifics& specifics); | |
137 | |
138 // Set the autofill specifics (name and value). | |
139 // Should only be called if GetModelType() == AUTOFILL. | |
140 void SetAutofillSpecifics(const sync_pb::AutofillSpecifics& specifics); | |
141 | |
142 void SetAutofillProfileSpecifics( | |
143 const sync_pb::AutofillProfileSpecifics& specifics); | |
144 | |
145 // Set the nigori specifics. | 128 // Set the nigori specifics. |
146 // Should only be called if GetModelType() == NIGORI. | 129 // Should only be called if GetModelType() == NIGORI. |
147 void SetNigoriSpecifics(const sync_pb::NigoriSpecifics& specifics); | 130 void SetNigoriSpecifics(const sync_pb::NigoriSpecifics& specifics); |
148 | 131 |
149 // Set the password specifics. | 132 // Set the password specifics. |
150 // Should only be called if GetModelType() == PASSWORD. | 133 // Should only be called if GetModelType() == PASSWORD. |
151 void SetPasswordSpecifics(const sync_pb::PasswordSpecificsData& specifics); | 134 void SetPasswordSpecifics(const sync_pb::PasswordSpecificsData& specifics); |
152 | 135 |
153 // Set the theme specifics (name and value). | |
154 // Should only be called if GetModelType() == THEME. | |
155 void SetThemeSpecifics(const sync_pb::ThemeSpecifics& specifics); | |
156 | |
157 // Set the typed_url specifics (url, title, typed_count, etc). | 136 // Set the typed_url specifics (url, title, typed_count, etc). |
158 // Should only be called if GetModelType() == TYPED_URLS. | 137 // Should only be called if GetModelType() == TYPED_URLS. |
159 void SetTypedUrlSpecifics(const sync_pb::TypedUrlSpecifics& specifics); | 138 void SetTypedUrlSpecifics(const sync_pb::TypedUrlSpecifics& specifics); |
160 | 139 |
161 // Set the extension specifics (id, update url, enabled state, etc). | |
162 // Should only be called if GetModelType() == EXTENSIONS. | |
163 void SetExtensionSpecifics(const sync_pb::ExtensionSpecifics& specifics); | |
164 | |
165 // Set the session specifics (windows, tabs, navigations etc.). | |
166 // Should only be called if GetModelType() == SESSIONS. | |
167 void SetSessionSpecifics(const sync_pb::SessionSpecifics& specifics); | |
168 | |
169 // Set the device info specifics. | |
170 // Should only be called if GetModelType() == DEVICE_INFO. | |
171 void SetDeviceInfoSpecifics(const sync_pb::DeviceInfoSpecifics& specifics); | |
172 | |
173 // Set the experiments specifics. | |
174 // Should only be called if GetModelType() == EXPERIMENTS. | |
175 void SetExperimentsSpecifics(const sync_pb::ExperimentsSpecifics& specifics); | |
176 | |
177 // Set the priority preference specifics. | |
178 // Should only be called if GetModelType() == PRIORITY_PREFERENCE. | |
179 void SetPriorityPreferenceSpecifics( | |
180 const sync_pb::PriorityPreferenceSpecifics& specifics); | |
181 | |
182 // Set the attachment metadata. | 140 // Set the attachment metadata. |
183 void SetAttachmentMetadata( | 141 void SetAttachmentMetadata( |
184 const sync_pb::AttachmentMetadata& attachment_metadata); | 142 const sync_pb::AttachmentMetadata& attachment_metadata); |
185 | 143 |
186 // Implementation of BaseNode's abstract virtual accessors. | 144 // Implementation of BaseNode's abstract virtual accessors. |
187 const syncable::Entry* GetEntry() const override; | 145 const syncable::Entry* GetEntry() const override; |
188 | 146 |
189 const BaseTransaction* GetTransaction() const override; | 147 const BaseTransaction* GetTransaction() const override; |
190 | 148 |
191 syncable::MutableEntry* GetMutableEntryForTest(); | 149 syncable::MutableEntry* GetMutableEntryForTest(); |
(...skipping 20 matching lines...) Expand all Loading... |
212 | 170 |
213 // The sync API transaction that is the parent of this node. | 171 // The sync API transaction that is the parent of this node. |
214 WriteTransaction* transaction_; | 172 WriteTransaction* transaction_; |
215 | 173 |
216 DISALLOW_COPY_AND_ASSIGN(WriteNode); | 174 DISALLOW_COPY_AND_ASSIGN(WriteNode); |
217 }; | 175 }; |
218 | 176 |
219 } // namespace syncer | 177 } // namespace syncer |
220 | 178 |
221 #endif // SYNC_INTERNAL_API_PUBLIC_WRITE_NODE_H_ | 179 #endif // SYNC_INTERNAL_API_PUBLIC_WRITE_NODE_H_ |
OLD | NEW |