| 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 CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 void Shutdown(bool sync_disabled); | 224 void Shutdown(bool sync_disabled); |
| 225 | 225 |
| 226 // Changes the set of data types that are currently being synced. | 226 // Changes the set of data types that are currently being synced. |
| 227 // The ready_task will be run when configuration is done with the | 227 // The ready_task will be run when configuration is done with the |
| 228 // set of all types that failed configuration (i.e., if its argument | 228 // set of all types that failed configuration (i.e., if its argument |
| 229 // is non-empty, then an error was encountered). | 229 // is non-empty, then an error was encountered). |
| 230 virtual void ConfigureDataTypes( | 230 virtual void ConfigureDataTypes( |
| 231 syncer::ConfigureReason reason, | 231 syncer::ConfigureReason reason, |
| 232 syncer::ModelTypeSet types_to_add, | 232 syncer::ModelTypeSet types_to_add, |
| 233 syncer::ModelTypeSet types_to_remove, | 233 syncer::ModelTypeSet types_to_remove, |
| 234 NigoriState nigori_state, | |
| 235 const base::Callback<void(syncer::ModelTypeSet)>& ready_task, | 234 const base::Callback<void(syncer::ModelTypeSet)>& ready_task, |
| 236 const base::Callback<void()>& retry_callback) OVERRIDE; | 235 const base::Callback<void()>& retry_callback) OVERRIDE; |
| 237 | 236 |
| 238 // Turns on encryption of all present and future sync data. | 237 // Turns on encryption of all present and future sync data. |
| 239 virtual void EnableEncryptEverything(); | 238 virtual void EnableEncryptEverything(); |
| 240 | 239 |
| 241 // Activates change processing for the given data type. This must | 240 // Activates change processing for the given data type. This must |
| 242 // be called synchronously with the data type's model association so | 241 // be called synchronously with the data type's model association so |
| 243 // no changes are dropped between model association and change | 242 // no changes are dropped between model association and change |
| 244 // processor activation. | 243 // processor activation. |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 class Core; | 361 class Core; |
| 363 | 362 |
| 364 // An enum representing the steps to initializing the SyncBackendHost. | 363 // An enum representing the steps to initializing the SyncBackendHost. |
| 365 enum InitializationState { | 364 enum InitializationState { |
| 366 NOT_ATTEMPTED, | 365 NOT_ATTEMPTED, |
| 367 CREATING_SYNC_MANAGER, // We're waiting for the first callback from the | 366 CREATING_SYNC_MANAGER, // We're waiting for the first callback from the |
| 368 // sync thread to inform us that the sync manager | 367 // sync thread to inform us that the sync manager |
| 369 // has been created. | 368 // has been created. |
| 370 NOT_INITIALIZED, // Initialization hasn't completed, but we've | 369 NOT_INITIALIZED, // Initialization hasn't completed, but we've |
| 371 // constructed a SyncManager. | 370 // constructed a SyncManager. |
| 372 DOWNLOADING_NIGORI, // The SyncManager is initialized, but | 371 DOWNLOADING_METADATA, // The SyncManager is initialized, but |
| 373 // we're fetching encryption information. | 372 // we're fetching metadata, such as encryption |
| 374 REFRESHING_NIGORI, // The SyncManager is initialized, and we | 373 // information, from the server. |
| 375 // have the encryption information, but we | 374 PROCESSING_METADATA, // Running init tasks that require metadata to be |
| 376 // still need to refresh encryption. Also, we need | 375 // available. This includes registering our device |
| 377 // to update the device information in the nigori. | 376 // information and refreshing encryption. |
| 378 INITIALIZED, // Initialization is complete. | 377 INITIALIZED, // Initialization is complete. |
| 379 }; | 378 }; |
| 380 | 379 |
| 381 // Enum used to distinguish which bootstrap encryption token is being updated. | 380 // Enum used to distinguish which bootstrap encryption token is being updated. |
| 382 enum BootstrapTokenType { | 381 enum BootstrapTokenType { |
| 383 PASSPHRASE_BOOTSTRAP_TOKEN, | 382 PASSPHRASE_BOOTSTRAP_TOKEN, |
| 384 KEYSTORE_BOOTSTRAP_TOKEN | 383 KEYSTORE_BOOTSTRAP_TOKEN |
| 385 }; | 384 }; |
| 386 | 385 |
| 387 // Checks if we have received a notice to turn on experimental datatypes | 386 // Checks if we have received a notice to turn on experimental datatypes |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 // syncer::SyncNotifierObserver-like functions. | 470 // syncer::SyncNotifierObserver-like functions. |
| 472 void HandleNotificationsEnabledOnFrontendLoop(); | 471 void HandleNotificationsEnabledOnFrontendLoop(); |
| 473 void HandleNotificationsDisabledOnFrontendLoop( | 472 void HandleNotificationsDisabledOnFrontendLoop( |
| 474 syncer::NotificationsDisabledReason reason); | 473 syncer::NotificationsDisabledReason reason); |
| 475 void HandleIncomingNotificationOnFrontendLoop( | 474 void HandleIncomingNotificationOnFrontendLoop( |
| 476 const syncer::ObjectIdPayloadMap& id_payloads, | 475 const syncer::ObjectIdPayloadMap& id_payloads, |
| 477 syncer::IncomingNotificationSource source); | 476 syncer::IncomingNotificationSource source); |
| 478 | 477 |
| 479 // Must be called on |frontend_loop_|. |done_callback| is called on | 478 // Must be called on |frontend_loop_|. |done_callback| is called on |
| 480 // |frontend_loop_|. | 479 // |frontend_loop_|. |
| 481 void RefreshNigori(const base::Closure& done_callback); | 480 void InitialProcessMetadata(const base::Closure& done_callback); |
| 482 | 481 |
| 483 // Handles stopping the core's SyncManager, accounting for whether | 482 // Handles stopping the core's SyncManager, accounting for whether |
| 484 // initialization is done yet. | 483 // initialization is done yet. |
| 485 void StopSyncManagerForShutdown(const base::Closure& closure); | 484 void StopSyncManagerForShutdown(const base::Closure& closure); |
| 486 | 485 |
| 487 base::WeakPtrFactory<SyncBackendHost> weak_ptr_factory_; | 486 base::WeakPtrFactory<SyncBackendHost> weak_ptr_factory_; |
| 488 | 487 |
| 489 // A thread where all the sync operations happen. | 488 // A thread where all the sync operations happen. |
| 490 base::Thread sync_thread_; | 489 base::Thread sync_thread_; |
| 491 | 490 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 | 529 |
| 531 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. | 530 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. |
| 532 syncer::sessions::SyncSessionSnapshot last_snapshot_; | 531 syncer::sessions::SyncSessionSnapshot last_snapshot_; |
| 533 | 532 |
| 534 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); | 533 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); |
| 535 }; | 534 }; |
| 536 | 535 |
| 537 } // namespace browser_sync | 536 } // namespace browser_sync |
| 538 | 537 |
| 539 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 538 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
| OLD | NEW |