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_DRIVER_GLUE_SYNC_BACKEND_HOST_H_ | 5 #ifndef COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_H_ |
6 #define COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_H_ | 6 #define COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
15 #include "components/sync/base/model_type.h" | 15 #include "components/sync/base/model_type.h" |
16 #include "components/sync/base/weak_handle.h" | 16 #include "components/sync/base/weak_handle.h" |
17 #include "components/sync/core/configure_reason.h" | 17 #include "components/sync/core/configure_reason.h" |
18 #include "components/sync/core/shutdown_reason.h" | 18 #include "components/sync/core/shutdown_reason.h" |
19 #include "components/sync/core/sync_manager.h" | 19 #include "components/sync/core/sync_manager.h" |
20 #include "components/sync/core/sync_manager_factory.h" | 20 #include "components/sync/core/sync_manager_factory.h" |
| 21 #include "components/sync/driver/backend_data_type_configurer.h" |
21 #include "components/sync/sessions/sync_session_snapshot.h" | 22 #include "components/sync/sessions/sync_session_snapshot.h" |
22 #include "components/sync_driver/backend_data_type_configurer.h" | |
23 | 23 |
24 class GURL; | 24 class GURL; |
25 | 25 |
26 namespace base { | 26 namespace base { |
27 class MessageLoop; | 27 class MessageLoop; |
28 } | 28 } |
29 | 29 |
30 namespace syncer { | 30 namespace syncer { |
31 class CancelationSignal; | 31 class CancelationSignal; |
32 class HttpPostProviderFactory; | 32 class HttpPostProviderFactory; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // encryption. Note that it is an error to call SetEncryptionPassphrase under | 97 // encryption. Note that it is an error to call SetEncryptionPassphrase under |
98 // the following circumstances: | 98 // the following circumstances: |
99 // - An explicit passphrase has already been set | 99 // - An explicit passphrase has already been set |
100 // - |is_explicit| is true and we have pending keys. | 100 // - |is_explicit| is true and we have pending keys. |
101 // When |is_explicit| is false, a couple of things could happen: | 101 // When |is_explicit| is false, a couple of things could happen: |
102 // - If there are pending keys, we try to decrypt them. If decryption works, | 102 // - If there are pending keys, we try to decrypt them. If decryption works, |
103 // this acts like a call to SetDecryptionPassphrase. If not, the GAIA | 103 // this acts like a call to SetDecryptionPassphrase. If not, the GAIA |
104 // passphrase passed in is cached so we can re-encrypt with it in future. | 104 // passphrase passed in is cached so we can re-encrypt with it in future. |
105 // - If there are no pending keys, data is encrypted with |passphrase| (this | 105 // - If there are no pending keys, data is encrypted with |passphrase| (this |
106 // is a no-op if data was already encrypted with |passphrase|.) | 106 // is a no-op if data was already encrypted with |passphrase|.) |
107 virtual void SetEncryptionPassphrase( | 107 virtual void SetEncryptionPassphrase(const std::string& passphrase, |
108 const std::string& passphrase, | 108 bool is_explicit) = 0; |
109 bool is_explicit) = 0; | |
110 | 109 |
111 // Called on |frontend_loop_| to use the provided passphrase to asynchronously | 110 // Called on |frontend_loop_| to use the provided passphrase to asynchronously |
112 // attempt decryption. Returns false immediately if the passphrase could not | 111 // attempt decryption. Returns false immediately if the passphrase could not |
113 // be used to decrypt a locally cached copy of encrypted keys; returns true | 112 // be used to decrypt a locally cached copy of encrypted keys; returns true |
114 // otherwise. If new encrypted keys arrive during the asynchronous call, | 113 // otherwise. If new encrypted keys arrive during the asynchronous call, |
115 // OnPassphraseRequired may be triggered at a later time. It is an error to | 114 // OnPassphraseRequired may be triggered at a later time. It is an error to |
116 // call this when there are no pending keys. | 115 // call this when there are no pending keys. |
117 virtual bool SetDecryptionPassphrase(const std::string& passphrase) | 116 virtual bool SetDecryptionPassphrase(const std::string& passphrase) |
118 WARN_UNUSED_RESULT = 0; | 117 WARN_UNUSED_RESULT = 0; |
119 | 118 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 virtual void EnableEncryptEverything() = 0; | 157 virtual void EnableEncryptEverything() = 0; |
159 | 158 |
160 // Called on |frontend_loop_| to obtain a handle to the UserShare needed for | 159 // Called on |frontend_loop_| to obtain a handle to the UserShare needed for |
161 // creating transactions. Should not be called before we signal | 160 // creating transactions. Should not be called before we signal |
162 // initialization is complete with OnBackendInitialized(). | 161 // initialization is complete with OnBackendInitialized(). |
163 virtual syncer::UserShare* GetUserShare() const = 0; | 162 virtual syncer::UserShare* GetUserShare() const = 0; |
164 | 163 |
165 // Called from any thread to obtain current status information in detailed or | 164 // Called from any thread to obtain current status information in detailed or |
166 // summarized form. | 165 // summarized form. |
167 virtual Status GetDetailedStatus() = 0; | 166 virtual Status GetDetailedStatus() = 0; |
168 virtual syncer::sessions::SyncSessionSnapshot | 167 virtual syncer::sessions::SyncSessionSnapshot GetLastSessionSnapshot() |
169 GetLastSessionSnapshot() const = 0; | 168 const = 0; |
170 | 169 |
171 // Determines if the underlying sync engine has made any local changes to | 170 // Determines if the underlying sync engine has made any local changes to |
172 // items that have not yet been synced with the server. | 171 // items that have not yet been synced with the server. |
173 // ONLY CALL THIS IF OnInitializationComplete was called! | 172 // ONLY CALL THIS IF OnInitializationComplete was called! |
174 virtual bool HasUnsyncedItems() const = 0; | 173 virtual bool HasUnsyncedItems() const = 0; |
175 | 174 |
176 // Whether or not we are syncing encryption keys. | 175 // Whether or not we are syncing encryption keys. |
177 virtual bool IsNigoriEnabled() const = 0; | 176 virtual bool IsNigoriEnabled() const = 0; |
178 | 177 |
179 // Returns the type of passphrase being used to encrypt data. See | 178 // Returns the type of passphrase being used to encrypt data. See |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 // See SyncManager::OnCookieJarChanged. | 232 // See SyncManager::OnCookieJarChanged. |
234 virtual void OnCookieJarChanged(bool account_mismatch, bool empty_jar) = 0; | 233 virtual void OnCookieJarChanged(bool account_mismatch, bool empty_jar) = 0; |
235 | 234 |
236 private: | 235 private: |
237 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); | 236 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); |
238 }; | 237 }; |
239 | 238 |
240 } // namespace browser_sync | 239 } // namespace browser_sync |
241 | 240 |
242 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_H_ | 241 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_H_ |
OLD | NEW |