| 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_file_system/drive_backend/sync_engine.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/sync_engine.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 weak_ptr_factory_(this) { | 741 weak_ptr_factory_(this) { |
| 742 DCHECK(sync_file_system_dir_.IsAbsolute()); | 742 DCHECK(sync_file_system_dir_.IsAbsolute()); |
| 743 if (notification_manager_) | 743 if (notification_manager_) |
| 744 notification_manager_->AddObserver(this); | 744 notification_manager_->AddObserver(this); |
| 745 if (signin_manager_) | 745 if (signin_manager_) |
| 746 signin_manager_->AddObserver(this); | 746 signin_manager_->AddObserver(this); |
| 747 net::NetworkChangeNotifier::AddNetworkChangeObserver(this); | 747 net::NetworkChangeNotifier::AddNetworkChangeObserver(this); |
| 748 } | 748 } |
| 749 | 749 |
| 750 void SyncEngine::OnPendingFileListUpdated(int item_count) { | 750 void SyncEngine::OnPendingFileListUpdated(int item_count) { |
| 751 FOR_EACH_OBSERVER( | 751 for (auto& observer : service_observers_) |
| 752 SyncServiceObserver, | 752 observer.OnRemoteChangeQueueUpdated(item_count); |
| 753 service_observers_, | |
| 754 OnRemoteChangeQueueUpdated(item_count)); | |
| 755 } | 753 } |
| 756 | 754 |
| 757 void SyncEngine::OnFileStatusChanged(const storage::FileSystemURL& url, | 755 void SyncEngine::OnFileStatusChanged(const storage::FileSystemURL& url, |
| 758 SyncFileType file_type, | 756 SyncFileType file_type, |
| 759 SyncFileStatus file_status, | 757 SyncFileStatus file_status, |
| 760 SyncAction sync_action, | 758 SyncAction sync_action, |
| 761 SyncDirection direction) { | 759 SyncDirection direction) { |
| 762 FOR_EACH_OBSERVER(FileStatusObserver, | 760 for (auto& observer : file_status_observers_) { |
| 763 file_status_observers_, | 761 observer.OnFileStatusChanged(url, file_type, file_status, sync_action, |
| 764 OnFileStatusChanged( | 762 direction); |
| 765 url, file_type, file_status, sync_action, direction)); | 763 } |
| 766 } | 764 } |
| 767 | 765 |
| 768 void SyncEngine::UpdateServiceState(RemoteServiceState state, | 766 void SyncEngine::UpdateServiceState(RemoteServiceState state, |
| 769 const std::string& description) { | 767 const std::string& description) { |
| 770 service_state_ = state; | 768 service_state_ = state; |
| 771 | 769 |
| 772 FOR_EACH_OBSERVER( | 770 for (auto& observer : service_observers_) |
| 773 SyncServiceObserver, service_observers_, | 771 observer.OnRemoteServiceStateUpdated(GetCurrentState(), description); |
| 774 OnRemoteServiceStateUpdated(GetCurrentState(), description)); | |
| 775 } | 772 } |
| 776 | 773 |
| 777 SyncStatusCallback SyncEngine::TrackCallback( | 774 SyncStatusCallback SyncEngine::TrackCallback( |
| 778 const SyncStatusCallback& callback) { | 775 const SyncStatusCallback& callback) { |
| 779 return callback_tracker_.Register( | 776 return callback_tracker_.Register( |
| 780 base::Bind(callback, SYNC_STATUS_ABORT), | 777 base::Bind(callback, SYNC_STATUS_ABORT), |
| 781 callback); | 778 callback); |
| 782 } | 779 } |
| 783 | 780 |
| 784 } // namespace drive_backend | 781 } // namespace drive_backend |
| 785 } // namespace sync_file_system | 782 } // namespace sync_file_system |
| OLD | NEW |