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

Side by Side Diff: sync/internal_api/sync_encryption_handler_impl.cc

Issue 925783002: Split ValueSerializer into separate Serializer and Deserializer classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed cpplint warnings. Created 5 years, 9 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/internal_api/sync_encryption_handler_impl.h" 5 #include "sync/internal_api/sync_encryption_handler_impl.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <string> 8 #include <string>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 std::string base64_decoded_keystore_bootstrap; 167 std::string base64_decoded_keystore_bootstrap;
168 if (!base::Base64Decode(keystore_bootstrap_token, 168 if (!base::Base64Decode(keystore_bootstrap_token,
169 &base64_decoded_keystore_bootstrap)) { 169 &base64_decoded_keystore_bootstrap)) {
170 return false; 170 return false;
171 } 171 }
172 std::string decrypted_keystore_bootstrap; 172 std::string decrypted_keystore_bootstrap;
173 if (!encryptor->DecryptString(base64_decoded_keystore_bootstrap, 173 if (!encryptor->DecryptString(base64_decoded_keystore_bootstrap,
174 &decrypted_keystore_bootstrap)) { 174 &decrypted_keystore_bootstrap)) {
175 return false; 175 return false;
176 } 176 }
177 JSONStringValueSerializer json(&decrypted_keystore_bootstrap); 177
178 JSONStringValueDeserializer json(decrypted_keystore_bootstrap);
178 scoped_ptr<base::Value> deserialized_keystore_keys( 179 scoped_ptr<base::Value> deserialized_keystore_keys(
179 json.Deserialize(NULL, NULL)); 180 json.Deserialize(NULL, NULL));
180 if (!deserialized_keystore_keys) 181 if (!deserialized_keystore_keys)
181 return false; 182 return false;
182 base::ListValue* internal_list_value = NULL; 183 base::ListValue* internal_list_value = NULL;
183 if (!deserialized_keystore_keys->GetAsList(&internal_list_value)) 184 if (!deserialized_keystore_keys->GetAsList(&internal_list_value))
184 return false; 185 return false;
185 int number_of_keystore_keys = internal_list_value->GetSize(); 186 int number_of_keystore_keys = internal_list_value->GetSize();
186 if (!internal_list_value->GetString(number_of_keystore_keys - 1, 187 if (!internal_list_value->GetString(number_of_keystore_keys - 1,
187 current_keystore_key)) { 188 current_keystore_key)) {
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after
1642 1643
1643 base::Time SyncEncryptionHandlerImpl::GetExplicitPassphraseTime() const { 1644 base::Time SyncEncryptionHandlerImpl::GetExplicitPassphraseTime() const {
1644 if (passphrase_type_ == FROZEN_IMPLICIT_PASSPHRASE) 1645 if (passphrase_type_ == FROZEN_IMPLICIT_PASSPHRASE)
1645 return migration_time(); 1646 return migration_time();
1646 else if (passphrase_type_ == CUSTOM_PASSPHRASE) 1647 else if (passphrase_type_ == CUSTOM_PASSPHRASE)
1647 return custom_passphrase_time(); 1648 return custom_passphrase_time();
1648 return base::Time(); 1649 return base::Time();
1649 } 1650 }
1650 1651
1651 } // namespace browser_sync 1652 } // namespace browser_sync
OLDNEW
« no previous file with comments | « rlz/chromeos/lib/rlz_value_store_chromeos.cc ('k') | sync/internal_api/sync_encryption_handler_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698