Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: sync/syncable/nigori_util.cc

Issue 10825137: FYI: Control Data + Per-Device Metadata (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add PER_USER_METADATA, refactor some encryption code Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "sync/syncable/nigori_util.h" 5 #include "sync/syncable/nigori_util.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 return SpecificsNeedsEncryption(encrypted_types, entry.Get(SPECIFICS)) || 78 return SpecificsNeedsEncryption(encrypted_types, entry.Get(SPECIFICS)) ||
79 (encrypted_types.Has(type) && 79 (encrypted_types.Has(type) &&
80 entry.Get(NON_UNIQUE_NAME) != kEncryptedString); 80 entry.Get(NON_UNIQUE_NAME) != kEncryptedString);
81 } 81 }
82 82
83 bool SpecificsNeedsEncryption(ModelTypeSet encrypted_types, 83 bool SpecificsNeedsEncryption(ModelTypeSet encrypted_types,
84 const sync_pb::EntitySpecifics& specifics) { 84 const sync_pb::EntitySpecifics& specifics) {
85 const ModelType type = GetModelTypeFromSpecifics(specifics); 85 const ModelType type = GetModelTypeFromSpecifics(specifics);
86 if (type == PASSWORDS || type == NIGORI) 86 if (type == PASSWORDS || type == NIGORI)
87 return false; // These types have their own encryption schemes. 87 return false; // These types have their own encryption schemes.
88 if (!syncer::EncryptableTypes().Has(type))
rlarocque 2012/08/11 01:31:52 This is a new concept that I'm introducing. We al
89 return false; // These types can never be encrypted.
88 if (!encrypted_types.Has(type)) 90 if (!encrypted_types.Has(type))
89 return false; // This type does not require encryption 91 return false; // This type does not require encryption.
90 return !specifics.has_encrypted(); 92 return !specifics.has_encrypted();
91 } 93 }
92 94
93 // Mainly for testing. 95 // Mainly for testing.
94 bool VerifyDataTypeEncryptionForTest( 96 bool VerifyDataTypeEncryptionForTest(
95 BaseTransaction* const trans, 97 BaseTransaction* const trans,
96 Cryptographer* cryptographer, 98 Cryptographer* cryptographer,
97 ModelType type, 99 ModelType type,
98 bool is_encrypted) { 100 bool is_encrypted) {
99 if (type == PASSWORDS || type == NIGORI) { 101 if (type == PASSWORDS || type == NIGORI) {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 entry->Put(syncable::SPECIFICS, generated_specifics); 243 entry->Put(syncable::SPECIFICS, generated_specifics);
242 DVLOG(1) << "Overwriting specifics of type " 244 DVLOG(1) << "Overwriting specifics of type "
243 << ModelTypeToString(type) 245 << ModelTypeToString(type)
244 << " and marking for syncing."; 246 << " and marking for syncing.";
245 syncable::MarkForSyncing(entry); 247 syncable::MarkForSyncing(entry);
246 return true; 248 return true;
247 } 249 }
248 250
249 } // namespace syncable 251 } // namespace syncable
250 } // namespace syncer 252 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698