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