| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/mock_remote_file_sync_service.h" | 5 #include "chrome/browser/sync_file_system/mock_remote_file_sync_service.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 void MockRemoteFileSyncService::DumpDatabase(const ListCallback& callback) { | 50 void MockRemoteFileSyncService::DumpDatabase(const ListCallback& callback) { |
| 51 callback.Run(nullptr); | 51 callback.Run(nullptr); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void MockRemoteFileSyncService::SetServiceState(RemoteServiceState state) { | 54 void MockRemoteFileSyncService::SetServiceState(RemoteServiceState state) { |
| 55 state_ = state; | 55 state_ = state; |
| 56 } | 56 } |
| 57 | 57 |
| 58 void MockRemoteFileSyncService::NotifyRemoteChangeQueueUpdated( | 58 void MockRemoteFileSyncService::NotifyRemoteChangeQueueUpdated( |
| 59 int64_t pending_changes) { | 59 int64_t pending_changes) { |
| 60 FOR_EACH_OBSERVER(Observer, service_observers_, | 60 for (auto& observer : service_observers_) |
| 61 OnRemoteChangeQueueUpdated(pending_changes)); | 61 observer.OnRemoteChangeQueueUpdated(pending_changes); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void MockRemoteFileSyncService::NotifyRemoteServiceStateUpdated( | 64 void MockRemoteFileSyncService::NotifyRemoteServiceStateUpdated( |
| 65 RemoteServiceState state, | 65 RemoteServiceState state, |
| 66 const std::string& description) { | 66 const std::string& description) { |
| 67 FOR_EACH_OBSERVER(Observer, service_observers_, | 67 for (auto& observer : service_observers_) |
| 68 OnRemoteServiceStateUpdated(state, description)); | 68 observer.OnRemoteServiceStateUpdated(state, description); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void MockRemoteFileSyncService::NotifyFileStatusChanged( | 71 void MockRemoteFileSyncService::NotifyFileStatusChanged( |
| 72 const storage::FileSystemURL& url, | 72 const storage::FileSystemURL& url, |
| 73 SyncFileType file_type, | 73 SyncFileType file_type, |
| 74 SyncFileStatus sync_status, | 74 SyncFileStatus sync_status, |
| 75 SyncAction action_taken, | 75 SyncAction action_taken, |
| 76 SyncDirection direction) { | 76 SyncDirection direction) { |
| 77 FOR_EACH_OBSERVER(FileStatusObserver, file_status_observers_, | 77 for (auto& observer : file_status_observers_) { |
| 78 OnFileStatusChanged(url, file_type, sync_status, | 78 observer.OnFileStatusChanged(url, file_type, sync_status, action_taken, |
| 79 action_taken, direction)); | 79 direction); |
| 80 } |
| 80 } | 81 } |
| 81 | 82 |
| 82 void MockRemoteFileSyncService::AddServiceObserverStub(Observer* observer) { | 83 void MockRemoteFileSyncService::AddServiceObserverStub(Observer* observer) { |
| 83 service_observers_.AddObserver(observer); | 84 service_observers_.AddObserver(observer); |
| 84 } | 85 } |
| 85 | 86 |
| 86 void MockRemoteFileSyncService::AddFileStatusObserverStub( | 87 void MockRemoteFileSyncService::AddFileStatusObserverStub( |
| 87 FileStatusObserver* observer) { | 88 FileStatusObserver* observer) { |
| 88 file_status_observers_.AddObserver(observer); | 89 file_status_observers_.AddObserver(observer); |
| 89 } | 90 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 111 FROM_HERE, | 112 FROM_HERE, |
| 112 base::Bind( | 113 base::Bind( |
| 113 callback, SYNC_STATUS_NO_CHANGE_TO_SYNC, storage::FileSystemURL())); | 114 callback, SYNC_STATUS_NO_CHANGE_TO_SYNC, storage::FileSystemURL())); |
| 114 } | 115 } |
| 115 | 116 |
| 116 RemoteServiceState MockRemoteFileSyncService::GetCurrentStateStub() const { | 117 RemoteServiceState MockRemoteFileSyncService::GetCurrentStateStub() const { |
| 117 return state_; | 118 return state_; |
| 118 } | 119 } |
| 119 | 120 |
| 120 } // namespace sync_file_system | 121 } // namespace sync_file_system |
| OLD | NEW |