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

Side by Side Diff: sync/util/cryptographer.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/util/cryptographer.h" 5 #include "sync/util/cryptographer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 nigori->set_encrypt_sessions(encrypted_types_.Has(SESSIONS)); 434 nigori->set_encrypt_sessions(encrypted_types_.Has(SESSIONS));
435 nigori->set_encrypt_app_settings( 435 nigori->set_encrypt_app_settings(
436 encrypted_types_.Has(APP_SETTINGS)); 436 encrypted_types_.Has(APP_SETTINGS));
437 nigori->set_encrypt_apps(encrypted_types_.Has(APPS)); 437 nigori->set_encrypt_apps(encrypted_types_.Has(APPS));
438 nigori->set_encrypt_app_notifications( 438 nigori->set_encrypt_app_notifications(
439 encrypted_types_.Has(APP_NOTIFICATIONS)); 439 encrypted_types_.Has(APP_NOTIFICATIONS));
440 } 440 }
441 441
442 void Cryptographer::set_encrypt_everything() { 442 void Cryptographer::set_encrypt_everything() {
443 if (encrypt_everything_) { 443 if (encrypt_everything_) {
444 DCHECK(encrypted_types_.Equals(ModelTypeSet::All())); 444 DCHECK(encrypted_types_.Equals(syncer::EncryptableTypes()));
445 return; 445 return;
446 } 446 }
447 encrypt_everything_ = true; 447 encrypt_everything_ = true;
448 // Change |encrypted_types_| directly to avoid sending more than one 448 // Change |encrypted_types_| directly to avoid sending more than one
449 // notification. 449 // notification.
450 encrypted_types_ = ModelTypeSet::All(); 450 encrypted_types_ = syncer::EncryptableTypes();
451 EmitEncryptedTypesChangedNotification(); 451 EmitEncryptedTypesChangedNotification();
452 } 452 }
453 453
454 bool Cryptographer::encrypt_everything() const { 454 bool Cryptographer::encrypt_everything() const {
455 return encrypt_everything_; 455 return encrypt_everything_;
456 } 456 }
457 457
458 ModelTypeSet Cryptographer::GetEncryptedTypes() const { 458 ModelTypeSet Cryptographer::GetEncryptedTypes() const {
459 return encrypted_types_; 459 return encrypted_types_;
460 } 460 }
(...skipping 28 matching lines...) Expand all
489 key.mac_key())) { 489 key.mac_key())) {
490 NOTREACHED(); 490 NOTREACHED();
491 continue; 491 continue;
492 } 492 }
493 nigoris_[key.name()] = make_linked_ptr(new_nigori.release()); 493 nigoris_[key.name()] = make_linked_ptr(new_nigori.release());
494 } 494 }
495 } 495 }
496 } 496 }
497 497
498 } // namespace syncer 498 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698