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

Side by Side Diff: components/sync/engine/sync_engine.h

Issue 2663783002: [Sync] Split encryption state and logic out of PSS and SBHI. (Closed)
Patch Set: Tweak comment. Created 3 years, 10 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
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_ENGINE_SYNC_ENGINE_H_ 5 #ifndef COMPONENTS_SYNC_ENGINE_SYNC_ENGINE_H_
6 #define COMPONENTS_SYNC_ENGINE_SYNC_ENGINE_H_ 6 #define COMPONENTS_SYNC_ENGINE_SYNC_ENGINE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 // Utility struct for holding initialization options. 50 // Utility struct for holding initialization options.
51 struct InitParams { 51 struct InitParams {
52 InitParams(); 52 InitParams();
53 InitParams(InitParams&& other); 53 InitParams(InitParams&& other);
54 ~InitParams(); 54 ~InitParams();
55 55
56 scoped_refptr<base::SingleThreadTaskRunner> sync_task_runner; 56 scoped_refptr<base::SingleThreadTaskRunner> sync_task_runner;
57 SyncEngineHost* host = nullptr; 57 SyncEngineHost* host = nullptr;
58 std::unique_ptr<SyncBackendRegistrar> registrar; 58 std::unique_ptr<SyncBackendRegistrar> registrar;
59 std::unique_ptr<SyncEncryptionHandler::Observer> encryption_observer_proxy;
59 scoped_refptr<ExtensionsActivity> extensions_activity; 60 scoped_refptr<ExtensionsActivity> extensions_activity;
60 WeakHandle<JsEventHandler> event_handler; 61 WeakHandle<JsEventHandler> event_handler;
61 GURL service_url; 62 GURL service_url;
62 std::string sync_user_agent; 63 std::string sync_user_agent;
63 SyncEngine::HttpPostProviderFactoryGetter http_factory_getter; 64 SyncEngine::HttpPostProviderFactoryGetter http_factory_getter;
64 SyncCredentials credentials; 65 SyncCredentials credentials;
65 std::string invalidator_client_id; 66 std::string invalidator_client_id;
66 std::unique_ptr<SyncManagerFactory> sync_manager_factory; 67 std::unique_ptr<SyncManagerFactory> sync_manager_factory;
67 bool delete_sync_data_folder = false; 68 bool delete_sync_data_folder = false;
68 bool enable_local_sync_backend = false; 69 bool enable_local_sync_backend = false;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // - |is_explicit| is true and we have pending keys. 112 // - |is_explicit| is true and we have pending keys.
112 // When |is_explicit| is false, a couple of things could happen: 113 // When |is_explicit| is false, a couple of things could happen:
113 // - If there are pending keys, we try to decrypt them. If decryption works, 114 // - If there are pending keys, we try to decrypt them. If decryption works,
114 // this acts like a call to SetDecryptionPassphrase. If not, the GAIA 115 // this acts like a call to SetDecryptionPassphrase. If not, the GAIA
115 // passphrase passed in is cached so we can re-encrypt with it in future. 116 // passphrase passed in is cached so we can re-encrypt with it in future.
116 // - If there are no pending keys, data is encrypted with |passphrase| (this 117 // - If there are no pending keys, data is encrypted with |passphrase| (this
117 // is a no-op if data was already encrypted with |passphrase|.) 118 // is a no-op if data was already encrypted with |passphrase|.)
118 virtual void SetEncryptionPassphrase(const std::string& passphrase, 119 virtual void SetEncryptionPassphrase(const std::string& passphrase,
119 bool is_explicit) = 0; 120 bool is_explicit) = 0;
120 121
121 // Use the provided passphrase to asynchronously attempt decryption. Returns 122 // Use the provided passphrase to asynchronously attempt decryption. If new
122 // false immediately if the passphrase could not be used to decrypt a locally 123 // encrypted keys arrive during the asynchronous call, OnPassphraseRequired
123 // cached copy of encrypted keys; returns true otherwise. If new encrypted 124 // may be triggered at a later time. It is an error to call this when there
124 // keys arrive during the asynchronous call, OnPassphraseRequired may be 125 // are no pending keys.
125 // triggered at a later time. It is an error to call this when there are no 126 virtual void SetDecryptionPassphrase(const std::string& passphrase) = 0;
126 // pending keys.
127 virtual bool SetDecryptionPassphrase(const std::string& passphrase)
128 WARN_UNUSED_RESULT = 0;
129 127
130 // Kick off shutdown procedure. Attempts to cut short any long-lived or 128 // Kick off shutdown procedure. Attempts to cut short any long-lived or
131 // blocking sync thread tasks so that the shutdown on sync thread task that 129 // blocking sync thread tasks so that the shutdown on sync thread task that
132 // we're about to post won't have to wait very long. 130 // we're about to post won't have to wait very long.
133 virtual void StopSyncingForShutdown() = 0; 131 virtual void StopSyncingForShutdown() = 0;
134 132
135 // See the implementation and Core::DoShutdown for details. 133 // See the implementation and Core::DoShutdown for details.
136 // Must be called *after* StopSyncingForShutdown. 134 // Must be called *after* StopSyncingForShutdown.
137 virtual void Shutdown(ShutdownReason reason) = 0; 135 virtual void Shutdown(ShutdownReason reason) = 0;
138 136
139 // Turns on encryption of all present and future sync data. 137 // Turns on encryption of all present and future sync data.
140 virtual void EnableEncryptEverything() = 0; 138 virtual void EnableEncryptEverything() = 0;
141 139
142 // Obtain a handle to the UserShare needed for creating transactions. Should 140 // Obtain a handle to the UserShare needed for creating transactions. Should
143 // not be called before we signal initialization is complete with 141 // not be called before we signal initialization is complete with
144 // OnBackendInitialized(). 142 // OnBackendInitialized().
145 virtual UserShare* GetUserShare() const = 0; 143 virtual UserShare* GetUserShare() const = 0;
146 144
147 // Called from any thread to obtain current detailed status information. 145 // Called from any thread to obtain current detailed status information.
148 virtual Status GetDetailedStatus() = 0; 146 virtual Status GetDetailedStatus() = 0;
149 147
150 // Determines if the underlying sync engine has made any local changes to 148 // Determines if the underlying sync engine has made any local changes to
151 // items that have not yet been synced with the server. 149 // items that have not yet been synced with the server.
152 // ONLY CALL THIS IF OnInitializationComplete was called! 150 // ONLY CALL THIS IF OnInitializationComplete was called!
153 virtual bool HasUnsyncedItems() const = 0; 151 virtual bool HasUnsyncedItems() const = 0;
154 152
155 // Whether or not we are syncing encryption keys.
156 virtual bool IsNigoriEnabled() const = 0;
157
158 // Returns the type of passphrase being used to encrypt data. See
159 // sync_encryption_handler.h.
160 virtual PassphraseType GetPassphraseType() const = 0;
161
162 // If an explicit passphrase is in use, returns the time at which that
163 // passphrase was set (if available).
164 virtual base::Time GetExplicitPassphraseTime() const = 0;
165
166 // True if the cryptographer has any keys available to attempt decryption. 153 // True if the cryptographer has any keys available to attempt decryption.
167 // Could mean we've downloaded and loaded Nigori objects, or we bootstrapped 154 // Could mean we've downloaded and loaded Nigori objects, or we bootstrapped
168 // using a token previously received. 155 // using a token previously received.
169 virtual bool IsCryptographerReady(const BaseTransaction* trans) const = 0; 156 virtual bool IsCryptographerReady(const BaseTransaction* trans) const = 0;
170 157
171 virtual void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) const = 0; 158 virtual void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) const = 0;
172 159
173 // Send a message to the sync thread to persist the Directory to disk. 160 // Send a message to the sync thread to persist the Directory to disk.
174 virtual void FlushDirectory() const = 0; 161 virtual void FlushDirectory() const = 0;
175 162
(...skipping 25 matching lines...) Expand all
201 // See SyncManager::OnCookieJarChanged. 188 // See SyncManager::OnCookieJarChanged.
202 virtual void OnCookieJarChanged(bool account_mismatch, bool empty_jar) = 0; 189 virtual void OnCookieJarChanged(bool account_mismatch, bool empty_jar) = 0;
203 190
204 private: 191 private:
205 DISALLOW_COPY_AND_ASSIGN(SyncEngine); 192 DISALLOW_COPY_AND_ASSIGN(SyncEngine);
206 }; 193 };
207 194
208 } // namespace syncer 195 } // namespace syncer
209 196
210 #endif // COMPONENTS_SYNC_ENGINE_SYNC_ENGINE_H_ 197 #endif // COMPONENTS_SYNC_ENGINE_SYNC_ENGINE_H_
OLDNEW
« no previous file with comments | « components/sync/engine/sync_encryption_handler.h ('k') | components/sync/engine/sync_engine_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698