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 #include "components/sync/syncable/nigori_util.h" | 5 #include "components/sync/syncable/nigori_util.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <queue> | 10 #include <queue> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/json/json_writer.h" | 14 #include "base/json/json_writer.h" |
15 #include "components/sync/base/cryptographer.h" | 15 #include "components/sync/base/cryptographer.h" |
| 16 #include "components/sync/base/passphrase_type.h" |
16 #include "components/sync/syncable/directory.h" | 17 #include "components/sync/syncable/directory.h" |
17 #include "components/sync/syncable/entry.h" | 18 #include "components/sync/syncable/entry.h" |
18 #include "components/sync/syncable/mutable_entry.h" | 19 #include "components/sync/syncable/mutable_entry.h" |
19 #include "components/sync/syncable/nigori_handler.h" | 20 #include "components/sync/syncable/nigori_handler.h" |
20 #include "components/sync/syncable/syncable_util.h" | 21 #include "components/sync/syncable/syncable_util.h" |
21 #include "components/sync/syncable/syncable_write_transaction.h" | 22 #include "components/sync/syncable/syncable_write_transaction.h" |
22 | 23 |
23 namespace syncer { | 24 namespace syncer { |
24 namespace syncable { | 25 namespace syncable { |
25 | 26 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 // For bookmarks we actually put bogus data into the unencrypted specifics, | 219 // For bookmarks we actually put bogus data into the unencrypted specifics, |
219 // else the server will try to do it for us. | 220 // else the server will try to do it for us. |
220 if (type == BOOKMARKS) { | 221 if (type == BOOKMARKS) { |
221 sync_pb::BookmarkSpecifics* bookmark_specifics = | 222 sync_pb::BookmarkSpecifics* bookmark_specifics = |
222 generated_specifics.mutable_bookmark(); | 223 generated_specifics.mutable_bookmark(); |
223 if (!entry->GetIsDir()) | 224 if (!entry->GetIsDir()) |
224 bookmark_specifics->set_url(kEncryptedString); | 225 bookmark_specifics->set_url(kEncryptedString); |
225 bookmark_specifics->set_title(kEncryptedString); | 226 bookmark_specifics->set_title(kEncryptedString); |
226 } | 227 } |
227 } | 228 } |
| 229 |
| 230 if (type == PASSWORDS && |
| 231 IsExplicitPassphrase(nigori_handler->GetPassphraseType(trans))) { |
| 232 sync_pb::PasswordSpecifics* password_specifics = |
| 233 generated_specifics.mutable_password(); |
| 234 password_specifics->clear_unencrypted_metadata(); |
| 235 } |
| 236 |
228 entry->PutSpecifics(generated_specifics); | 237 entry->PutSpecifics(generated_specifics); |
229 DVLOG(1) << "Overwriting specifics of type " << ModelTypeToString(type) | 238 DVLOG(1) << "Overwriting specifics of type " << ModelTypeToString(type) |
230 << " and marking for syncing."; | 239 << " and marking for syncing."; |
231 syncable::MarkForSyncing(entry); | 240 syncable::MarkForSyncing(entry); |
232 return true; | 241 return true; |
233 } | 242 } |
234 | 243 |
235 void UpdateNigoriFromEncryptedTypes(ModelTypeSet encrypted_types, | 244 void UpdateNigoriFromEncryptedTypes(ModelTypeSet encrypted_types, |
236 bool encrypt_everything, | 245 bool encrypt_everything, |
237 sync_pb::NigoriSpecifics* nigori) { | 246 sync_pb::NigoriSpecifics* nigori) { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 encrypted_types.Put(ARTICLES); | 315 encrypted_types.Put(ARTICLES); |
307 if (nigori.encrypt_app_list()) | 316 if (nigori.encrypt_app_list()) |
308 encrypted_types.Put(APP_LIST); | 317 encrypted_types.Put(APP_LIST); |
309 if (nigori.encrypt_arc_package()) | 318 if (nigori.encrypt_arc_package()) |
310 encrypted_types.Put(ARC_PACKAGE); | 319 encrypted_types.Put(ARC_PACKAGE); |
311 return encrypted_types; | 320 return encrypted_types; |
312 } | 321 } |
313 | 322 |
314 } // namespace syncable | 323 } // namespace syncable |
315 } // namespace syncer | 324 } // namespace syncer |
OLD | NEW |