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 #include "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #include "chrome/browser/sync/glue/sync_backend_host.h" | 7 #include "chrome/browser/sync/glue/sync_backend_host.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 void SyncBackendHost::Core::DeleteSyncDataFolder() { | 699 void SyncBackendHost::Core::DeleteSyncDataFolder() { |
700 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 700 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
701 if (file_util::DirectoryExists(host_->sync_data_folder_path())) { | 701 if (file_util::DirectoryExists(host_->sync_data_folder_path())) { |
702 if (!file_util::Delete(host_->sync_data_folder_path(), true)) | 702 if (!file_util::Delete(host_->sync_data_folder_path(), true)) |
703 SLOG(DFATAL) << "Could not delete the Sync Data folder."; | 703 SLOG(DFATAL) << "Could not delete the Sync Data folder."; |
704 } | 704 } |
705 } | 705 } |
706 | 706 |
707 void SyncBackendHost::Core::FinishConfigureDataTypes() { | 707 void SyncBackendHost::Core::FinishConfigureDataTypes() { |
708 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 708 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
| 709 if (!host_ || !host_->frontend_) |
| 710 return; |
709 host_->frontend_loop_->PostTask(FROM_HERE, base::Bind( | 711 host_->frontend_loop_->PostTask(FROM_HERE, base::Bind( |
710 &SyncBackendHost::Core::FinishConfigureDataTypesOnFrontendLoop, this)); | 712 &SyncBackendHost::Core::FinishConfigureDataTypesOnFrontendLoop, this)); |
711 } | 713 } |
712 | 714 |
713 void SyncBackendHost::Core::HandleInitializationCompletedOnFrontendLoop( | 715 void SyncBackendHost::Core::HandleInitializationCompletedOnFrontendLoop( |
714 const WeakHandle<JsBackend>& js_backend, | 716 const WeakHandle<JsBackend>& js_backend, |
715 bool success) { | 717 bool success) { |
716 if (!host_) | 718 if (!host_) |
717 return; | 719 return; |
718 host_->HandleInitializationCompletedOnFrontendLoop(js_backend, success); | 720 host_->HandleInitializationCompletedOnFrontendLoop(js_backend, success); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 host_->frontend_->OnClearServerDataSucceeded(); | 873 host_->frontend_->OnClearServerDataSucceeded(); |
872 } | 874 } |
873 | 875 |
874 void SyncBackendHost::Core::HandleClearServerDataFailedOnFrontendLoop() { | 876 void SyncBackendHost::Core::HandleClearServerDataFailedOnFrontendLoop() { |
875 if (!host_ || !host_->frontend_) | 877 if (!host_ || !host_->frontend_) |
876 return; | 878 return; |
877 host_->frontend_->OnClearServerDataFailed(); | 879 host_->frontend_->OnClearServerDataFailed(); |
878 } | 880 } |
879 | 881 |
880 void SyncBackendHost::Core::FinishConfigureDataTypesOnFrontendLoop() { | 882 void SyncBackendHost::Core::FinishConfigureDataTypesOnFrontendLoop() { |
| 883 if (!host_) |
| 884 return; |
881 host_->FinishConfigureDataTypesOnFrontendLoop(); | 885 host_->FinishConfigureDataTypesOnFrontendLoop(); |
882 } | 886 } |
883 | 887 |
884 void SyncBackendHost::AddExperimentalTypes() { | 888 void SyncBackendHost::AddExperimentalTypes() { |
885 CHECK(initialized()); | 889 CHECK(initialized()); |
886 syncable::ModelTypeSet to_add; | 890 syncable::ModelTypeSet to_add; |
887 if (core_->sync_manager()->ReceivedExperimentalTypes(&to_add)) | 891 if (core_->sync_manager()->ReceivedExperimentalTypes(&to_add)) |
888 frontend_->OnDataTypesChanged(to_add); | 892 frontend_->OnDataTypesChanged(to_add); |
889 } | 893 } |
890 | 894 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 FROM_HERE, | 1077 FROM_HERE, |
1074 base::Bind(&SyncBackendHost::Core::DoRefreshEncryption, | 1078 base::Bind(&SyncBackendHost::Core::DoRefreshEncryption, |
1075 core_.get(), sync_thread_done_callback)); | 1079 core_.get(), sync_thread_done_callback)); |
1076 } | 1080 } |
1077 | 1081 |
1078 #undef SVLOG | 1082 #undef SVLOG |
1079 | 1083 |
1080 #undef SLOG | 1084 #undef SLOG |
1081 | 1085 |
1082 } // namespace browser_sync | 1086 } // namespace browser_sync |
OLD | NEW |