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 const std::string name_; | |
tim (not reviewing)
2011/06/16 21:10:58
what is |name_|? name of what?
akalin
2011/06/16 22:23:12
Done.
| |
507 | |
506 // Our parent SyncBackendHost | 508 // Our parent SyncBackendHost |
507 SyncBackendHost* host_; | 509 SyncBackendHost* host_; |
508 | 510 |
509 // The timer used to periodically call SaveChanges. | 511 // The timer used to periodically call SaveChanges. |
510 base::RepeatingTimer<Core> save_changes_timer_; | 512 base::RepeatingTimer<Core> save_changes_timer_; |
511 | 513 |
512 // The top-level syncapi entry point. | 514 // The top-level syncapi entry point. Lives on the sync thread. |
513 scoped_ptr<sync_api::SyncManager> syncapi_; | 515 scoped_ptr<sync_api::SyncManager> sync_manager_; |
tim (not reviewing)
2011/06/16 21:10:58
I prefer the old name :\ but if you really want to
akalin
2011/06/16 22:23:12
Well, the problem with the name "syncapi" is that
| |
514 | 516 |
515 scoped_ptr<sync_notifier::SyncNotifier> sync_notifier_; | 517 scoped_ptr<sync_notifier::SyncNotifier> sync_notifier_; |
516 | 518 |
517 JsSyncManagerObserver sync_manager_observer_; | 519 JsSyncManagerObserver sync_manager_observer_; |
518 | 520 |
519 JsEventRouter* parent_router_; | 521 JsEventRouter* parent_router_; |
520 | 522 |
521 // Denotes if the core is currently attempting to set a passphrase. While | 523 // Denotes if the core is currently attempting to set a passphrase. While |
522 // this is true, OnPassphraseRequired calls are dropped. | 524 // this is true, OnPassphraseRequired calls are dropped. |
523 // Note: after initialization, this variable should only ever be accessed or | 525 // Note: after initialization, this variable should only ever be accessed or |
(...skipping 22 matching lines...) Expand all Loading... | |
546 | 548 |
547 // Allows tests to perform alternate core initialization work. | 549 // Allows tests to perform alternate core initialization work. |
548 virtual void InitCore(const Core::DoInitializeOptions& options); | 550 virtual void InitCore(const Core::DoInitializeOptions& options); |
549 | 551 |
550 // Factory method for HttpPostProviderFactories. | 552 // Factory method for HttpPostProviderFactories. |
551 virtual sync_api::HttpPostProviderFactory* MakeHttpBridgeFactory( | 553 virtual sync_api::HttpPostProviderFactory* MakeHttpBridgeFactory( |
552 net::URLRequestContextGetter* getter); | 554 net::URLRequestContextGetter* getter); |
553 | 555 |
554 MessageLoop* sync_loop() { return sync_thread_.message_loop(); } | 556 MessageLoop* sync_loop() { return sync_thread_.message_loop(); } |
555 | 557 |
556 void set_syncapi_initialized() { syncapi_initialized_ = true; } | |
557 | |
558 // Helpers to persist a token that can be used to bootstrap sync encryption | 558 // 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 | 559 // 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 | 560 // passphrase. |token| must be valid UTF-8 as we use the PrefService for |
561 // storage. | 561 // storage. |
562 void PersistEncryptionBootstrapToken(const std::string& token); | 562 void PersistEncryptionBootstrapToken(const std::string& token); |
563 std::string RestoreEncryptionBootstrapToken(); | 563 std::string RestoreEncryptionBootstrapToken(); |
564 | 564 |
565 // Our core, which communicates directly to the syncapi. | 565 // Our core, which communicates directly to the syncapi. |
566 scoped_refptr<Core> core_; | 566 scoped_refptr<Core> core_; |
567 | 567 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
647 scoped_ptr<PendingConfigureDataTypesState> pending_download_state_; | 647 scoped_ptr<PendingConfigureDataTypesState> pending_download_state_; |
648 scoped_ptr<PendingConfigureDataTypesState> pending_config_mode_state_; | 648 scoped_ptr<PendingConfigureDataTypesState> pending_config_mode_state_; |
649 | 649 |
650 // UI-thread cache of the last AuthErrorState received from syncapi. | 650 // UI-thread cache of the last AuthErrorState received from syncapi. |
651 GoogleServiceAuthError last_auth_error_; | 651 GoogleServiceAuthError last_auth_error_; |
652 | 652 |
653 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. | 653 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. |
654 scoped_ptr<sessions::SyncSessionSnapshot> last_snapshot_; | 654 scoped_ptr<sessions::SyncSessionSnapshot> last_snapshot_; |
655 | 655 |
656 // Whether we've processed the initialization complete callback. | 656 // Whether we've processed the initialization complete callback. |
657 bool syncapi_initialized_; | 657 bool sync_manager_initialized_; |
658 | 658 |
659 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); | 659 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); |
660 }; | 660 }; |
661 | 661 |
662 } // namespace browser_sync | 662 } // namespace browser_sync |
663 | 663 |
664 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 664 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
OLD | NEW |