| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_MANAGER_H_ | 5 #ifndef SYNC_INTERNAL_API_SYNC_MANAGER_H_ |
| 6 #define SYNC_INTERNAL_API_SYNC_MANAGER_H_ | 6 #define SYNC_INTERNAL_API_SYNC_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 virtual void AddObserver(SyncManager::Observer* observer) OVERRIDE; | 108 virtual void AddObserver(SyncManager::Observer* observer) OVERRIDE; |
| 109 virtual void RemoveObserver(SyncManager::Observer* observer) OVERRIDE; | 109 virtual void RemoveObserver(SyncManager::Observer* observer) OVERRIDE; |
| 110 virtual SyncStatus GetDetailedStatus() const OVERRIDE; | 110 virtual SyncStatus GetDetailedStatus() const OVERRIDE; |
| 111 virtual bool IsUsingExplicitPassphrase() OVERRIDE; | 111 virtual bool IsUsingExplicitPassphrase() OVERRIDE; |
| 112 virtual bool GetKeystoreKeyBootstrapToken(std::string* token) OVERRIDE; | 112 virtual bool GetKeystoreKeyBootstrapToken(std::string* token) OVERRIDE; |
| 113 virtual void SaveChanges() OVERRIDE; | 113 virtual void SaveChanges() OVERRIDE; |
| 114 virtual void StopSyncingForShutdown(const base::Closure& callback) OVERRIDE; | 114 virtual void StopSyncingForShutdown(const base::Closure& callback) OVERRIDE; |
| 115 virtual void ShutdownOnSyncThread() OVERRIDE; | 115 virtual void ShutdownOnSyncThread() OVERRIDE; |
| 116 virtual UserShare* GetUserShare() OVERRIDE; | 116 virtual UserShare* GetUserShare() OVERRIDE; |
| 117 | 117 |
| 118 // Update the Cryptographer from the current nigori node and write back any | 118 virtual void InitialProcessMetadata( |
| 119 // necessary changes to the nigori node. We also detect missing encryption | 119 const std::string& chrome_version, |
| 120 // keys and write them into the nigori node. | 120 const base::Closure& done_callback) OVERRIDE; |
| 121 // Also updates or adds the device information into the nigori node. | |
| 122 // Note: opens a transaction and can trigger an ON_PASSPHRASE_REQUIRED, so | |
| 123 // should only be called after syncapi is fully initialized. | |
| 124 // Calls the callback argument with true if cryptographer is ready, false | |
| 125 // otherwise. | |
| 126 virtual void RefreshNigori(const std::string& chrome_version, | |
| 127 const base::Closure& done_callback) OVERRIDE; | |
| 128 | 121 |
| 129 virtual void EnableEncryptEverything() OVERRIDE; | 122 virtual void EnableEncryptEverything() OVERRIDE; |
| 130 virtual bool ReceivedExperiment(Experiments* experiments) OVERRIDE; | 123 virtual bool ReceivedExperiment(Experiments* experiments) OVERRIDE; |
| 131 virtual bool HasUnsyncedItems() OVERRIDE; | 124 virtual bool HasUnsyncedItems() OVERRIDE; |
| 132 | 125 |
| 133 // Return the currently active (validated) username for use with syncable | 126 // Return the currently active (validated) username for use with syncable |
| 134 // types. | 127 // types. |
| 135 const std::string& username_for_share() const; | 128 const std::string& username_for_share() const; |
| 136 | 129 |
| 137 static int GetDefaultNudgeDelay(); | 130 static int GetDefaultNudgeDelay(); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 // ExtraPasswordChangeRecordData field of |buffer|. Otherwise sets | 240 // ExtraPasswordChangeRecordData field of |buffer|. Otherwise sets |
| 248 // |buffer|'s specifics field to contain the unencrypted data. | 241 // |buffer|'s specifics field to contain the unencrypted data. |
| 249 void SetExtraChangeRecordData(int64 id, | 242 void SetExtraChangeRecordData(int64 id, |
| 250 ModelType type, | 243 ModelType type, |
| 251 ChangeReorderBuffer* buffer, | 244 ChangeReorderBuffer* buffer, |
| 252 Cryptographer* cryptographer, | 245 Cryptographer* cryptographer, |
| 253 const syncable::EntryKernel& original, | 246 const syncable::EntryKernel& original, |
| 254 bool existed_before, | 247 bool existed_before, |
| 255 bool exists_now); | 248 bool exists_now); |
| 256 | 249 |
| 250 // Because the session name must be fetched asynchronously, |
| 251 // InitialProcessMetadata() is split into two parts. This is the second. |
| 252 void InitialProcessMetadataContinuation( |
| 253 const std::string& chrome_version, |
| 254 const base::Closure& done_callback, |
| 255 const std::string& session_name); |
| 256 |
| 257 void UpdateDeviceInformation(const std::string& chrome_version, |
| 258 const std::string& session_name); |
| 259 |
| 257 // Stores the current set of encryption keys (if the cryptographer is ready) | 260 // Stores the current set of encryption keys (if the cryptographer is ready) |
| 258 // and encrypted types into the nigori node. | 261 // and encrypted types into the nigori node. |
| 259 void UpdateNigoriEncryptionState(Cryptographer* cryptographer, | 262 void UpdateNigoriEncryptionState(Cryptographer* cryptographer, |
| 260 WriteNode* nigori_node); | 263 WriteNode* nigori_node); |
| 261 | 264 |
| 262 // Internal callback of UpdateCryptographerAndNigoriCallback. | 265 // Updates the cryptographer from the current nigori node. Informs it of the |
| 263 void UpdateCryptographerAndNigoriCallback( | 266 // most recent passphrase and set of encrypted types (from nigori node), then |
| 264 const std::string& chrome_version, | 267 // ensure all data that needs encryption is encrypted with the appropriate |
| 265 const base::Closure& done_callback, | 268 // passphrase. Then writes this back to the ngiori node. |
| 266 const std::string& session_name); | 269 // |
| 270 // May trigger OnPassphraseRequired(). Otherwise, it will trigger |
| 271 // OnEncryptedTypesChanged() if necessary (see comments for |
| 272 // OnEncryptedTypesChanged()), and then OnEncryptionComplete(). |
| 273 // |
| 274 // Note: opens a transaction and can trigger an ON_PASSPHRASE_REQUIRED, so |
| 275 // should only be called after syncapi is fully initialized. |
| 276 void UpdateCryptographerAndNigori(); |
| 267 | 277 |
| 268 // Updates the nigori node with any new encrypted types and then | 278 // Updates the nigori node with any new encrypted types and then |
| 269 // encrypts the nodes for those new data types as well as other | 279 // encrypts the nodes for those new data types as well as other |
| 270 // nodes that should be encrypted but aren't. Triggers | 280 // nodes that should be encrypted but aren't. Triggers |
| 271 // OnPassphraseRequired if the cryptographer isn't ready. | 281 // OnPassphraseRequired if the cryptographer isn't ready. |
| 272 void RefreshEncryption(); | 282 void RefreshEncryption(); |
| 273 | 283 |
| 274 void ReEncryptEverything(WriteTransaction* trans); | 284 void ReEncryptEverything(WriteTransaction* trans); |
| 275 | 285 |
| 276 // The final step of SetEncryptionPassphrase and SetDecryptionPassphrase that | 286 // The final step of SetEncryptionPassphrase and SetDecryptionPassphrase that |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 // conflict resolver) updated the nigori's encryption keys in this chrome | 429 // conflict resolver) updated the nigori's encryption keys in this chrome |
| 420 // instantiation. | 430 // instantiation. |
| 421 int nigori_overwrite_count_; | 431 int nigori_overwrite_count_; |
| 422 | 432 |
| 423 DISALLOW_COPY_AND_ASSIGN(SyncManagerImpl); | 433 DISALLOW_COPY_AND_ASSIGN(SyncManagerImpl); |
| 424 }; | 434 }; |
| 425 | 435 |
| 426 } // namespace syncer | 436 } // namespace syncer |
| 427 | 437 |
| 428 #endif // SYNC_INTERNAL_API_SYNC_MANAGER_H_ | 438 #endif // SYNC_INTERNAL_API_SYNC_MANAGER_H_ |
| OLD | NEW |