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 COMPONENTS_SYNC_CORE_WRITE_NODE_H_ | 5 #ifndef COMPONENTS_SYNC_CORE_WRITE_NODE_H_ |
6 #define COMPONENTS_SYNC_CORE_WRITE_NODE_H_ | 6 #define COMPONENTS_SYNC_CORE_WRITE_NODE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "components/sync/base/model_type.h" | 17 #include "components/sync/base/model_type.h" |
| 18 #include "components/sync/base/passphrase_type.h" |
18 #include "components/sync/core/base_node.h" | 19 #include "components/sync/core/base_node.h" |
19 | 20 |
20 namespace sync_pb { | 21 namespace sync_pb { |
21 class BookmarkSpecifics; | 22 class BookmarkSpecifics; |
22 class EntitySpecifics; | 23 class EntitySpecifics; |
23 class NigoriSpecifics; | 24 class NigoriSpecifics; |
24 class PasswordSpecificsData; | 25 class PasswordSpecificsData; |
25 class TypedUrlSpecifics; | 26 class TypedUrlSpecifics; |
26 } | 27 } |
27 | 28 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // be a child of |new_parent| or NULL. Returns false on failure.. | 115 // be a child of |new_parent| or NULL. Returns false on failure.. |
115 bool SetPosition(const BaseNode& new_parent, const BaseNode* predecessor); | 116 bool SetPosition(const BaseNode& new_parent, const BaseNode* predecessor); |
116 | 117 |
117 // Set the bookmark specifics (url and favicon). | 118 // Set the bookmark specifics (url and favicon). |
118 // Should only be called if GetModelType() == BOOKMARK. | 119 // Should only be called if GetModelType() == BOOKMARK. |
119 void SetBookmarkSpecifics(const sync_pb::BookmarkSpecifics& specifics); | 120 void SetBookmarkSpecifics(const sync_pb::BookmarkSpecifics& specifics); |
120 | 121 |
121 // Generic set specifics method. Will extract the model type from |specifics|. | 122 // Generic set specifics method. Will extract the model type from |specifics|. |
122 void SetEntitySpecifics(const sync_pb::EntitySpecifics& specifics); | 123 void SetEntitySpecifics(const sync_pb::EntitySpecifics& specifics); |
123 | 124 |
| 125 void SetEntitySpecifics(const sync_pb::EntitySpecifics& specifics, |
| 126 PassphraseType passphrase_type); |
| 127 |
124 // Resets the EntitySpecifics for this node based on the unencrypted data. | 128 // Resets the EntitySpecifics for this node based on the unencrypted data. |
125 // Will encrypt if necessary. | 129 // Will encrypt if necessary. |
126 void ResetFromSpecifics(); | 130 void ResetFromSpecifics(); |
127 | 131 |
128 // TODO(sync): Remove the setters below when the corresponding data | 132 // TODO(sync): Remove the setters below when the corresponding data |
129 // types are ported to the new sync service API. | 133 // types are ported to the new sync service API. |
130 | 134 |
131 // Set the nigori specifics. | 135 // Set the nigori specifics. |
132 // Should only be called if GetModelType() == NIGORI. | 136 // Should only be called if GetModelType() == NIGORI. |
133 void SetNigoriSpecifics(const sync_pb::NigoriSpecifics& specifics); | 137 void SetNigoriSpecifics(const sync_pb::NigoriSpecifics& specifics); |
134 | 138 |
135 // Set the password specifics. | 139 // Set the password specifics. |
136 // Should only be called if GetModelType() == PASSWORD. | 140 // Should only be called if GetModelType() == PASSWORD. |
137 void SetPasswordSpecifics(const sync_pb::PasswordSpecificsData& specifics); | 141 void SetPasswordSpecifics(const sync_pb::PasswordSpecificsData& specifics, |
| 142 PassphraseType passphrase_type); |
138 | 143 |
139 // Set the typed_url specifics (url, title, typed_count, etc). | 144 // Set the typed_url specifics (url, title, typed_count, etc). |
140 // Should only be called if GetModelType() == TYPED_URLS. | 145 // Should only be called if GetModelType() == TYPED_URLS. |
141 void SetTypedUrlSpecifics(const sync_pb::TypedUrlSpecifics& specifics); | 146 void SetTypedUrlSpecifics(const sync_pb::TypedUrlSpecifics& specifics); |
142 | 147 |
143 // Set the attachment metadata. | 148 // Set the attachment metadata. |
144 void SetAttachmentMetadata( | 149 void SetAttachmentMetadata( |
145 const sync_pb::AttachmentMetadata& attachment_metadata); | 150 const sync_pb::AttachmentMetadata& attachment_metadata); |
146 | 151 |
147 // Implementation of BaseNode's abstract virtual accessors. | 152 // Implementation of BaseNode's abstract virtual accessors. |
(...skipping 25 matching lines...) Expand all Loading... |
173 | 178 |
174 // The sync API transaction that is the parent of this node. | 179 // The sync API transaction that is the parent of this node. |
175 WriteTransaction* transaction_; | 180 WriteTransaction* transaction_; |
176 | 181 |
177 DISALLOW_COPY_AND_ASSIGN(WriteNode); | 182 DISALLOW_COPY_AND_ASSIGN(WriteNode); |
178 }; | 183 }; |
179 | 184 |
180 } // namespace syncer | 185 } // namespace syncer |
181 | 186 |
182 #endif // COMPONENTS_SYNC_CORE_WRITE_NODE_H_ | 187 #endif // COMPONENTS_SYNC_CORE_WRITE_NODE_H_ |
OLD | NEW |