OLD | NEW |
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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 } | 203 } |
204 | 204 |
205 SyncEncryptionHandlerImpl::Vault::~Vault() { | 205 SyncEncryptionHandlerImpl::Vault::~Vault() { |
206 } | 206 } |
207 | 207 |
208 SyncEncryptionHandlerImpl::SyncEncryptionHandlerImpl( | 208 SyncEncryptionHandlerImpl::SyncEncryptionHandlerImpl( |
209 UserShare* user_share, | 209 UserShare* user_share, |
210 Encryptor* encryptor, | 210 Encryptor* encryptor, |
211 const std::string& restored_key_for_bootstrapping, | 211 const std::string& restored_key_for_bootstrapping, |
212 const std::string& restored_keystore_key_for_bootstrapping) | 212 const std::string& restored_keystore_key_for_bootstrapping) |
213 : weak_ptr_factory_(this), | 213 : user_share_(user_share), |
214 user_share_(user_share), | |
215 vault_unsafe_(encryptor, SensitiveTypes()), | 214 vault_unsafe_(encryptor, SensitiveTypes()), |
216 encrypt_everything_(false), | 215 encrypt_everything_(false), |
217 passphrase_type_(IMPLICIT_PASSPHRASE), | 216 passphrase_type_(IMPLICIT_PASSPHRASE), |
218 nigori_overwrite_count_(0) { | 217 nigori_overwrite_count_(0), |
| 218 weak_ptr_factory_(this) { |
219 // Restore the cryptographer's previous keys. Note that we don't add the | 219 // Restore the cryptographer's previous keys. Note that we don't add the |
220 // keystore keys into the cryptographer here, in case a migration was pending. | 220 // keystore keys into the cryptographer here, in case a migration was pending. |
221 vault_unsafe_.cryptographer.Bootstrap(restored_key_for_bootstrapping); | 221 vault_unsafe_.cryptographer.Bootstrap(restored_key_for_bootstrapping); |
222 | 222 |
223 // If this fails, we won't have a valid keystore key, and will simply request | 223 // If this fails, we won't have a valid keystore key, and will simply request |
224 // new ones from the server on the next DownloadUpdates. | 224 // new ones from the server on the next DownloadUpdates. |
225 UnpackKeystoreBootstrapToken( | 225 UnpackKeystoreBootstrapToken( |
226 restored_keystore_key_for_bootstrapping, | 226 restored_keystore_key_for_bootstrapping, |
227 encryptor, | 227 encryptor, |
228 &old_keystore_keys_, | 228 &old_keystore_keys_, |
(...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1643 | 1643 |
1644 base::Time SyncEncryptionHandlerImpl::GetExplicitPassphraseTime() const { | 1644 base::Time SyncEncryptionHandlerImpl::GetExplicitPassphraseTime() const { |
1645 if (passphrase_type_ == FROZEN_IMPLICIT_PASSPHRASE) | 1645 if (passphrase_type_ == FROZEN_IMPLICIT_PASSPHRASE) |
1646 return migration_time(); | 1646 return migration_time(); |
1647 else if (passphrase_type_ == CUSTOM_PASSPHRASE) | 1647 else if (passphrase_type_ == CUSTOM_PASSPHRASE) |
1648 return custom_passphrase_time(); | 1648 return custom_passphrase_time(); |
1649 return base::Time(); | 1649 return base::Time(); |
1650 } | 1650 } |
1651 | 1651 |
1652 } // namespace browser_sync | 1652 } // namespace browser_sync |
OLD | NEW |