| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/fake_remote_change_processor.h" | 5 #include "chrome/browser/sync_file_system/fake_remote_change_processor.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| 11 #include "webkit/browser/fileapi/file_system_url.h" | 11 #include "webkit/browser/fileapi/file_system_url.h" |
| 12 #include "webkit/browser/fileapi/syncable/file_change.h" | 12 #include "webkit/browser/fileapi/syncable/file_change.h" |
| 13 #include "webkit/browser/fileapi/syncable/sync_file_metadata.h" | 13 #include "webkit/browser/fileapi/syncable/sync_file_metadata.h" |
| 14 | 14 |
| 15 namespace sync_file_system { | 15 namespace sync_file_system { |
| 16 | 16 |
| 17 FakeRemoteChangeProcessor::FakeRemoteChangeProcessor() { | 17 FakeRemoteChangeProcessor::FakeRemoteChangeProcessor() { |
| 18 } | 18 } |
| 19 | 19 |
| 20 FakeRemoteChangeProcessor::~FakeRemoteChangeProcessor() { | 20 FakeRemoteChangeProcessor::~FakeRemoteChangeProcessor() { |
| 21 } | 21 } |
| 22 | 22 |
| 23 void FakeRemoteChangeProcessor::PrepareForProcessRemoteChange( | 23 void FakeRemoteChangeProcessor::PrepareForProcessRemoteChange( |
| 24 const fileapi::FileSystemURL& url, | 24 const fileapi::FileSystemURL& url, |
| 25 const std::string& service_name, | |
| 26 const PrepareChangeCallback& callback) { | 25 const PrepareChangeCallback& callback) { |
| 27 SyncFileMetadata local_metadata; | 26 SyncFileMetadata local_metadata; |
| 28 | 27 |
| 29 URLToFileChangesMap::iterator found = applied_changes_.find(url); | 28 URLToFileChangesMap::iterator found = applied_changes_.find(url); |
| 30 if (found != applied_changes_.end()) { | 29 if (found != applied_changes_.end()) { |
| 31 DCHECK(!found->second.empty()); | 30 DCHECK(!found->second.empty()); |
| 32 const FileChange& applied_change = found->second.back(); | 31 const FileChange& applied_change = found->second.back(); |
| 33 if (applied_change.IsAddOrUpdate()) { | 32 if (applied_change.IsAddOrUpdate()) { |
| 34 local_metadata = SyncFileMetadata( | 33 local_metadata = SyncFileMetadata( |
| 35 applied_change.file_type(), | 34 applied_change.file_type(), |
| (...skipping 30 matching lines...) Expand all Loading... |
| 66 base::MessageLoopProxy::current()->PostTask( | 65 base::MessageLoopProxy::current()->PostTask( |
| 67 FROM_HERE, base::Bind(callback, SYNC_STATUS_OK)); | 66 FROM_HERE, base::Bind(callback, SYNC_STATUS_OK)); |
| 68 } | 67 } |
| 69 | 68 |
| 70 const FakeRemoteChangeProcessor::URLToFileChangesMap& | 69 const FakeRemoteChangeProcessor::URLToFileChangesMap& |
| 71 FakeRemoteChangeProcessor::GetAppliedRemoteChanges() const { | 70 FakeRemoteChangeProcessor::GetAppliedRemoteChanges() const { |
| 72 return applied_changes_; | 71 return applied_changes_; |
| 73 } | 72 } |
| 74 | 73 |
| 75 } // namespace sync_file_system | 74 } // namespace sync_file_system |
| OLD | NEW |