OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 |
OLD | NEW |