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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_FAKE_REMOTE_CHANGE_PROCESSOR_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_FAKE_REMOTE_CHANGE_PROCESSOR_H_
12 #include "base/callback.h"
13 #include "chrome/browser/sync_file_system/remote_change_processor.h"
14 #include "chrome/browser/sync_file_system/sync_callbacks.h"
24 namespace sync_file_system {
28 class FakeRemoteChangeProcessor : public RemoteChangeProcessor {
30 typedef std::map<fileapi::FileSystemURL, std::vector<FileChange>,
31 fileapi::FileSystemURL::Comparator> URLToFileChangesMap;
33 FakeRemoteChangeProcessor();
34 virtual ~FakeRemoteChangeProcessor();
36 // RemoteChangeProcessor overrides.
37 virtual void PrepareForProcessRemoteChange(
38 const fileapi::FileSystemURL& url,
39 const PrepareChangeCallback& callback) OVERRIDE;
40 virtual void ApplyRemoteChange(
41 const FileChange& change,
42 const base::FilePath& local_path,
43 const fileapi::FileSystemURL& url,
44 const SyncStatusCallback& callback) OVERRIDE;
45 virtual void FinalizeRemoteSync(
46 const fileapi::FileSystemURL& url,
47 bool clear_local_changes,
48 const base::Closure& completion_callback) OVERRIDE;
49 virtual void RecordFakeLocalChange(
50 const fileapi::FileSystemURL& url,
51 const FileChange& change,
52 const SyncStatusCallback& callback) OVERRIDE;
54 const URLToFileChangesMap& GetAppliedRemoteChanges() const;
57 // History of file changes given by ApplyRemoteChange(). Changes are arranged
58 // in chronological order, that is, the end of the vector represents the last
60 URLToFileChangesMap applied_changes_;
62 DISALLOW_COPY_AND_ASSIGN(FakeRemoteChangeProcessor);
65 } // namespace sync_file_system
67 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_FAKE_REMOTE_CHANGE_PROCESSOR_H_