| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/file_version_info.h" | 7 #include "base/file_version_info.h" |
| 8 #include "base/task.h" | 8 #include "base/task.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/app/chrome_version_info.h" | 10 #include "chrome/app/chrome_version_info.h" |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 host_->frontend_loop_->PostTask(FROM_HERE, | 531 host_->frontend_loop_->PostTask(FROM_HERE, |
| 532 NewRunnableMethod(this, | 532 NewRunnableMethod(this, |
| 533 &Core::HandleInitalizationCompletedOnFrontendLoop)); | 533 &Core::HandleInitalizationCompletedOnFrontendLoop)); |
| 534 | 534 |
| 535 // Initialization is complete, so we can schedule recurring SaveChanges. | 535 // Initialization is complete, so we can schedule recurring SaveChanges. |
| 536 host_->core_thread_.message_loop()->PostTask(FROM_HERE, | 536 host_->core_thread_.message_loop()->PostTask(FROM_HERE, |
| 537 NewRunnableMethod(this, &Core::StartSavingChanges)); | 537 NewRunnableMethod(this, &Core::StartSavingChanges)); |
| 538 } | 538 } |
| 539 | 539 |
| 540 void SyncBackendHost::Core::HandleInitalizationCompletedOnFrontendLoop() { | 540 void SyncBackendHost::Core::HandleInitalizationCompletedOnFrontendLoop() { |
| 541 if (!host_) |
| 542 return; |
| 541 host_->HandleInitializationCompletedOnFrontendLoop(); | 543 host_->HandleInitializationCompletedOnFrontendLoop(); |
| 542 } | 544 } |
| 543 | 545 |
| 544 void SyncBackendHost::HandleInitializationCompletedOnFrontendLoop() { | 546 void SyncBackendHost::HandleInitializationCompletedOnFrontendLoop() { |
| 547 if (!frontend_) |
| 548 return; |
| 545 frontend_->OnBackendInitialized(); | 549 frontend_->OnBackendInitialized(); |
| 546 } | 550 } |
| 547 | 551 |
| 548 bool SyncBackendHost::Core::IsCurrentThreadSafeForModel( | 552 bool SyncBackendHost::Core::IsCurrentThreadSafeForModel( |
| 549 syncable::ModelType model_type) { | 553 syncable::ModelType model_type) { |
| 550 AutoLock lock(host_->registrar_lock_); | 554 AutoLock lock(host_->registrar_lock_); |
| 551 | 555 |
| 552 browser_sync::ModelSafeRoutingInfo::const_iterator routing_it = | 556 browser_sync::ModelSafeRoutingInfo::const_iterator routing_it = |
| 553 host_->registrar_.routing_info.find(model_type); | 557 host_->registrar_.routing_info.find(model_type); |
| 554 if (routing_it == host_->registrar_.routing_info.end()) | 558 if (routing_it == host_->registrar_.routing_info.end()) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 FROM_HERE, | 595 FROM_HERE, |
| 592 NewRunnableMethod(this, &Core::NotifyResumed)); | 596 NewRunnableMethod(this, &Core::NotifyResumed)); |
| 593 } | 597 } |
| 594 | 598 |
| 595 void SyncBackendHost::Core::OnStopSyncingPermanently() { | 599 void SyncBackendHost::Core::OnStopSyncingPermanently() { |
| 596 host_->frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, | 600 host_->frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, |
| 597 &Core::HandleStopSyncingPermanentlyOnFrontendLoop)); | 601 &Core::HandleStopSyncingPermanentlyOnFrontendLoop)); |
| 598 } | 602 } |
| 599 | 603 |
| 600 void SyncBackendHost::Core::HandleStopSyncingPermanentlyOnFrontendLoop() { | 604 void SyncBackendHost::Core::HandleStopSyncingPermanentlyOnFrontendLoop() { |
| 605 if (!host_ || !host_->frontend_) |
| 606 return; |
| 601 host_->frontend_->OnStopSyncingPermanently(); | 607 host_->frontend_->OnStopSyncingPermanently(); |
| 602 } | 608 } |
| 603 | 609 |
| 604 void SyncBackendHost::Core::HandleAuthErrorEventOnFrontendLoop( | 610 void SyncBackendHost::Core::HandleAuthErrorEventOnFrontendLoop( |
| 605 const GoogleServiceAuthError& new_auth_error) { | 611 const GoogleServiceAuthError& new_auth_error) { |
| 606 if (!host_ || !host_->frontend_) | 612 if (!host_ || !host_->frontend_) |
| 607 return; | 613 return; |
| 608 | 614 |
| 609 DCHECK_EQ(MessageLoop::current(), host_->frontend_loop_); | 615 DCHECK_EQ(MessageLoop::current(), host_->frontend_loop_); |
| 610 | 616 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 635 } | 641 } |
| 636 | 642 |
| 637 void SyncBackendHost::Core::DeleteSyncDataFolder() { | 643 void SyncBackendHost::Core::DeleteSyncDataFolder() { |
| 638 if (file_util::DirectoryExists(host_->sync_data_folder_path())) { | 644 if (file_util::DirectoryExists(host_->sync_data_folder_path())) { |
| 639 if (!file_util::Delete(host_->sync_data_folder_path(), true)) | 645 if (!file_util::Delete(host_->sync_data_folder_path(), true)) |
| 640 LOG(DFATAL) << "Could not delete the Sync Data folder."; | 646 LOG(DFATAL) << "Could not delete the Sync Data folder."; |
| 641 } | 647 } |
| 642 } | 648 } |
| 643 | 649 |
| 644 } // namespace browser_sync | 650 } // namespace browser_sync |
| OLD | NEW |