| 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_PUBLIC_SYNC_ENCRYPTION_HANDLER_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_H_ |
| 6 #define SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| 11 #include "sync/base/sync_export.h" |
| 11 #include "sync/internal_api/public/base/model_type.h" | 12 #include "sync/internal_api/public/base/model_type.h" |
| 12 | 13 |
| 13 namespace sync_pb { | 14 namespace sync_pb { |
| 14 class EncryptedData; | 15 class EncryptedData; |
| 15 } | 16 } |
| 16 | 17 |
| 17 namespace syncer { | 18 namespace syncer { |
| 18 | 19 |
| 19 class Cryptographer; | 20 class Cryptographer; |
| 20 | 21 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 47 | 48 |
| 48 // Sync's encryption handler. Handles tracking encrypted types, ensuring the | 49 // Sync's encryption handler. Handles tracking encrypted types, ensuring the |
| 49 // cryptographer encrypts with the proper key and has the most recent keybag, | 50 // cryptographer encrypts with the proper key and has the most recent keybag, |
| 50 // and keeps the nigori node up to date. | 51 // and keeps the nigori node up to date. |
| 51 // Implementations of this class must be assumed to be non-thread-safe. All | 52 // Implementations of this class must be assumed to be non-thread-safe. All |
| 52 // methods must be invoked on the sync thread. | 53 // methods must be invoked on the sync thread. |
| 53 class SyncEncryptionHandler { | 54 class SyncEncryptionHandler { |
| 54 public: | 55 public: |
| 55 // All Observer methods are done synchronously from within a transaction and | 56 // All Observer methods are done synchronously from within a transaction and |
| 56 // on the sync thread. | 57 // on the sync thread. |
| 57 class Observer { | 58 class SYNC_EXPORT Observer { |
| 58 public: | 59 public: |
| 59 Observer(); | 60 Observer(); |
| 60 | 61 |
| 61 // Called when user interaction is required to obtain a valid passphrase. | 62 // Called when user interaction is required to obtain a valid passphrase. |
| 62 // - If the passphrase is required for encryption, |reason| will be | 63 // - If the passphrase is required for encryption, |reason| will be |
| 63 // REASON_ENCRYPTION. | 64 // REASON_ENCRYPTION. |
| 64 // - If the passphrase is required for the decryption of data that has | 65 // - If the passphrase is required for the decryption of data that has |
| 65 // already been encrypted, |reason| will be REASON_DECRYPTION. | 66 // already been encrypted, |reason| will be REASON_DECRYPTION. |
| 66 // - If the passphrase is required because decryption failed, and a new | 67 // - If the passphrase is required because decryption failed, and a new |
| 67 // passphrase is required, |reason| will be REASON_SET_PASSPHRASE_FAILED. | 68 // passphrase is required, |reason| will be REASON_SET_PASSPHRASE_FAILED. |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 162 |
| 162 // Whether encryption of all datatypes is enabled. If false, only sensitive | 163 // Whether encryption of all datatypes is enabled. If false, only sensitive |
| 163 // types are encrypted. | 164 // types are encrypted. |
| 164 virtual bool EncryptEverythingEnabled() const = 0; | 165 virtual bool EncryptEverythingEnabled() const = 0; |
| 165 | 166 |
| 166 // Returns the current state of the passphrase needed to decrypt the | 167 // Returns the current state of the passphrase needed to decrypt the |
| 167 // bag of encryption keys in the nigori node. | 168 // bag of encryption keys in the nigori node. |
| 168 virtual PassphraseType GetPassphraseType() const = 0; | 169 virtual PassphraseType GetPassphraseType() const = 0; |
| 169 | 170 |
| 170 // The set of types that are always encrypted. | 171 // The set of types that are always encrypted. |
| 171 static ModelTypeSet SensitiveTypes(); | 172 SYNC_EXPORT static ModelTypeSet SensitiveTypes(); |
| 172 }; | 173 }; |
| 173 | 174 |
| 174 } // namespace syncer | 175 } // namespace syncer |
| 175 | 176 |
| 176 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_H_ | 177 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_H_ |
| OLD | NEW |