OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 virtual void DoRequestConfig(const syncable::ModelTypeBitSet& added_types, | 391 virtual void DoRequestConfig(const syncable::ModelTypeBitSet& added_types, |
392 sync_api::ConfigureReason reason); | 392 sync_api::ConfigureReason reason); |
393 | 393 |
394 // Start the configuration mode. | 394 // Start the configuration mode. |
395 virtual void DoStartConfiguration(Callback0::Type* callback); | 395 virtual void DoStartConfiguration(Callback0::Type* callback); |
396 | 396 |
397 // Set the base request context to use when making HTTP calls. | 397 // Set the base request context to use when making HTTP calls. |
398 // This method will add a reference to the context to persist it | 398 // This method will add a reference to the context to persist it |
399 // on the IO thread. Must be removed from IO thread. | 399 // on the IO thread. Must be removed from IO thread. |
400 | 400 |
401 sync_api::SyncManager* syncapi() { return syncapi_.get(); } | 401 sync_api::SyncManager* sync_manager() { return sync_manager_.get(); } |
402 | 402 |
403 // Delete the sync data folder to cleanup backend data. Happens the first | 403 // Delete the sync data folder to cleanup backend data. Happens the first |
404 // time sync is enabled for a user (to prevent accidentally reusing old | 404 // time sync is enabled for a user (to prevent accidentally reusing old |
405 // sync databases), as well as shutdown when you're no longer syncing. | 405 // sync databases), as well as shutdown when you're no longer syncing. |
406 void DeleteSyncDataFolder(); | 406 void DeleteSyncDataFolder(); |
407 | 407 |
408 void ConnectChildJsEventRouter(); | 408 void ConnectChildJsEventRouter(); |
409 | 409 |
410 void DisconnectChildJsEventRouter(); | 410 void DisconnectChildJsEventRouter(); |
411 | 411 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 sessions::SyncSessionSnapshot* snapshot); | 482 sessions::SyncSessionSnapshot* snapshot); |
483 | 483 |
484 void HandleStopSyncingPermanentlyOnFrontendLoop(); | 484 void HandleStopSyncingPermanentlyOnFrontendLoop(); |
485 | 485 |
486 // Called to handle success/failure of clearing server data | 486 // Called to handle success/failure of clearing server data |
487 void HandleClearServerDataSucceededOnFrontendLoop(); | 487 void HandleClearServerDataSucceededOnFrontendLoop(); |
488 void HandleClearServerDataFailedOnFrontendLoop(); | 488 void HandleClearServerDataFailedOnFrontendLoop(); |
489 | 489 |
490 // Called from Core::OnInitializationComplete to handle updating | 490 // Called from Core::OnInitializationComplete to handle updating |
491 // frontend thread components. | 491 // frontend thread components. |
492 void HandleInitalizationCompletedOnFrontendLoop(); | 492 void HandleInitializationCompletedOnFrontendLoop(); |
493 | 493 |
494 void RouteJsEventOnFrontendLoop( | 494 void RouteJsEventOnFrontendLoop( |
495 const std::string& name, const JsEventDetails& details); | 495 const std::string& name, const JsEventDetails& details); |
496 | 496 |
497 void RouteJsMessageReplyOnFrontendLoop( | 497 void RouteJsMessageReplyOnFrontendLoop( |
498 const std::string& name, const JsArgList& args, | 498 const std::string& name, const JsArgList& args, |
499 const JsEventHandler* target); | 499 const JsEventHandler* target); |
500 | 500 |
501 void FinishConfigureDataTypesOnFrontendLoop(); | 501 void FinishConfigureDataTypesOnFrontendLoop(); |
502 | 502 |
503 // Return true if a model lives on the current thread. | 503 // Return true if a model lives on the current thread. |
504 bool IsCurrentThreadSafeForModel(syncable::ModelType model_type); | 504 bool IsCurrentThreadSafeForModel(syncable::ModelType model_type); |
505 | 505 |
| 506 // Debug name of the Profile this object is for. |
| 507 const std::string name_; |
| 508 |
506 // Our parent SyncBackendHost | 509 // Our parent SyncBackendHost |
507 SyncBackendHost* host_; | 510 SyncBackendHost* host_; |
508 | 511 |
509 // The timer used to periodically call SaveChanges. | 512 // The timer used to periodically call SaveChanges. |
510 base::RepeatingTimer<Core> save_changes_timer_; | 513 base::RepeatingTimer<Core> save_changes_timer_; |
511 | 514 |
512 // The top-level syncapi entry point. | 515 // The top-level syncapi entry point. Lives on the sync thread. |
513 scoped_ptr<sync_api::SyncManager> syncapi_; | 516 scoped_ptr<sync_api::SyncManager> sync_manager_; |
514 | 517 |
515 scoped_ptr<sync_notifier::SyncNotifier> sync_notifier_; | 518 scoped_ptr<sync_notifier::SyncNotifier> sync_notifier_; |
516 | 519 |
517 JsSyncManagerObserver sync_manager_observer_; | 520 JsSyncManagerObserver sync_manager_observer_; |
518 | 521 |
519 JsEventRouter* parent_router_; | 522 JsEventRouter* parent_router_; |
520 | 523 |
521 // Denotes if the core is currently attempting to set a passphrase. While | 524 // Denotes if the core is currently attempting to set a passphrase. While |
522 // this is true, OnPassphraseRequired calls are dropped. | 525 // this is true, OnPassphraseRequired calls are dropped. |
523 // Note: after initialization, this variable should only ever be accessed or | 526 // Note: after initialization, this variable should only ever be accessed or |
(...skipping 22 matching lines...) Expand all Loading... |
546 | 549 |
547 // Allows tests to perform alternate core initialization work. | 550 // Allows tests to perform alternate core initialization work. |
548 virtual void InitCore(const Core::DoInitializeOptions& options); | 551 virtual void InitCore(const Core::DoInitializeOptions& options); |
549 | 552 |
550 // Factory method for HttpPostProviderFactories. | 553 // Factory method for HttpPostProviderFactories. |
551 virtual sync_api::HttpPostProviderFactory* MakeHttpBridgeFactory( | 554 virtual sync_api::HttpPostProviderFactory* MakeHttpBridgeFactory( |
552 net::URLRequestContextGetter* getter); | 555 net::URLRequestContextGetter* getter); |
553 | 556 |
554 MessageLoop* sync_loop() { return sync_thread_.message_loop(); } | 557 MessageLoop* sync_loop() { return sync_thread_.message_loop(); } |
555 | 558 |
556 void set_syncapi_initialized() { syncapi_initialized_ = true; } | |
557 | |
558 // Helpers to persist a token that can be used to bootstrap sync encryption | 559 // Helpers to persist a token that can be used to bootstrap sync encryption |
559 // across browser restart to avoid requiring the user to re-enter their | 560 // across browser restart to avoid requiring the user to re-enter their |
560 // passphrase. |token| must be valid UTF-8 as we use the PrefService for | 561 // passphrase. |token| must be valid UTF-8 as we use the PrefService for |
561 // storage. | 562 // storage. |
562 void PersistEncryptionBootstrapToken(const std::string& token); | 563 void PersistEncryptionBootstrapToken(const std::string& token); |
563 std::string RestoreEncryptionBootstrapToken(); | 564 std::string RestoreEncryptionBootstrapToken(); |
564 | 565 |
565 // Our core, which communicates directly to the syncapi. | 566 // Our core, which communicates directly to the syncapi. |
566 scoped_refptr<Core> core_; | 567 scoped_refptr<Core> core_; |
567 | 568 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 scoped_ptr<PendingConfigureDataTypesState> pending_download_state_; | 648 scoped_ptr<PendingConfigureDataTypesState> pending_download_state_; |
648 scoped_ptr<PendingConfigureDataTypesState> pending_config_mode_state_; | 649 scoped_ptr<PendingConfigureDataTypesState> pending_config_mode_state_; |
649 | 650 |
650 // UI-thread cache of the last AuthErrorState received from syncapi. | 651 // UI-thread cache of the last AuthErrorState received from syncapi. |
651 GoogleServiceAuthError last_auth_error_; | 652 GoogleServiceAuthError last_auth_error_; |
652 | 653 |
653 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. | 654 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. |
654 scoped_ptr<sessions::SyncSessionSnapshot> last_snapshot_; | 655 scoped_ptr<sessions::SyncSessionSnapshot> last_snapshot_; |
655 | 656 |
656 // Whether we've processed the initialization complete callback. | 657 // Whether we've processed the initialization complete callback. |
657 bool syncapi_initialized_; | 658 bool sync_manager_initialized_; |
658 | 659 |
659 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); | 660 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); |
660 }; | 661 }; |
661 | 662 |
662 } // namespace browser_sync | 663 } // namespace browser_sync |
663 | 664 |
664 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 665 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
OLD | NEW |