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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 class Core; | 363 class Core; |
364 | 364 |
365 // An enum representing the steps to initializing the SyncBackendHost. | 365 // An enum representing the steps to initializing the SyncBackendHost. |
366 enum InitializationState { | 366 enum InitializationState { |
367 NOT_ATTEMPTED, | 367 NOT_ATTEMPTED, |
368 CREATING_SYNC_MANAGER, // We're waiting for the first callback from the | 368 CREATING_SYNC_MANAGER, // We're waiting for the first callback from the |
369 // sync thread to inform us that the sync manager | 369 // sync thread to inform us that the sync manager |
370 // has been created. | 370 // has been created. |
371 NOT_INITIALIZED, // Initialization hasn't completed, but we've | 371 NOT_INITIALIZED, // Initialization hasn't completed, but we've |
372 // constructed a SyncManager. | 372 // constructed a SyncManager. |
373 DOWNLOADING_NIGORI, // The SyncManager is initialized, but | 373 DOWNLOADING_METADATA, // The SyncManager is initialized, but |
374 // we're fetching sync encryption information. | 374 // we're fetching metadata, such as encryption |
375 ASSOCIATING_NIGORI, // The SyncManager is initialized, and we | 375 // information, from the server. |
376 // have the sync encryption information, but we | 376 PROCESSING_METADATA, // Running init tasks that require metadata to be |
377 // have to update the local encryption state. | 377 // available. This includes registering our device |
| 378 // information and refreshing encryption. |
378 INITIALIZED, // Initialization is complete. | 379 INITIALIZED, // Initialization is complete. |
379 }; | 380 }; |
380 | 381 |
381 // Checks if we have received a notice to turn on experimental datatypes | 382 // Checks if we have received a notice to turn on experimental datatypes |
382 // (via the nigori node) and informs the frontend if that is the case. | 383 // (via the nigori node) and informs the frontend if that is the case. |
383 // Note: it is illegal to call this before the backend is initialized. | 384 // Note: it is illegal to call this before the backend is initialized. |
384 void AddExperimentalTypes(); | 385 void AddExperimentalTypes(); |
385 | 386 |
386 // Downloading of nigori failed and will be retried. | 387 // Downloading of nigori failed and will be retried. |
387 void OnNigoriDownloadRetry(); | 388 void OnNigoriDownloadRetry(); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 void HandleNotificationsDisabledOnFrontendLoop( | 471 void HandleNotificationsDisabledOnFrontendLoop( |
471 syncer::NotificationsDisabledReason reason); | 472 syncer::NotificationsDisabledReason reason); |
472 void HandleIncomingNotificationOnFrontendLoop( | 473 void HandleIncomingNotificationOnFrontendLoop( |
473 const syncer::ObjectIdStateMap& id_state_map, | 474 const syncer::ObjectIdStateMap& id_state_map, |
474 syncer::IncomingNotificationSource source); | 475 syncer::IncomingNotificationSource source); |
475 | 476 |
476 // Handles stopping the core's SyncManager, accounting for whether | 477 // Handles stopping the core's SyncManager, accounting for whether |
477 // initialization is done yet. | 478 // initialization is done yet. |
478 void StopSyncManagerForShutdown(const base::Closure& closure); | 479 void StopSyncManagerForShutdown(const base::Closure& closure); |
479 | 480 |
| 481 // Must be called on |frontend_loop_|. |done_callback| is called on |
| 482 // |frontend_loop_|. |
| 483 void InitialProcessMetadata(const base::Closure& done_callback); |
| 484 |
480 base::WeakPtrFactory<SyncBackendHost> weak_ptr_factory_; | 485 base::WeakPtrFactory<SyncBackendHost> weak_ptr_factory_; |
481 | 486 |
482 // A thread where all the sync operations happen. | 487 // A thread where all the sync operations happen. |
483 base::Thread sync_thread_; | 488 base::Thread sync_thread_; |
484 | 489 |
485 // A reference to the MessageLoop used to construct |this|, so we know how | 490 // A reference to the MessageLoop used to construct |this|, so we know how |
486 // to safely talk back to the SyncFrontend. | 491 // to safely talk back to the SyncFrontend. |
487 MessageLoop* const frontend_loop_; | 492 MessageLoop* const frontend_loop_; |
488 | 493 |
489 Profile* const profile_; | 494 Profile* const profile_; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 // it via OnBackendInitialized in the final state of | 540 // it via OnBackendInitialized in the final state of |
536 // HandleInitializationCompletedOnFrontendLoop. | 541 // HandleInitializationCompletedOnFrontendLoop. |
537 syncer::WeakHandle<syncer::JsBackend> js_backend_; | 542 syncer::WeakHandle<syncer::JsBackend> js_backend_; |
538 | 543 |
539 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); | 544 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); |
540 }; | 545 }; |
541 | 546 |
542 } // namespace browser_sync | 547 } // namespace browser_sync |
543 | 548 |
544 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 549 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
OLD | NEW |