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

Side by Side Diff: components/sync/core/sync_encryption_handler.h

Issue 2240613002: [Sync] Convert sync to a static library. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Try getting rid of sync_core source set. Created 4 years, 4 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
« no previous file with comments | « components/sync/core/simple_metadata_change_list.h ('k') | components/sync/core/sync_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef COMPONENTS_SYNC_CORE_SYNC_ENCRYPTION_HANDLER_H_ 5 #ifndef COMPONENTS_SYNC_CORE_SYNC_ENCRYPTION_HANDLER_H_
6 #define COMPONENTS_SYNC_CORE_SYNC_ENCRYPTION_HANDLER_H_ 6 #define COMPONENTS_SYNC_CORE_SYNC_ENCRYPTION_HANDLER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 #include "components/sync/base/model_type.h" 11 #include "components/sync/base/model_type.h"
12 #include "components/sync/base/sync_export.h"
13 #include "components/sync/protocol/sync.pb.h" 12 #include "components/sync/protocol/sync.pb.h"
14 13
15 namespace syncer { 14 namespace syncer {
16 15
17 class Cryptographer; 16 class Cryptographer;
18 17
19 // Reasons due to which Cryptographer might require a passphrase. 18 // Reasons due to which Cryptographer might require a passphrase.
20 enum PassphraseRequiredReason { 19 enum PassphraseRequiredReason {
21 REASON_PASSPHRASE_NOT_REQUIRED = 0, // Initial value. 20 REASON_PASSPHRASE_NOT_REQUIRED = 0, // Initial value.
22 REASON_ENCRYPTION = 1, // The cryptographer requires a 21 REASON_ENCRYPTION = 1, // The cryptographer requires a
(...skipping 21 matching lines...) Expand all
44 enum BootstrapTokenType { 43 enum BootstrapTokenType {
45 PASSPHRASE_BOOTSTRAP_TOKEN, 44 PASSPHRASE_BOOTSTRAP_TOKEN,
46 KEYSTORE_BOOTSTRAP_TOKEN 45 KEYSTORE_BOOTSTRAP_TOKEN
47 }; 46 };
48 47
49 // Sync's encryption handler. Handles tracking encrypted types, ensuring the 48 // Sync's encryption handler. Handles tracking encrypted types, ensuring the
50 // cryptographer encrypts with the proper key and has the most recent keybag, 49 // cryptographer encrypts with the proper key and has the most recent keybag,
51 // and keeps the nigori node up to date. 50 // and keeps the nigori node up to date.
52 // Implementations of this class must be assumed to be non-thread-safe. All 51 // Implementations of this class must be assumed to be non-thread-safe. All
53 // methods must be invoked on the sync thread. 52 // methods must be invoked on the sync thread.
54 class SYNC_EXPORT SyncEncryptionHandler { 53 class SyncEncryptionHandler {
55 public: 54 public:
56 class NigoriState; 55 class NigoriState;
57 56
58 // All Observer methods are done synchronously from within a transaction and 57 // All Observer methods are done synchronously from within a transaction and
59 // on the sync thread. 58 // on the sync thread.
60 class SYNC_EXPORT Observer { 59 class Observer {
61 public: 60 public:
62 Observer(); 61 Observer();
63 62
64 // Called when user interaction is required to obtain a valid passphrase. 63 // Called when user interaction is required to obtain a valid passphrase.
65 // - If the passphrase is required for encryption, |reason| will be 64 // - If the passphrase is required for encryption, |reason| will be
66 // REASON_ENCRYPTION. 65 // REASON_ENCRYPTION.
67 // - If the passphrase is required for the decryption of data that has 66 // - If the passphrase is required for the decryption of data that has
68 // already been encrypted, |reason| will be REASON_DECRYPTION. 67 // already been encrypted, |reason| will be REASON_DECRYPTION.
69 // - If the passphrase is required because decryption failed, and a new 68 // - If the passphrase is required because decryption failed, and a new
70 // passphrase is required, |reason| will be REASON_SET_PASSPHRASE_FAILED. 69 // passphrase is required, |reason| will be REASON_SET_PASSPHRASE_FAILED.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // |nigori_state| can be used to restore nigori state across 124 // |nigori_state| can be used to restore nigori state across
126 // SyncEncryptionHandlerImpl lifetimes. See also SyncEncryptionHandlerImpl's 125 // SyncEncryptionHandlerImpl lifetimes. See also SyncEncryptionHandlerImpl's
127 // RestoredNigori method. 126 // RestoredNigori method.
128 virtual void OnLocalSetPassphraseEncryption( 127 virtual void OnLocalSetPassphraseEncryption(
129 const NigoriState& nigori_state) = 0; 128 const NigoriState& nigori_state) = 0;
130 129
131 protected: 130 protected:
132 virtual ~Observer(); 131 virtual ~Observer();
133 }; 132 };
134 133
135 class SYNC_EXPORT NigoriState { 134 class NigoriState {
136 public: 135 public:
137 NigoriState() {} 136 NigoriState() {}
138 sync_pb::NigoriSpecifics nigori_specifics; 137 sync_pb::NigoriSpecifics nigori_specifics;
139 }; 138 };
140 139
141 SyncEncryptionHandler(); 140 SyncEncryptionHandler();
142 virtual ~SyncEncryptionHandler(); 141 virtual ~SyncEncryptionHandler();
143 142
144 // Add/Remove SyncEncryptionHandler::Observers. 143 // Add/Remove SyncEncryptionHandler::Observers.
145 virtual void AddObserver(Observer* observer) = 0; 144 virtual void AddObserver(Observer* observer) = 0;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 // bag of encryption keys in the nigori node. 181 // bag of encryption keys in the nigori node.
183 virtual PassphraseType GetPassphraseType() const = 0; 182 virtual PassphraseType GetPassphraseType() const = 0;
184 183
185 // The set of types that are always encrypted. 184 // The set of types that are always encrypted.
186 static ModelTypeSet SensitiveTypes(); 185 static ModelTypeSet SensitiveTypes();
187 }; 186 };
188 187
189 } // namespace syncer 188 } // namespace syncer
190 189
191 #endif // COMPONENTS_SYNC_CORE_SYNC_ENCRYPTION_HANDLER_H_ 190 #endif // COMPONENTS_SYNC_CORE_SYNC_ENCRYPTION_HANDLER_H_
OLDNEW
« no previous file with comments | « components/sync/core/simple_metadata_change_list.h ('k') | components/sync/core/sync_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698