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

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

Issue 8564032: [Sync] The cryptographer should be able to handle empty or old nigori nodes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile 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
« no previous file with comments | « no previous file | chrome/browser/sync/util/cryptographer_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 "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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 374
375 syncable::ModelTypeSet Cryptographer::GetEncryptedTypes() const { 375 syncable::ModelTypeSet Cryptographer::GetEncryptedTypes() const {
376 return encrypted_types_; 376 return encrypted_types_;
377 } 377 }
378 378
379 void Cryptographer::SetEncryptedTypesForTest( 379 void Cryptographer::SetEncryptedTypesForTest(
380 const syncable::ModelTypeSet& encrypted_types) { 380 const syncable::ModelTypeSet& encrypted_types) {
381 SetEncryptedTypes(encrypted_types); 381 SetEncryptedTypes(encrypted_types);
382 } 382 }
383 383
384 void Cryptographer::SetEncryptedTypes( 384 void Cryptographer::SetEncryptedTypes(
akalin 2011/11/17 03:09:20 Rename this to "MergeEncryptedTypes"
Nicolas Zea 2011/11/17 05:10:00 Done.
385 const syncable::ModelTypeSet& encrypted_types) { 385 const syncable::ModelTypeSet& encrypted_types) {
386 if (encrypted_types_ == encrypted_types) { 386 if (encrypted_types_ == encrypted_types) {
akalin 2011/11/17 03:09:20 should be: if (std::includes(encrypted_types_.beg
Nicolas Zea 2011/11/17 05:10:00 Done.
387 return; 387 return;
388 } 388 }
389 encrypted_types_ = encrypted_types; 389 encrypted_types_.insert(encrypted_types.begin(), encrypted_types.end());
390 EmitEncryptedTypesChangedNotification(); 390 EmitEncryptedTypesChangedNotification();
391 } 391 }
392 392
393 void Cryptographer::EmitEncryptedTypesChangedNotification() { 393 void Cryptographer::EmitEncryptedTypesChangedNotification() {
394 FOR_EACH_OBSERVER( 394 FOR_EACH_OBSERVER(
395 Observer, observers_, 395 Observer, observers_,
396 OnEncryptedTypesChanged(encrypted_types_, encrypt_everything_)); 396 OnEncryptedTypesChanged(encrypted_types_, encrypt_everything_));
397 } 397 }
398 398
399 void Cryptographer::InstallKeys(const std::string& default_key_name, 399 void Cryptographer::InstallKeys(const std::string& default_key_name,
(...skipping 11 matching lines...) Expand all
411 continue; 411 continue;
412 } 412 }
413 nigoris_[key.name()] = make_linked_ptr(new_nigori.release()); 413 nigoris_[key.name()] = make_linked_ptr(new_nigori.release());
414 } 414 }
415 } 415 }
416 DCHECK(nigoris_.end() != nigoris_.find(default_key_name)); 416 DCHECK(nigoris_.end() != nigoris_.find(default_key_name));
417 default_nigori_ = &*nigoris_.find(default_key_name); 417 default_nigori_ = &*nigoris_.find(default_key_name);
418 } 418 }
419 419
420 } // namespace browser_sync 420 } // namespace browser_sync
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/util/cryptographer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698