| 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 #ifndef COMPONENTS_SYNC_CORE_IMPL_SYNC_ENCRYPTION_HANDLER_IMPL_H_ | 5 #ifndef COMPONENTS_SYNC_CORE_IMPL_SYNC_ENCRYPTION_HANDLER_IMPL_H_ |
| 6 #define COMPONENTS_SYNC_CORE_IMPL_SYNC_ENCRYPTION_HANDLER_IMPL_H_ | 6 #define COMPONENTS_SYNC_CORE_IMPL_SYNC_ENCRYPTION_HANDLER_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
| 17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 18 #include "components/sync/base/cryptographer.h" | 18 #include "components/sync/base/cryptographer.h" |
| 19 #include "components/sync/base/sync_export.h" | |
| 20 #include "components/sync/core/sync_encryption_handler.h" | 19 #include "components/sync/core/sync_encryption_handler.h" |
| 21 #include "components/sync/syncable/nigori_handler.h" | 20 #include "components/sync/syncable/nigori_handler.h" |
| 22 | 21 |
| 23 namespace syncer { | 22 namespace syncer { |
| 24 | 23 |
| 25 class Encryptor; | 24 class Encryptor; |
| 26 struct UserShare; | 25 struct UserShare; |
| 27 class WriteNode; | 26 class WriteNode; |
| 28 class WriteTransaction; | 27 class WriteTransaction; |
| 29 | 28 |
| 30 // Sync encryption handler implementation. | 29 // Sync encryption handler implementation. |
| 31 // | 30 // |
| 32 // This class acts as the respository of all sync encryption state, and handles | 31 // This class acts as the respository of all sync encryption state, and handles |
| 33 // encryption related changes/queries coming from both the chrome side and | 32 // encryption related changes/queries coming from both the chrome side and |
| 34 // the sync side (via NigoriHandler). It is capable of modifying all sync data | 33 // the sync side (via NigoriHandler). It is capable of modifying all sync data |
| 35 // (re-encryption), updating the encrypted types, changing the encryption keys, | 34 // (re-encryption), updating the encrypted types, changing the encryption keys, |
| 36 // and creating/receiving nigori node updates. | 35 // and creating/receiving nigori node updates. |
| 37 // | 36 // |
| 38 // The class should live as long as the directory itself in order to ensure | 37 // The class should live as long as the directory itself in order to ensure |
| 39 // any data read/written is properly decrypted/encrypted. | 38 // any data read/written is properly decrypted/encrypted. |
| 40 // | 39 // |
| 41 // Note: See sync_encryption_handler.h for a description of the chrome visible | 40 // Note: See sync_encryption_handler.h for a description of the chrome visible |
| 42 // methods and what they do, and nigori_handler.h for a description of the | 41 // methods and what they do, and nigori_handler.h for a description of the |
| 43 // sync methods. | 42 // sync methods. |
| 44 // All methods are non-thread-safe and should only be called from the sync | 43 // All methods are non-thread-safe and should only be called from the sync |
| 45 // thread unless explicitly noted otherwise. | 44 // thread unless explicitly noted otherwise. |
| 46 class SYNC_EXPORT SyncEncryptionHandlerImpl : public SyncEncryptionHandler, | 45 class SyncEncryptionHandlerImpl : public SyncEncryptionHandler, |
| 47 public syncable::NigoriHandler { | 46 public syncable::NigoriHandler { |
| 48 public: | 47 public: |
| 49 SyncEncryptionHandlerImpl( | 48 SyncEncryptionHandlerImpl( |
| 50 UserShare* user_share, | 49 UserShare* user_share, |
| 51 Encryptor* encryptor, | 50 Encryptor* encryptor, |
| 52 const std::string& restored_key_for_bootstrapping, | 51 const std::string& restored_key_for_bootstrapping, |
| 53 const std::string& restored_keystore_key_for_bootstrapping); | 52 const std::string& restored_keystore_key_for_bootstrapping); |
| 54 ~SyncEncryptionHandlerImpl() override; | 53 ~SyncEncryptionHandlerImpl() override; |
| 55 | 54 |
| 56 // SyncEncryptionHandler implementation. | 55 // SyncEncryptionHandler implementation. |
| 57 void AddObserver(Observer* observer) override; | 56 void AddObserver(Observer* observer) override; |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 base::Time custom_passphrase_time_; | 311 base::Time custom_passphrase_time_; |
| 313 | 312 |
| 314 base::WeakPtrFactory<SyncEncryptionHandlerImpl> weak_ptr_factory_; | 313 base::WeakPtrFactory<SyncEncryptionHandlerImpl> weak_ptr_factory_; |
| 315 | 314 |
| 316 DISALLOW_COPY_AND_ASSIGN(SyncEncryptionHandlerImpl); | 315 DISALLOW_COPY_AND_ASSIGN(SyncEncryptionHandlerImpl); |
| 317 }; | 316 }; |
| 318 | 317 |
| 319 } // namespace syncer | 318 } // namespace syncer |
| 320 | 319 |
| 321 #endif // COMPONENTS_SYNC_CORE_IMPL_SYNC_ENCRYPTION_HANDLER_IMPL_H_ | 320 #endif // COMPONENTS_SYNC_CORE_IMPL_SYNC_ENCRYPTION_HANDLER_IMPL_H_ |
| OLD | NEW |