- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / sync_file_system / fake_remote_change_processor.h
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.
4
5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_FAKE_REMOTE_CHANGE_PROCESSOR_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_FAKE_REMOTE_CHANGE_PROCESSOR_H_
7
8 #include <map>
9 #include <string>
10 #include <vector>
11
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"
15
16 namespace base {
17 class FilePath;
18 }
19
20 namespace fileapi {
21 class FileSystemURL;
22 }
23
24 namespace sync_file_system {
25
26 class FileChange;
27
28 class FakeRemoteChangeProcessor : public RemoteChangeProcessor {
29  public:
30   typedef std::map<fileapi::FileSystemURL, std::vector<FileChange>,
31                    fileapi::FileSystemURL::Comparator> URLToFileChangesMap;
32
33   FakeRemoteChangeProcessor();
34   virtual ~FakeRemoteChangeProcessor();
35
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;
53
54   const URLToFileChangesMap& GetAppliedRemoteChanges() const;
55
56  private:
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
59   // change.
60   URLToFileChangesMap applied_changes_;
61
62   DISALLOW_COPY_AND_ASSIGN(FakeRemoteChangeProcessor);
63 };
64
65 }  // namespace sync_file_system
66
67 #endif  // CHROME_BROWSER_SYNC_FILE_SYSTEM_FAKE_REMOTE_CHANGE_PROCESSOR_H_