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

Side by Side Diff: chrome/browser/sync/util/cryptographer.cc

Issue 8375047: Separate the syncing of extension settings and app settings into separate data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 1 month 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) 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 "base/base64.h" 5 #include "base/base64.h"
6 #include "chrome/browser/sync/util/cryptographer.h" 6 #include "chrome/browser/sync/util/cryptographer.h"
7 #include "chrome/browser/password_manager/encryptor.h" 7 #include "chrome/browser/password_manager/encryptor.h"
8 8
9 namespace browser_sync { 9 namespace browser_sync {
10 10
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 if (nigori.encrypt_typed_urls()) 303 if (nigori.encrypt_typed_urls())
304 encrypted_types.insert(syncable::TYPED_URLS); 304 encrypted_types.insert(syncable::TYPED_URLS);
305 if (nigori.encrypt_extension_settings()) 305 if (nigori.encrypt_extension_settings())
306 encrypted_types.insert(syncable::EXTENSION_SETTINGS); 306 encrypted_types.insert(syncable::EXTENSION_SETTINGS);
307 if (nigori.encrypt_extensions()) 307 if (nigori.encrypt_extensions())
308 encrypted_types.insert(syncable::EXTENSIONS); 308 encrypted_types.insert(syncable::EXTENSIONS);
309 if (nigori.encrypt_search_engines()) 309 if (nigori.encrypt_search_engines())
310 encrypted_types.insert(syncable::SEARCH_ENGINES); 310 encrypted_types.insert(syncable::SEARCH_ENGINES);
311 if (nigori.encrypt_sessions()) 311 if (nigori.encrypt_sessions())
312 encrypted_types.insert(syncable::SESSIONS); 312 encrypted_types.insert(syncable::SESSIONS);
313 if (nigori.encrypt_app_settings())
314 encrypted_types.insert(syncable::APP_SETTINGS);
313 if (nigori.encrypt_apps()) 315 if (nigori.encrypt_apps())
314 encrypted_types.insert(syncable::APPS); 316 encrypted_types.insert(syncable::APPS);
315 if (nigori.encrypt_app_notifications()) 317 if (nigori.encrypt_app_notifications())
316 encrypted_types.insert(syncable::APP_NOTIFICATIONS); 318 encrypted_types.insert(syncable::APP_NOTIFICATIONS);
317 319
318 // Note: the initial version with encryption did not support the 320 // Note: the initial version with encryption did not support the
319 // encrypt_everything field. If anything more than the sensitive types were 321 // encrypt_everything field. If anything more than the sensitive types were
320 // encrypted, it meant we were encrypting everything. 322 // encrypted, it meant we were encrypting everything.
321 if (!nigori.has_encrypt_everything() && 323 if (!nigori.has_encrypt_everything() &&
322 encrypted_types.size() > SensitiveTypes().size()) { 324 encrypted_types.size() > SensitiveTypes().size()) {
(...skipping 17 matching lines...) Expand all
340 nigori->set_encrypt_themes(encrypted_types_.count(syncable::THEMES) > 0); 342 nigori->set_encrypt_themes(encrypted_types_.count(syncable::THEMES) > 0);
341 nigori->set_encrypt_typed_urls( 343 nigori->set_encrypt_typed_urls(
342 encrypted_types_.count(syncable::TYPED_URLS) > 0); 344 encrypted_types_.count(syncable::TYPED_URLS) > 0);
343 nigori->set_encrypt_extension_settings( 345 nigori->set_encrypt_extension_settings(
344 encrypted_types_.count(syncable::EXTENSION_SETTINGS) > 0); 346 encrypted_types_.count(syncable::EXTENSION_SETTINGS) > 0);
345 nigori->set_encrypt_extensions( 347 nigori->set_encrypt_extensions(
346 encrypted_types_.count(syncable::EXTENSIONS) > 0); 348 encrypted_types_.count(syncable::EXTENSIONS) > 0);
347 nigori->set_encrypt_search_engines( 349 nigori->set_encrypt_search_engines(
348 encrypted_types_.count(syncable::SEARCH_ENGINES) > 0); 350 encrypted_types_.count(syncable::SEARCH_ENGINES) > 0);
349 nigori->set_encrypt_sessions(encrypted_types_.count(syncable::SESSIONS) > 0); 351 nigori->set_encrypt_sessions(encrypted_types_.count(syncable::SESSIONS) > 0);
352 nigori->set_encrypt_app_settings(
353 encrypted_types_.count(syncable::APP_SETTINGS) > 0);
350 nigori->set_encrypt_apps(encrypted_types_.count(syncable::APPS) > 0); 354 nigori->set_encrypt_apps(encrypted_types_.count(syncable::APPS) > 0);
351 nigori->set_encrypt_app_notifications( 355 nigori->set_encrypt_app_notifications(
352 encrypted_types_.count(syncable::APP_NOTIFICATIONS) > 0); 356 encrypted_types_.count(syncable::APP_NOTIFICATIONS) > 0);
353 } 357 }
354 358
355 void Cryptographer::set_encrypt_everything() { 359 void Cryptographer::set_encrypt_everything() {
356 if (encrypt_everything_) { 360 if (encrypt_everything_) {
357 DCHECK(encrypted_types_ == syncable::GetAllRealModelTypes()); 361 DCHECK(encrypted_types_ == syncable::GetAllRealModelTypes());
358 return; 362 return;
359 } 363 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 continue; 411 continue;
408 } 412 }
409 nigoris_[key.name()] = make_linked_ptr(new_nigori.release()); 413 nigoris_[key.name()] = make_linked_ptr(new_nigori.release());
410 } 414 }
411 } 415 }
412 DCHECK(nigoris_.end() != nigoris_.find(default_key_name)); 416 DCHECK(nigoris_.end() != nigoris_.find(default_key_name));
413 default_nigori_ = &*nigoris_.find(default_key_name); 417 default_nigori_ = &*nigoris_.find(default_key_name);
414 } 418 }
415 419
416 } // namespace browser_sync 420 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698