| 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_PUBLIC_SYNC_MANAGER_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ |
| 6 #define SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 class HttpPostProviderFactory; | 53 class HttpPostProviderFactory; |
| 54 struct UserShare; | 54 struct UserShare; |
| 55 | 55 |
| 56 // Used by SyncManager::OnConnectionStatusChange(). | 56 // Used by SyncManager::OnConnectionStatusChange(). |
| 57 enum ConnectionStatus { | 57 enum ConnectionStatus { |
| 58 CONNECTION_OK, | 58 CONNECTION_OK, |
| 59 CONNECTION_AUTH_ERROR, | 59 CONNECTION_AUTH_ERROR, |
| 60 CONNECTION_SERVER_ERROR | 60 CONNECTION_SERVER_ERROR |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 // Reasons due to which syncer::Cryptographer might require a passphrase. | 63 // Reasons due to which Cryptographer might require a passphrase. |
| 64 enum PassphraseRequiredReason { | 64 enum PassphraseRequiredReason { |
| 65 REASON_PASSPHRASE_NOT_REQUIRED = 0, // Initial value. | 65 REASON_PASSPHRASE_NOT_REQUIRED = 0, // Initial value. |
| 66 REASON_ENCRYPTION = 1, // The cryptographer requires a | 66 REASON_ENCRYPTION = 1, // The cryptographer requires a |
| 67 // passphrase for its first attempt at | 67 // passphrase for its first attempt at |
| 68 // encryption. Happens only during | 68 // encryption. Happens only during |
| 69 // migration or upgrade. | 69 // migration or upgrade. |
| 70 REASON_DECRYPTION = 2, // The cryptographer requires a | 70 REASON_DECRYPTION = 2, // The cryptographer requires a |
| 71 // passphrase for its first attempt at | 71 // passphrase for its first attempt at |
| 72 // decryption. | 72 // decryption. |
| 73 }; | 73 }; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // 3. New items with synced parents & predecessors. | 113 // 3. New items with synced parents & predecessors. |
| 114 // 4. Items with parents & predecessors in |changes|. | 114 // 4. Items with parents & predecessors in |changes|. |
| 115 // 5. Repeat #4 until all items are in |changes|. | 115 // 5. Repeat #4 until all items are in |changes|. |
| 116 // | 116 // |
| 117 // Thus, an implementation of OnChangesApplied should be able to | 117 // Thus, an implementation of OnChangesApplied should be able to |
| 118 // process the change records in the order without having to worry about | 118 // process the change records in the order without having to worry about |
| 119 // forward dependencies. But since deletions come before reparent | 119 // forward dependencies. But since deletions come before reparent |
| 120 // operations, a delete may temporarily orphan a node that is | 120 // operations, a delete may temporarily orphan a node that is |
| 121 // updated later in the list. | 121 // updated later in the list. |
| 122 virtual void OnChangesApplied( | 122 virtual void OnChangesApplied( |
| 123 syncer::ModelType model_type, | 123 ModelType model_type, |
| 124 const BaseTransaction* trans, | 124 const BaseTransaction* trans, |
| 125 const ImmutableChangeRecordList& changes) = 0; | 125 const ImmutableChangeRecordList& changes) = 0; |
| 126 | 126 |
| 127 // OnChangesComplete gets called when the TransactionComplete event is | 127 // OnChangesComplete gets called when the TransactionComplete event is |
| 128 // posted (after OnChangesApplied finishes), after the transaction lock | 128 // posted (after OnChangesApplied finishes), after the transaction lock |
| 129 // and the change channel mutex are released. | 129 // and the change channel mutex are released. |
| 130 // | 130 // |
| 131 // The purpose of this function is to support processors that require | 131 // The purpose of this function is to support processors that require |
| 132 // split-transactions changes. For example, if a model processor wants to | 132 // split-transactions changes. For example, if a model processor wants to |
| 133 // perform blocking I/O due to a change, it should calculate the changes | 133 // perform blocking I/O due to a change, it should calculate the changes |
| 134 // while holding the transaction lock (from within OnChangesApplied), buffer | 134 // while holding the transaction lock (from within OnChangesApplied), buffer |
| 135 // those changes, let the transaction fall out of scope, and then commit | 135 // those changes, let the transaction fall out of scope, and then commit |
| 136 // those changes from within OnChangesComplete (postponing the blocking | 136 // those changes from within OnChangesComplete (postponing the blocking |
| 137 // I/O to when it no longer holds any lock). | 137 // I/O to when it no longer holds any lock). |
| 138 virtual void OnChangesComplete(syncer::ModelType model_type) = 0; | 138 virtual void OnChangesComplete(ModelType model_type) = 0; |
| 139 | 139 |
| 140 protected: | 140 protected: |
| 141 virtual ~ChangeDelegate(); | 141 virtual ~ChangeDelegate(); |
| 142 }; | 142 }; |
| 143 | 143 |
| 144 // Like ChangeDelegate, except called only on the sync thread and | 144 // Like ChangeDelegate, except called only on the sync thread and |
| 145 // not while a transaction is held. For objects that want to know | 145 // not while a transaction is held. For objects that want to know |
| 146 // when changes happen, but don't need to process them. | 146 // when changes happen, but don't need to process them. |
| 147 class ChangeObserver { | 147 class ChangeObserver { |
| 148 public: | 148 public: |
| 149 // Ids referred to in |changes| may or may not be in the write | 149 // Ids referred to in |changes| may or may not be in the write |
| 150 // transaction specified by |write_transaction_id|. If they're | 150 // transaction specified by |write_transaction_id|. If they're |
| 151 // not, that means that the node didn't actually change, but we | 151 // not, that means that the node didn't actually change, but we |
| 152 // marked them as changed for some other reason (e.g., siblings of | 152 // marked them as changed for some other reason (e.g., siblings of |
| 153 // re-ordered nodes). | 153 // re-ordered nodes). |
| 154 // | 154 // |
| 155 // TODO(sync, long-term): Ideally, ChangeDelegate/Observer would | 155 // TODO(sync, long-term): Ideally, ChangeDelegate/Observer would |
| 156 // be passed a transformed version of EntryKernelMutation instead | 156 // be passed a transformed version of EntryKernelMutation instead |
| 157 // of a transaction that would have to be used to look up the | 157 // of a transaction that would have to be used to look up the |
| 158 // changed nodes. That is, ChangeDelegate::OnChangesApplied() | 158 // changed nodes. That is, ChangeDelegate::OnChangesApplied() |
| 159 // would still be called under the transaction, but all the needed | 159 // would still be called under the transaction, but all the needed |
| 160 // data will be passed down. | 160 // data will be passed down. |
| 161 // | 161 // |
| 162 // Even more ideally, we would have sync semantics such that we'd | 162 // Even more ideally, we would have sync semantics such that we'd |
| 163 // be able to apply changes without being under a transaction. | 163 // be able to apply changes without being under a transaction. |
| 164 // But that's a ways off... | 164 // But that's a ways off... |
| 165 virtual void OnChangesApplied( | 165 virtual void OnChangesApplied( |
| 166 syncer::ModelType model_type, | 166 ModelType model_type, |
| 167 int64 write_transaction_id, | 167 int64 write_transaction_id, |
| 168 const ImmutableChangeRecordList& changes) = 0; | 168 const ImmutableChangeRecordList& changes) = 0; |
| 169 | 169 |
| 170 virtual void OnChangesComplete(syncer::ModelType model_type) = 0; | 170 virtual void OnChangesComplete(ModelType model_type) = 0; |
| 171 | 171 |
| 172 protected: | 172 protected: |
| 173 virtual ~ChangeObserver(); | 173 virtual ~ChangeObserver(); |
| 174 }; | 174 }; |
| 175 | 175 |
| 176 // An interface the embedding application implements to receive | 176 // An interface the embedding application implements to receive |
| 177 // notifications from the SyncManager. Register an observer via | 177 // notifications from the SyncManager. Register an observer via |
| 178 // SyncManager::AddObserver. All methods are called only on the | 178 // SyncManager::AddObserver. All methods are called only on the |
| 179 // sync thread. | 179 // sync thread. |
| 180 class Observer { | 180 class Observer { |
| 181 public: | 181 public: |
| 182 // A round-trip sync-cycle took place and the syncer has resolved any | 182 // A round-trip sync-cycle took place and the syncer has resolved any |
| 183 // conflicts that may have arisen. | 183 // conflicts that may have arisen. |
| 184 virtual void OnSyncCycleCompleted( | 184 virtual void OnSyncCycleCompleted( |
| 185 const syncer::sessions::SyncSessionSnapshot& snapshot) = 0; | 185 const sessions::SyncSessionSnapshot& snapshot) = 0; |
| 186 | 186 |
| 187 // Called when the status of the connection to the sync server has | 187 // Called when the status of the connection to the sync server has |
| 188 // changed. | 188 // changed. |
| 189 virtual void OnConnectionStatusChange(ConnectionStatus status) = 0; | 189 virtual void OnConnectionStatusChange(ConnectionStatus status) = 0; |
| 190 | 190 |
| 191 // Called when a new auth token is provided by the sync server. | 191 // Called when a new auth token is provided by the sync server. |
| 192 virtual void OnUpdatedToken(const std::string& token) = 0; | 192 virtual void OnUpdatedToken(const std::string& token) = 0; |
| 193 | 193 |
| 194 // Called when user interaction is required to obtain a valid passphrase. | 194 // Called when user interaction is required to obtain a valid passphrase. |
| 195 // - If the passphrase is required for encryption, |reason| will be | 195 // - If the passphrase is required for encryption, |reason| will be |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 * Gets child ids for a given id. | 291 * Gets child ids for a given id. |
| 292 * | 292 * |
| 293 * @param {string} id 64-bit id in decimal string form of the parent | 293 * @param {string} id 64-bit id in decimal string form of the parent |
| 294 * node. | 294 * node. |
| 295 * @param {Array.<string>} callback Called with the (possibly empty) | 295 * @param {Array.<string>} callback Called with the (possibly empty) |
| 296 * list of child ids. | 296 * list of child ids. |
| 297 */ | 297 */ |
| 298 // function getChildNodeIds(id); | 298 // function getChildNodeIds(id); |
| 299 | 299 |
| 300 virtual void OnInitializationComplete( | 300 virtual void OnInitializationComplete( |
| 301 const syncer::WeakHandle<syncer::JsBackend>& | 301 const WeakHandle<JsBackend>& js_backend, bool success) = 0; |
| 302 js_backend, bool success) = 0; | |
| 303 | 302 |
| 304 // We are no longer permitted to communicate with the server. Sync should | 303 // We are no longer permitted to communicate with the server. Sync should |
| 305 // be disabled and state cleaned up at once. This can happen for a number | 304 // be disabled and state cleaned up at once. This can happen for a number |
| 306 // of reasons, e.g. swapping from a test instance to production, or a | 305 // of reasons, e.g. swapping from a test instance to production, or a |
| 307 // global stop syncing operation has wiped the store. | 306 // global stop syncing operation has wiped the store. |
| 308 virtual void OnStopSyncingPermanently() = 0; | 307 virtual void OnStopSyncingPermanently() = 0; |
| 309 | 308 |
| 310 // Called when the set of encrypted types or the encrypt | 309 // Called when the set of encrypted types or the encrypt |
| 311 // everything flag has been changed. Note that encryption isn't | 310 // everything flag has been changed. Note that encryption isn't |
| 312 // complete until the OnEncryptionComplete() notification has been | 311 // complete until the OnEncryptionComplete() notification has been |
| 313 // sent (see below). | 312 // sent (see below). |
| 314 // | 313 // |
| 315 // |encrypted_types| will always be a superset of | 314 // |encrypted_types| will always be a superset of |
| 316 // Cryptographer::SensitiveTypes(). If |encrypt_everything| is | 315 // Cryptographer::SensitiveTypes(). If |encrypt_everything| is |
| 317 // true, |encrypted_types| will be the set of all known types. | 316 // true, |encrypted_types| will be the set of all known types. |
| 318 // | 317 // |
| 319 // Until this function is called, observers can assume that the | 318 // Until this function is called, observers can assume that the |
| 320 // set of encrypted types is Cryptographer::SensitiveTypes() and | 319 // set of encrypted types is Cryptographer::SensitiveTypes() and |
| 321 // that the encrypt everything flag is false. | 320 // that the encrypt everything flag is false. |
| 322 // | 321 // |
| 323 // Called from within a transaction. | 322 // Called from within a transaction. |
| 324 virtual void OnEncryptedTypesChanged( | 323 virtual void OnEncryptedTypesChanged( |
| 325 syncer::ModelTypeSet encrypted_types, | 324 ModelTypeSet encrypted_types, |
| 326 bool encrypt_everything) = 0; | 325 bool encrypt_everything) = 0; |
| 327 | 326 |
| 328 // Called after we finish encrypting the current set of encrypted | 327 // Called after we finish encrypting the current set of encrypted |
| 329 // types. | 328 // types. |
| 330 // | 329 // |
| 331 // Called from within a transaction. | 330 // Called from within a transaction. |
| 332 virtual void OnEncryptionComplete() = 0; | 331 virtual void OnEncryptionComplete() = 0; |
| 333 | 332 |
| 334 virtual void OnActionableError( | 333 virtual void OnActionableError( |
| 335 const syncer::SyncProtocolError& sync_protocol_error) = 0; | 334 const SyncProtocolError& sync_protocol_error) = 0; |
| 336 | 335 |
| 337 protected: | 336 protected: |
| 338 virtual ~Observer(); | 337 virtual ~Observer(); |
| 339 }; | 338 }; |
| 340 | 339 |
| 341 SyncManager(); | 340 SyncManager(); |
| 342 virtual ~SyncManager(); | 341 virtual ~SyncManager(); |
| 343 | 342 |
| 344 // Initialize the sync manager. |database_location| specifies the path of | 343 // Initialize the sync manager. |database_location| specifies the path of |
| 345 // the directory in which to locate a sqlite repository storing the syncer | 344 // the directory in which to locate a sqlite repository storing the syncer |
| (...skipping 11 matching lines...) Expand all Loading... |
| 357 // |model_safe_worker| ownership is given to the SyncManager. | 356 // |model_safe_worker| ownership is given to the SyncManager. |
| 358 // |user_agent| is a 7-bit ASCII string suitable for use as the User-Agent | 357 // |user_agent| is a 7-bit ASCII string suitable for use as the User-Agent |
| 359 // HTTP header. Used internally when collecting stats to classify clients. | 358 // HTTP header. Used internally when collecting stats to classify clients. |
| 360 // |sync_notifier| is owned and used to listen for notifications. | 359 // |sync_notifier| is owned and used to listen for notifications. |
| 361 // |report_unrecoverable_error_function| may be NULL. | 360 // |report_unrecoverable_error_function| may be NULL. |
| 362 // | 361 // |
| 363 // TODO(akalin): Replace the |post_factory| parameter with a | 362 // TODO(akalin): Replace the |post_factory| parameter with a |
| 364 // URLFetcher parameter. | 363 // URLFetcher parameter. |
| 365 virtual bool Init( | 364 virtual bool Init( |
| 366 const FilePath& database_location, | 365 const FilePath& database_location, |
| 367 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, | 366 const WeakHandle<JsEventHandler>& event_handler, |
| 368 const std::string& sync_server_and_path, | 367 const std::string& sync_server_and_path, |
| 369 int sync_server_port, | 368 int sync_server_port, |
| 370 bool use_ssl, | 369 bool use_ssl, |
| 371 const scoped_refptr<base::TaskRunner>& blocking_task_runner, | 370 const scoped_refptr<base::TaskRunner>& blocking_task_runner, |
| 372 scoped_ptr<HttpPostProviderFactory> post_factory, | 371 scoped_ptr<HttpPostProviderFactory> post_factory, |
| 373 const syncer::ModelSafeRoutingInfo& model_safe_routing_info, | 372 const ModelSafeRoutingInfo& model_safe_routing_info, |
| 374 const std::vector<syncer::ModelSafeWorker*>& workers, | 373 const std::vector<ModelSafeWorker*>& workers, |
| 375 syncer::ExtensionsActivityMonitor* extensions_activity_monitor, | 374 ExtensionsActivityMonitor* extensions_activity_monitor, |
| 376 ChangeDelegate* change_delegate, | 375 ChangeDelegate* change_delegate, |
| 377 const SyncCredentials& credentials, | 376 const SyncCredentials& credentials, |
| 378 scoped_ptr<syncer::SyncNotifier> sync_notifier, | 377 scoped_ptr<SyncNotifier> sync_notifier, |
| 379 const std::string& restored_key_for_bootstrapping, | 378 const std::string& restored_key_for_bootstrapping, |
| 380 scoped_ptr<InternalComponentsFactory> internal_components_factory, | 379 scoped_ptr<InternalComponentsFactory> internal_components_factory, |
| 381 syncer::Encryptor* encryptor, | 380 Encryptor* encryptor, |
| 382 syncer::UnrecoverableErrorHandler* unrecoverable_error_handler, | 381 UnrecoverableErrorHandler* unrecoverable_error_handler, |
| 383 syncer::ReportUnrecoverableErrorFunction | 382 ReportUnrecoverableErrorFunction report_unrecoverable_error_function) = 0; |
| 384 report_unrecoverable_error_function) = 0; | |
| 385 | 383 |
| 386 // Throw an unrecoverable error from a transaction (mostly used for | 384 // Throw an unrecoverable error from a transaction (mostly used for |
| 387 // testing). | 385 // testing). |
| 388 virtual void ThrowUnrecoverableError() = 0; | 386 virtual void ThrowUnrecoverableError() = 0; |
| 389 | 387 |
| 390 virtual syncer::ModelTypeSet InitialSyncEndedTypes() = 0; | 388 virtual ModelTypeSet InitialSyncEndedTypes() = 0; |
| 391 | 389 |
| 392 // Returns those types within |types| that have an empty progress marker | 390 // Returns those types within |types| that have an empty progress marker |
| 393 // token. | 391 // token. |
| 394 virtual syncer::ModelTypeSet GetTypesWithEmptyProgressMarkerToken( | 392 virtual ModelTypeSet GetTypesWithEmptyProgressMarkerToken( |
| 395 syncer::ModelTypeSet types) = 0; | 393 ModelTypeSet types) = 0; |
| 396 | 394 |
| 397 // Purge from the directory those types with non-empty progress markers | 395 // Purge from the directory those types with non-empty progress markers |
| 398 // but without initial synced ended set. | 396 // but without initial synced ended set. |
| 399 // Returns false if an error occurred, true otherwise. | 397 // Returns false if an error occurred, true otherwise. |
| 400 virtual bool PurgePartiallySyncedTypes() = 0; | 398 virtual bool PurgePartiallySyncedTypes() = 0; |
| 401 | 399 |
| 402 // Update tokens that we're using in Sync. Email must stay the same. | 400 // Update tokens that we're using in Sync. Email must stay the same. |
| 403 virtual void UpdateCredentials(const SyncCredentials& credentials) = 0; | 401 virtual void UpdateCredentials(const SyncCredentials& credentials) = 0; |
| 404 | 402 |
| 405 // Called when the user disables or enables a sync type. | 403 // Called when the user disables or enables a sync type. |
| 406 virtual void UpdateEnabledTypes( | 404 virtual void UpdateEnabledTypes( |
| 407 const syncer::ModelTypeSet& enabled_types) = 0; | 405 const ModelTypeSet& enabled_types) = 0; |
| 408 | 406 |
| 409 // Put the syncer in normal mode ready to perform nudges and polls. | 407 // Put the syncer in normal mode ready to perform nudges and polls. |
| 410 virtual void StartSyncingNormally( | 408 virtual void StartSyncingNormally( |
| 411 const syncer::ModelSafeRoutingInfo& routing_info) = 0; | 409 const ModelSafeRoutingInfo& routing_info) = 0; |
| 412 | 410 |
| 413 // Attempts to re-encrypt encrypted data types using the passphrase provided. | 411 // Attempts to re-encrypt encrypted data types using the passphrase provided. |
| 414 // Notifies observers of the result of the operation via OnPassphraseAccepted | 412 // Notifies observers of the result of the operation via OnPassphraseAccepted |
| 415 // or OnPassphraseRequired, updates the nigori node, and does re-encryption as | 413 // or OnPassphraseRequired, updates the nigori node, and does re-encryption as |
| 416 // appropriate. If an explicit password has been set previously, we drop | 414 // appropriate. If an explicit password has been set previously, we drop |
| 417 // subsequent requests to set a passphrase. If the cryptographer has pending | 415 // subsequent requests to set a passphrase. If the cryptographer has pending |
| 418 // keys, and a new implicit passphrase is provided, we try decrypting the | 416 // keys, and a new implicit passphrase is provided, we try decrypting the |
| 419 // pending keys with it, and if that fails, we cache the passphrase for | 417 // pending keys with it, and if that fails, we cache the passphrase for |
| 420 // re-encryption once the pending keys are decrypted. | 418 // re-encryption once the pending keys are decrypted. |
| 421 virtual void SetEncryptionPassphrase(const std::string& passphrase, | 419 virtual void SetEncryptionPassphrase(const std::string& passphrase, |
| 422 bool is_explicit) = 0; | 420 bool is_explicit) = 0; |
| 423 | 421 |
| 424 // Provides a passphrase for decrypting the user's existing sync data. | 422 // Provides a passphrase for decrypting the user's existing sync data. |
| 425 // Notifies observers of the result of the operation via OnPassphraseAccepted | 423 // Notifies observers of the result of the operation via OnPassphraseAccepted |
| 426 // or OnPassphraseRequired, updates the nigori node, and does re-encryption as | 424 // or OnPassphraseRequired, updates the nigori node, and does re-encryption as |
| 427 // appropriate if there is a previously cached encryption passphrase. It is an | 425 // appropriate if there is a previously cached encryption passphrase. It is an |
| 428 // error to call this when we don't have pending keys. | 426 // error to call this when we don't have pending keys. |
| 429 virtual void SetDecryptionPassphrase(const std::string& passphrase) = 0; | 427 virtual void SetDecryptionPassphrase(const std::string& passphrase) = 0; |
| 430 | 428 |
| 431 // Switches the mode of operation to CONFIGURATION_MODE and performs | 429 // Switches the mode of operation to CONFIGURATION_MODE and performs |
| 432 // any configuration tasks needed as determined by the params. Once complete, | 430 // any configuration tasks needed as determined by the params. Once complete, |
| 433 // syncer will remain in CONFIGURATION_MODE until StartSyncingNormally is | 431 // syncer will remain in CONFIGURATION_MODE until StartSyncingNormally is |
| 434 // called. | 432 // called. |
| 435 // |ready_task| is invoked when the configuration completes. | 433 // |ready_task| is invoked when the configuration completes. |
| 436 // |retry_task| is invoked if the configuration job could not immediately | 434 // |retry_task| is invoked if the configuration job could not immediately |
| 437 // execute. |ready_task| will still be called when it eventually | 435 // execute. |ready_task| will still be called when it eventually |
| 438 // does finish. | 436 // does finish. |
| 439 virtual void ConfigureSyncer( | 437 virtual void ConfigureSyncer( |
| 440 ConfigureReason reason, | 438 ConfigureReason reason, |
| 441 const syncer::ModelTypeSet& types_to_config, | 439 const ModelTypeSet& types_to_config, |
| 442 const syncer::ModelSafeRoutingInfo& new_routing_info, | 440 const ModelSafeRoutingInfo& new_routing_info, |
| 443 const base::Closure& ready_task, | 441 const base::Closure& ready_task, |
| 444 const base::Closure& retry_task) = 0; | 442 const base::Closure& retry_task) = 0; |
| 445 | 443 |
| 446 // Adds a listener to be notified of sync events. | 444 // Adds a listener to be notified of sync events. |
| 447 // NOTE: It is OK (in fact, it's probably a good idea) to call this before | 445 // NOTE: It is OK (in fact, it's probably a good idea) to call this before |
| 448 // having received OnInitializationCompleted. | 446 // having received OnInitializationCompleted. |
| 449 virtual void AddObserver(Observer* observer) = 0; | 447 virtual void AddObserver(Observer* observer) = 0; |
| 450 | 448 |
| 451 // Remove the given observer. Make sure to call this if the | 449 // Remove the given observer. Make sure to call this if the |
| 452 // Observer is being destroyed so the SyncManager doesn't | 450 // Observer is being destroyed so the SyncManager doesn't |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 // | 499 // |
| 502 // This will trigger OnEncryptedTypesChanged() if necessary (see | 500 // This will trigger OnEncryptedTypesChanged() if necessary (see |
| 503 // comments for OnEncryptedTypesChanged()). It then may trigger | 501 // comments for OnEncryptedTypesChanged()). It then may trigger |
| 504 // OnPassphraseRequired(), but otherwise it will trigger | 502 // OnPassphraseRequired(), but otherwise it will trigger |
| 505 // OnEncryptionComplete(). | 503 // OnEncryptionComplete(). |
| 506 virtual void EnableEncryptEverything() = 0; | 504 virtual void EnableEncryptEverything() = 0; |
| 507 | 505 |
| 508 // Reads the nigori node to determine if any experimental features should | 506 // Reads the nigori node to determine if any experimental features should |
| 509 // be enabled. | 507 // be enabled. |
| 510 // Note: opens a transaction. May be called on any thread. | 508 // Note: opens a transaction. May be called on any thread. |
| 511 virtual bool ReceivedExperiment(syncer::Experiments* experiments) = 0; | 509 virtual bool ReceivedExperiment(Experiments* experiments) = 0; |
| 512 | 510 |
| 513 // Uses a read-only transaction to determine if the directory being synced has | 511 // Uses a read-only transaction to determine if the directory being synced has |
| 514 // any remaining unsynced items. May be called on any thread. | 512 // any remaining unsynced items. May be called on any thread. |
| 515 virtual bool HasUnsyncedItems() = 0; | 513 virtual bool HasUnsyncedItems() = 0; |
| 516 }; | 514 }; |
| 517 | 515 |
| 518 } // namespace syncer | 516 } // namespace syncer |
| 519 | 517 |
| 520 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ | 518 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ |
| OLD | NEW |