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