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

Unified 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: Address comments. Fix diff 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync/util/cryptographer.h ('k') | chrome/browser/sync/util/cryptographer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/util/cryptographer.cc
diff --git a/chrome/browser/sync/util/cryptographer.cc b/chrome/browser/sync/util/cryptographer.cc
index f7ac50e334f10a1360b740cde4bfcdb7a463c0ab..59e96103ba71c56891b7dc3a0baf41e69f35a40a 100644
--- a/chrome/browser/sync/util/cryptographer.cc
+++ b/chrome/browser/sync/util/cryptographer.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <algorithm>
+
#include "base/base64.h"
#include "chrome/browser/sync/util/cryptographer.h"
#include "chrome/browser/password_manager/encryptor.h"
@@ -326,7 +328,7 @@ void Cryptographer::UpdateEncryptedTypesFromNigori(
return;
}
- SetEncryptedTypes(encrypted_types);
+ MergeEncryptedTypes(encrypted_types);
}
void Cryptographer::UpdateNigoriFromEncryptedTypes(
@@ -376,14 +378,15 @@ syncable::ModelTypeSet Cryptographer::GetEncryptedTypes() const {
return encrypted_types_;
}
-void Cryptographer::SetEncryptedTypesForTest(
+void Cryptographer::MergeEncryptedTypesForTest(
const syncable::ModelTypeSet& encrypted_types) {
- SetEncryptedTypes(encrypted_types);
+ MergeEncryptedTypes(encrypted_types);
}
-void Cryptographer::SetEncryptedTypes(
+void Cryptographer::MergeEncryptedTypes(
const syncable::ModelTypeSet& encrypted_types) {
- if (encrypted_types_ == encrypted_types) {
+ if (std::includes(encrypted_types_.begin(), encrypted_types_.end(),
+ encrypted_types.begin(), encrypted_types.end())) {
return;
}
encrypted_types_ = encrypted_types;
« no previous file with comments | « chrome/browser/sync/util/cryptographer.h ('k') | chrome/browser/sync/util/cryptographer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698