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

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

Issue 10827266: [Sync] Add SyncEncryptionHandler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix 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
« no previous file with comments | « sync/syncable/nigori_util.h ('k') | sync/test/fake_sync_encryption_handler.h » ('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) 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 } 239 }
240 } 240 }
241 entry->Put(syncable::SPECIFICS, generated_specifics); 241 entry->Put(syncable::SPECIFICS, generated_specifics);
242 DVLOG(1) << "Overwriting specifics of type " 242 DVLOG(1) << "Overwriting specifics of type "
243 << ModelTypeToString(type) 243 << ModelTypeToString(type)
244 << " and marking for syncing."; 244 << " and marking for syncing.";
245 syncable::MarkForSyncing(entry); 245 syncable::MarkForSyncing(entry);
246 return true; 246 return true;
247 } 247 }
248 248
249 void UpdateNigoriFromEncryptedTypes(ModelTypeSet encrypted_types,
250 bool encrypt_everything,
251 sync_pb::NigoriSpecifics* nigori) {
252 nigori->set_encrypt_everything(encrypt_everything);
253 COMPILE_ASSERT(17, MODEL_TYPE_COUNT);
254 nigori->set_encrypt_bookmarks(
255 encrypted_types.Has(BOOKMARKS));
256 nigori->set_encrypt_preferences(
257 encrypted_types.Has(PREFERENCES));
258 nigori->set_encrypt_autofill_profile(
259 encrypted_types.Has(AUTOFILL_PROFILE));
260 nigori->set_encrypt_autofill(encrypted_types.Has(AUTOFILL));
261 nigori->set_encrypt_themes(encrypted_types.Has(THEMES));
262 nigori->set_encrypt_typed_urls(
263 encrypted_types.Has(TYPED_URLS));
264 nigori->set_encrypt_extension_settings(
265 encrypted_types.Has(EXTENSION_SETTINGS));
266 nigori->set_encrypt_extensions(
267 encrypted_types.Has(EXTENSIONS));
268 nigori->set_encrypt_search_engines(
269 encrypted_types.Has(SEARCH_ENGINES));
270 nigori->set_encrypt_sessions(encrypted_types.Has(SESSIONS));
271 nigori->set_encrypt_app_settings(
272 encrypted_types.Has(APP_SETTINGS));
273 nigori->set_encrypt_apps(encrypted_types.Has(APPS));
274 nigori->set_encrypt_app_notifications(
275 encrypted_types.Has(APP_NOTIFICATIONS));
276 }
277
278 ModelTypeSet GetEncryptedTypesFromNigori(
279 const sync_pb::NigoriSpecifics& nigori) {
280 if (nigori.encrypt_everything())
281 return ModelTypeSet::All();
282
283 ModelTypeSet encrypted_types;
284 COMPILE_ASSERT(17, MODEL_TYPE_COUNT);
285 if (nigori.encrypt_bookmarks())
286 encrypted_types.Put(BOOKMARKS);
287 if (nigori.encrypt_preferences())
288 encrypted_types.Put(PREFERENCES);
289 if (nigori.encrypt_autofill_profile())
290 encrypted_types.Put(AUTOFILL_PROFILE);
291 if (nigori.encrypt_autofill())
292 encrypted_types.Put(AUTOFILL);
293 if (nigori.encrypt_themes())
294 encrypted_types.Put(THEMES);
295 if (nigori.encrypt_typed_urls())
296 encrypted_types.Put(TYPED_URLS);
297 if (nigori.encrypt_extension_settings())
298 encrypted_types.Put(EXTENSION_SETTINGS);
299 if (nigori.encrypt_extensions())
300 encrypted_types.Put(EXTENSIONS);
301 if (nigori.encrypt_search_engines())
302 encrypted_types.Put(SEARCH_ENGINES);
303 if (nigori.encrypt_sessions())
304 encrypted_types.Put(SESSIONS);
305 if (nigori.encrypt_app_settings())
306 encrypted_types.Put(APP_SETTINGS);
307 if (nigori.encrypt_apps())
308 encrypted_types.Put(APPS);
309 if (nigori.encrypt_app_notifications())
310 encrypted_types.Put(APP_NOTIFICATIONS);
311 return encrypted_types;
312 }
313
249 } // namespace syncable 314 } // namespace syncable
250 } // namespace syncer 315 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/syncable/nigori_util.h ('k') | sync/test/fake_sync_encryption_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698