| OLD | NEW |
| 1 // Copyright (c) 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 SYNC_INTERNAL_API_SYNC_ENCRYPTION_HANDLER_IMPL_H_ | 5 #ifndef SYNC_INTERNAL_API_SYNC_ENCRYPTION_HANDLER_IMPL_H_ |
| 6 #define SYNC_INTERNAL_API_SYNC_ENCRYPTION_HANDLER_IMPL_H_ | 6 #define SYNC_INTERNAL_API_SYNC_ENCRYPTION_HANDLER_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/time.h" | 12 #include "base/time.h" |
| 13 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
| 17 #include "sync/base/sync_export.h" |
| 17 #include "sync/internal_api/public/sync_encryption_handler.h" | 18 #include "sync/internal_api/public/sync_encryption_handler.h" |
| 18 #include "sync/syncable/nigori_handler.h" | 19 #include "sync/syncable/nigori_handler.h" |
| 19 #include "sync/util/cryptographer.h" | 20 #include "sync/util/cryptographer.h" |
| 20 | 21 |
| 21 namespace syncer { | 22 namespace syncer { |
| 22 | 23 |
| 23 class Encryptor; | 24 class Encryptor; |
| 24 struct UserShare; | 25 struct UserShare; |
| 25 class WriteNode; | 26 class WriteNode; |
| 26 class WriteTransaction; | 27 class WriteTransaction; |
| 27 | 28 |
| 28 // Sync encryption handler implementation. | 29 // Sync encryption handler implementation. |
| 29 // | 30 // |
| 30 // 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 |
| 31 // encryption related changes/queries coming from both the chrome side and | 32 // encryption related changes/queries coming from both the chrome side and |
| 32 // 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 |
| 33 // (re-encryption), updating the encrypted types, changing the encryption keys, | 34 // (re-encryption), updating the encrypted types, changing the encryption keys, |
| 34 // and creating/receiving nigori node updates. | 35 // and creating/receiving nigori node updates. |
| 35 // | 36 // |
| 36 // 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 |
| 37 // any data read/written is properly decrypted/encrypted. | 38 // any data read/written is properly decrypted/encrypted. |
| 38 // | 39 // |
| 39 // 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 |
| 40 // 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 |
| 41 // sync methods. | 42 // sync methods. |
| 42 // 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 |
| 43 // thread unless explicitly noted otherwise. | 44 // thread unless explicitly noted otherwise. |
| 44 class SyncEncryptionHandlerImpl | 45 class SYNC_EXPORT_PRIVATE SyncEncryptionHandlerImpl |
| 45 : public SyncEncryptionHandler, | 46 : public SyncEncryptionHandler, |
| 46 public syncable::NigoriHandler { | 47 public syncable::NigoriHandler { |
| 47 public: | 48 public: |
| 48 SyncEncryptionHandlerImpl( | 49 SyncEncryptionHandlerImpl( |
| 49 UserShare* user_share, | 50 UserShare* user_share, |
| 50 Encryptor* encryptor, | 51 Encryptor* encryptor, |
| 51 const std::string& restored_key_for_bootstrapping, | 52 const std::string& restored_key_for_bootstrapping, |
| 52 const std::string& restored_keystore_key_for_bootstrapping); | 53 const std::string& restored_keystore_key_for_bootstrapping); |
| 53 virtual ~SyncEncryptionHandlerImpl(); | 54 virtual ~SyncEncryptionHandlerImpl(); |
| 54 | 55 |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 // if there is no custom passphrase or the custom passphrase was set | 306 // if there is no custom passphrase or the custom passphrase was set |
| 306 // before support for this field was added. | 307 // before support for this field was added. |
| 307 base::Time custom_passphrase_time_; | 308 base::Time custom_passphrase_time_; |
| 308 | 309 |
| 309 DISALLOW_COPY_AND_ASSIGN(SyncEncryptionHandlerImpl); | 310 DISALLOW_COPY_AND_ASSIGN(SyncEncryptionHandlerImpl); |
| 310 }; | 311 }; |
| 311 | 312 |
| 312 } // namespace syncer | 313 } // namespace syncer |
| 313 | 314 |
| 314 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_IMPL_H_ | 315 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_IMPL_H_ |
| OLD | NEW |