| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/sync/glue/sync_backend_host_impl.h" | 5 #include "chrome/browser/sync/glue/sync_backend_host_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 if (!frontend_) | 639 if (!frontend_) |
| 640 return; | 640 return; |
| 641 | 641 |
| 642 frontend_->OnSyncConfigureRetry(); | 642 frontend_->OnSyncConfigureRetry(); |
| 643 } | 643 } |
| 644 | 644 |
| 645 void SyncBackendHostImpl::HandleInitializationSuccessOnFrontendLoop( | 645 void SyncBackendHostImpl::HandleInitializationSuccessOnFrontendLoop( |
| 646 const syncer::WeakHandle<syncer::JsBackend> js_backend, | 646 const syncer::WeakHandle<syncer::JsBackend> js_backend, |
| 647 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener> | 647 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener> |
| 648 debug_info_listener, | 648 debug_info_listener, |
| 649 syncer::SyncContextProxy* sync_context_proxy) { | 649 syncer::SyncContextProxy* sync_context_proxy, |
| 650 const std::string& cache_guid) { |
| 650 DCHECK_EQ(base::MessageLoop::current(), frontend_loop_); | 651 DCHECK_EQ(base::MessageLoop::current(), frontend_loop_); |
| 651 | 652 |
| 652 if (sync_context_proxy) | 653 if (sync_context_proxy) |
| 653 sync_context_proxy_ = sync_context_proxy->Clone(); | 654 sync_context_proxy_ = sync_context_proxy->Clone(); |
| 654 | 655 |
| 655 if (!frontend_) | 656 if (!frontend_) |
| 656 return; | 657 return; |
| 657 | 658 |
| 658 initialized_ = true; | 659 initialized_ = true; |
| 659 | 660 |
| 660 if (invalidator_) { | 661 if (invalidator_) { |
| 661 invalidator_->RegisterInvalidationHandler(this); | 662 invalidator_->RegisterInvalidationHandler(this); |
| 662 invalidation_handler_registered_ = true; | 663 invalidation_handler_registered_ = true; |
| 663 | 664 |
| 664 // Fake a state change to initialize the SyncManager's cached invalidator | 665 // Fake a state change to initialize the SyncManager's cached invalidator |
| 665 // state. | 666 // state. |
| 666 OnInvalidatorStateChange(invalidator_->GetInvalidatorState()); | 667 OnInvalidatorStateChange(invalidator_->GetInvalidatorState()); |
| 667 } | 668 } |
| 668 | 669 |
| 669 // Start forwarding refresh requests to the SyncManager | 670 // Start forwarding refresh requests to the SyncManager |
| 670 notification_registrar_.Add(this, chrome::NOTIFICATION_SYNC_REFRESH_LOCAL, | 671 notification_registrar_.Add(this, chrome::NOTIFICATION_SYNC_REFRESH_LOCAL, |
| 671 content::Source<Profile>(profile_)); | 672 content::Source<Profile>(profile_)); |
| 672 | 673 |
| 673 // Now that we've downloaded the control types, we can see if there are any | 674 // Now that we've downloaded the control types, we can see if there are any |
| 674 // experimental types to enable. This should be done before we inform | 675 // experimental types to enable. This should be done before we inform |
| 675 // the frontend to ensure they're visible in the customize screen. | 676 // the frontend to ensure they're visible in the customize screen. |
| 676 AddExperimentalTypes(); | 677 AddExperimentalTypes(); |
| 677 frontend_->OnBackendInitialized(js_backend, | 678 frontend_->OnBackendInitialized(js_backend, |
| 678 debug_info_listener, | 679 debug_info_listener, |
| 680 cache_guid, |
| 679 true); | 681 true); |
| 680 } | 682 } |
| 681 | 683 |
| 682 void SyncBackendHostImpl::HandleInitializationFailureOnFrontendLoop() { | 684 void SyncBackendHostImpl::HandleInitializationFailureOnFrontendLoop() { |
| 683 DCHECK_EQ(base::MessageLoop::current(), frontend_loop_); | 685 DCHECK_EQ(base::MessageLoop::current(), frontend_loop_); |
| 684 if (!frontend_) | 686 if (!frontend_) |
| 685 return; | 687 return; |
| 686 | 688 |
| 687 frontend_->OnBackendInitialized( | 689 frontend_->OnBackendInitialized( |
| 688 syncer::WeakHandle<syncer::JsBackend>(), | 690 syncer::WeakHandle<syncer::JsBackend>(), |
| 689 syncer::WeakHandle<syncer::DataTypeDebugInfoListener>(), | 691 syncer::WeakHandle<syncer::DataTypeDebugInfoListener>(), |
| 692 "", |
| 690 false); | 693 false); |
| 691 } | 694 } |
| 692 | 695 |
| 693 void SyncBackendHostImpl::HandleSyncCycleCompletedOnFrontendLoop( | 696 void SyncBackendHostImpl::HandleSyncCycleCompletedOnFrontendLoop( |
| 694 const syncer::sessions::SyncSessionSnapshot& snapshot) { | 697 const syncer::sessions::SyncSessionSnapshot& snapshot) { |
| 695 if (!frontend_) | 698 if (!frontend_) |
| 696 return; | 699 return; |
| 697 DCHECK_EQ(base::MessageLoop::current(), frontend_loop_); | 700 DCHECK_EQ(base::MessageLoop::current(), frontend_loop_); |
| 698 | 701 |
| 699 last_snapshot_ = snapshot; | 702 last_snapshot_ = snapshot; |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 | 879 |
| 877 base::MessageLoop* SyncBackendHostImpl::GetSyncLoopForTesting() { | 880 base::MessageLoop* SyncBackendHostImpl::GetSyncLoopForTesting() { |
| 878 return registrar_->sync_thread()->message_loop(); | 881 return registrar_->sync_thread()->message_loop(); |
| 879 } | 882 } |
| 880 | 883 |
| 881 } // namespace browser_sync | 884 } // namespace browser_sync |
| 882 | 885 |
| 883 #undef SDVLOG | 886 #undef SDVLOG |
| 884 | 887 |
| 885 #undef SLOG | 888 #undef SLOG |
| OLD | NEW |