Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: chrome/browser/sync_file_system/fake_remote_change_processor.h

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_FAKE_REMOTE_CHANGE_PROCESSOR_H_ 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_FAKE_REMOTE_CHANGE_PROCESSOR_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_FAKE_REMOTE_CHANGE_PROCESSOR_H_ 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_FAKE_REMOTE_CHANGE_PROCESSOR_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "chrome/browser/sync_file_system/remote_change_processor.h" 13 #include "chrome/browser/sync_file_system/remote_change_processor.h"
14 #include "chrome/browser/sync_file_system/sync_callbacks.h" 14 #include "chrome/browser/sync_file_system/sync_callbacks.h"
15 15
16 namespace base { 16 namespace base {
17 class FilePath; 17 class FilePath;
18 } 18 }
19 19
20 namespace fileapi { 20 namespace storage {
21 class FileSystemURL; 21 class FileSystemURL;
22 } 22 }
23 23
24 namespace sync_file_system { 24 namespace sync_file_system {
25 25
26 class FileChange; 26 class FileChange;
27 27
28 class FakeRemoteChangeProcessor : public RemoteChangeProcessor { 28 class FakeRemoteChangeProcessor : public RemoteChangeProcessor {
29 public: 29 public:
30 typedef std::map<fileapi::FileSystemURL, std::vector<FileChange>, 30 typedef std::map<storage::FileSystemURL,
31 fileapi::FileSystemURL::Comparator> URLToFileChangesMap; 31 std::vector<FileChange>,
32 typedef std::map<fileapi::FileSystemURL, FileChangeList, 32 storage::FileSystemURL::Comparator> URLToFileChangesMap;
33 fileapi::FileSystemURL::Comparator> URLToFileChangeList; 33 typedef std::map<storage::FileSystemURL,
34 typedef std::map<fileapi::FileSystemURL, SyncFileMetadata, 34 FileChangeList,
35 fileapi::FileSystemURL::Comparator> URLToFileMetadata; 35 storage::FileSystemURL::Comparator> URLToFileChangeList;
36 typedef std::map<storage::FileSystemURL,
37 SyncFileMetadata,
38 storage::FileSystemURL::Comparator> URLToFileMetadata;
36 39
37 FakeRemoteChangeProcessor(); 40 FakeRemoteChangeProcessor();
38 virtual ~FakeRemoteChangeProcessor(); 41 virtual ~FakeRemoteChangeProcessor();
39 42
40 // RemoteChangeProcessor overrides. 43 // RemoteChangeProcessor overrides.
41 virtual void PrepareForProcessRemoteChange( 44 virtual void PrepareForProcessRemoteChange(
42 const fileapi::FileSystemURL& url, 45 const storage::FileSystemURL& url,
43 const PrepareChangeCallback& callback) OVERRIDE; 46 const PrepareChangeCallback& callback) OVERRIDE;
44 virtual void ApplyRemoteChange( 47 virtual void ApplyRemoteChange(const FileChange& change,
45 const FileChange& change, 48 const base::FilePath& local_path,
46 const base::FilePath& local_path, 49 const storage::FileSystemURL& url,
47 const fileapi::FileSystemURL& url, 50 const SyncStatusCallback& callback) OVERRIDE;
48 const SyncStatusCallback& callback) OVERRIDE;
49 virtual void FinalizeRemoteSync( 51 virtual void FinalizeRemoteSync(
50 const fileapi::FileSystemURL& url, 52 const storage::FileSystemURL& url,
51 bool clear_local_changes, 53 bool clear_local_changes,
52 const base::Closure& completion_callback) OVERRIDE; 54 const base::Closure& completion_callback) OVERRIDE;
53 virtual void RecordFakeLocalChange( 55 virtual void RecordFakeLocalChange(
54 const fileapi::FileSystemURL& url, 56 const storage::FileSystemURL& url,
55 const FileChange& change, 57 const FileChange& change,
56 const SyncStatusCallback& callback) OVERRIDE; 58 const SyncStatusCallback& callback) OVERRIDE;
57 59
58 void UpdateLocalFileMetadata( 60 void UpdateLocalFileMetadata(const storage::FileSystemURL& url,
59 const fileapi::FileSystemURL& url, 61 const FileChange& change);
60 const FileChange& change); 62 void ClearLocalChanges(const storage::FileSystemURL& url);
61 void ClearLocalChanges(const fileapi::FileSystemURL& url);
62 63
63 const URLToFileChangesMap& GetAppliedRemoteChanges() const; 64 const URLToFileChangesMap& GetAppliedRemoteChanges() const;
64 65
65 // Compare |applied_changes_| with |expected_changes|. 66 // Compare |applied_changes_| with |expected_changes|.
66 // This internally calls EXPECT_FOO, ASSERT_FOO methods in the 67 // This internally calls EXPECT_FOO, ASSERT_FOO methods in the
67 // verification. 68 // verification.
68 void VerifyConsistency(const URLToFileChangesMap& expected_changes); 69 void VerifyConsistency(const URLToFileChangesMap& expected_changes);
69 70
70 private: 71 private:
71 // History of file changes given by ApplyRemoteChange(). Changes are arranged 72 // History of file changes given by ApplyRemoteChange(). Changes are arranged
72 // in chronological order, that is, the end of the vector represents the last 73 // in chronological order, that is, the end of the vector represents the last
73 // change. 74 // change.
74 URLToFileChangesMap applied_changes_; 75 URLToFileChangesMap applied_changes_;
75 76
76 // History of local file changes. 77 // History of local file changes.
77 URLToFileChangeList local_changes_; 78 URLToFileChangeList local_changes_;
78 79
79 // Initial local file metadata. These are overridden by applied changes. 80 // Initial local file metadata. These are overridden by applied changes.
80 URLToFileMetadata local_file_metadata_; 81 URLToFileMetadata local_file_metadata_;
81 82
82 DISALLOW_COPY_AND_ASSIGN(FakeRemoteChangeProcessor); 83 DISALLOW_COPY_AND_ASSIGN(FakeRemoteChangeProcessor);
83 }; 84 };
84 85
85 } // namespace sync_file_system 86 } // namespace sync_file_system
86 87
87 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_FAKE_REMOTE_CHANGE_PROCESSOR_H_ 88 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_FAKE_REMOTE_CHANGE_PROCESSOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698