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

Side by Side Diff: chrome/browser/sync/engine/nigori_util.cc

Issue 7878005: [Sync] Fix encrypting of sync titles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/sync/engine/syncer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/browser/sync/engine/nigori_util.h" 5 #include "chrome/browser/sync/engine/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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 if (EntryNeedsEncryption(encrypted_types, entry)) 52 if (EntryNeedsEncryption(encrypted_types, entry))
53 return false; 53 return false;
54 } 54 }
55 return true; 55 return true;
56 } 56 }
57 57
58 bool EntryNeedsEncryption(const ModelTypeSet& encrypted_types, 58 bool EntryNeedsEncryption(const ModelTypeSet& encrypted_types,
59 const Entry& entry) { 59 const Entry& entry) {
60 if (!entry.Get(UNIQUE_SERVER_TAG).empty()) 60 if (!entry.Get(UNIQUE_SERVER_TAG).empty())
61 return false; // We don't encrypt unique server nodes. 61 return false; // We don't encrypt unique server nodes.
62 return SpecificsNeedsEncryption(encrypted_types, entry.Get(SPECIFICS)); 62 syncable::ModelType type = entry.GetModelType();
63 if (type == PASSWORDS || type == NIGORI)
64 return false;
65 return SpecificsNeedsEncryption(encrypted_types, entry.Get(SPECIFICS)) ||
66 (encrypted_types.count(type) > 0 &&
67 entry.Get(NON_UNIQUE_NAME) != kEncryptedString);
tim (not reviewing) 2011/09/14 23:54:46 A comment to the effect of "We check NON_UNIQUE_NA
Nicolas Zea 2011/09/15 00:10:04 Done.
63 } 68 }
64 69
65 bool SpecificsNeedsEncryption(const ModelTypeSet& encrypted_types, 70 bool SpecificsNeedsEncryption(const ModelTypeSet& encrypted_types,
66 const sync_pb::EntitySpecifics& specifics) { 71 const sync_pb::EntitySpecifics& specifics) {
67 ModelType type = GetModelTypeFromSpecifics(specifics); 72 ModelType type = GetModelTypeFromSpecifics(specifics);
68 if (type == PASSWORDS || type == NIGORI) 73 if (type == PASSWORDS || type == NIGORI)
69 return false; // These types have their own encryption schemes. 74 return false; // These types have their own encryption schemes.
70 if (encrypted_types.count(type) == 0) 75 if (encrypted_types.count(type) == 0)
71 return false; // This type does not require encryption 76 return false; // This type does not require encryption
72 return !specifics.has_encrypted(); 77 return !specifics.has_encrypted();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 return false; 127 return false;
123 } 128 }
124 } 129 }
125 // Push the successor. 130 // Push the successor.
126 to_visit.push(child.Get(NEXT_ID)); 131 to_visit.push(child.Get(NEXT_ID));
127 } 132 }
128 return true; 133 return true;
129 } 134 }
130 135
131 } // namespace syncable 136 } // namespace syncable
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/engine/syncer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698