OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTEM_H
_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTEM_H
_ |
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTEM_H
_ | 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTEM_H
_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <map> | 10 #include <map> |
9 #include <string> | 11 #include <string> |
10 #include <vector> | 12 #include <vector> |
11 | 13 |
12 #include "base/callback.h" | 14 #include "base/callback.h" |
13 #include "base/files/file.h" | 15 #include "base/files/file.h" |
| 16 #include "base/macros.h" |
14 #include "base/memory/linked_ptr.h" | 17 #include "base/memory/linked_ptr.h" |
15 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
16 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
17 #include "base/task/cancelable_task_tracker.h" | 20 #include "base/task/cancelable_task_tracker.h" |
18 #include "chrome/browser/chromeos/file_system_provider/abort_callback.h" | 21 #include "chrome/browser/chromeos/file_system_provider/abort_callback.h" |
19 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info
.h" | 22 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info
.h" |
20 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte
rface.h" | 23 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte
rface.h" |
21 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_obse
rver.h" | 24 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_obse
rver.h" |
22 #include "chrome/browser/chromeos/file_system_provider/watcher.h" | 25 #include "chrome/browser/chromeos/file_system_provider/watcher.h" |
23 #include "storage/browser/fileapi/async_file_util.h" | 26 #include "storage/browser/fileapi/async_file_util.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 class FakeProvidedFileSystem : public ProvidedFileSystemInterface { | 64 class FakeProvidedFileSystem : public ProvidedFileSystemInterface { |
62 public: | 65 public: |
63 explicit FakeProvidedFileSystem( | 66 explicit FakeProvidedFileSystem( |
64 const ProvidedFileSystemInfo& file_system_info); | 67 const ProvidedFileSystemInfo& file_system_info); |
65 ~FakeProvidedFileSystem() override; | 68 ~FakeProvidedFileSystem() override; |
66 | 69 |
67 // Adds a fake entry to the fake file system. | 70 // Adds a fake entry to the fake file system. |
68 void AddEntry(const base::FilePath& entry_path, | 71 void AddEntry(const base::FilePath& entry_path, |
69 bool is_directory, | 72 bool is_directory, |
70 const std::string& name, | 73 const std::string& name, |
71 int64 size, | 74 int64_t size, |
72 base::Time modification_time, | 75 base::Time modification_time, |
73 std::string mime_type, | 76 std::string mime_type, |
74 std::string contents); | 77 std::string contents); |
75 | 78 |
76 // Fetches a pointer to a fake entry registered in the fake file system. If | 79 // Fetches a pointer to a fake entry registered in the fake file system. If |
77 // not found, then returns NULL. The returned pointes is owned by | 80 // not found, then returns NULL. The returned pointes is owned by |
78 // FakeProvidedFileSystem. | 81 // FakeProvidedFileSystem. |
79 const FakeEntry* GetEntry(const base::FilePath& entry_path) const; | 82 const FakeEntry* GetEntry(const base::FilePath& entry_path) const; |
80 | 83 |
81 // ProvidedFileSystemInterface overrides. | 84 // ProvidedFileSystemInterface overrides. |
(...skipping 14 matching lines...) Expand all Loading... |
96 const base::FilePath& directory_path, | 99 const base::FilePath& directory_path, |
97 const storage::AsyncFileUtil::ReadDirectoryCallback& callback) override; | 100 const storage::AsyncFileUtil::ReadDirectoryCallback& callback) override; |
98 AbortCallback OpenFile(const base::FilePath& file_path, | 101 AbortCallback OpenFile(const base::FilePath& file_path, |
99 OpenFileMode mode, | 102 OpenFileMode mode, |
100 const OpenFileCallback& callback) override; | 103 const OpenFileCallback& callback) override; |
101 AbortCallback CloseFile( | 104 AbortCallback CloseFile( |
102 int file_handle, | 105 int file_handle, |
103 const storage::AsyncFileUtil::StatusCallback& callback) override; | 106 const storage::AsyncFileUtil::StatusCallback& callback) override; |
104 AbortCallback ReadFile(int file_handle, | 107 AbortCallback ReadFile(int file_handle, |
105 net::IOBuffer* buffer, | 108 net::IOBuffer* buffer, |
106 int64 offset, | 109 int64_t offset, |
107 int length, | 110 int length, |
108 const ReadChunkReceivedCallback& callback) override; | 111 const ReadChunkReceivedCallback& callback) override; |
109 AbortCallback CreateDirectory( | 112 AbortCallback CreateDirectory( |
110 const base::FilePath& directory_path, | 113 const base::FilePath& directory_path, |
111 bool recursive, | 114 bool recursive, |
112 const storage::AsyncFileUtil::StatusCallback& callback) override; | 115 const storage::AsyncFileUtil::StatusCallback& callback) override; |
113 AbortCallback DeleteEntry( | 116 AbortCallback DeleteEntry( |
114 const base::FilePath& entry_path, | 117 const base::FilePath& entry_path, |
115 bool recursive, | 118 bool recursive, |
116 const storage::AsyncFileUtil::StatusCallback& callback) override; | 119 const storage::AsyncFileUtil::StatusCallback& callback) override; |
117 AbortCallback CreateFile( | 120 AbortCallback CreateFile( |
118 const base::FilePath& file_path, | 121 const base::FilePath& file_path, |
119 const storage::AsyncFileUtil::StatusCallback& callback) override; | 122 const storage::AsyncFileUtil::StatusCallback& callback) override; |
120 AbortCallback CopyEntry( | 123 AbortCallback CopyEntry( |
121 const base::FilePath& source_path, | 124 const base::FilePath& source_path, |
122 const base::FilePath& target_path, | 125 const base::FilePath& target_path, |
123 const storage::AsyncFileUtil::StatusCallback& callback) override; | 126 const storage::AsyncFileUtil::StatusCallback& callback) override; |
124 AbortCallback MoveEntry( | 127 AbortCallback MoveEntry( |
125 const base::FilePath& source_path, | 128 const base::FilePath& source_path, |
126 const base::FilePath& target_path, | 129 const base::FilePath& target_path, |
127 const storage::AsyncFileUtil::StatusCallback& callback) override; | 130 const storage::AsyncFileUtil::StatusCallback& callback) override; |
128 AbortCallback Truncate( | 131 AbortCallback Truncate( |
129 const base::FilePath& file_path, | 132 const base::FilePath& file_path, |
130 int64 length, | 133 int64_t length, |
131 const storage::AsyncFileUtil::StatusCallback& callback) override; | 134 const storage::AsyncFileUtil::StatusCallback& callback) override; |
132 AbortCallback WriteFile( | 135 AbortCallback WriteFile( |
133 int file_handle, | 136 int file_handle, |
134 net::IOBuffer* buffer, | 137 net::IOBuffer* buffer, |
135 int64 offset, | 138 int64_t offset, |
136 int length, | 139 int length, |
137 const storage::AsyncFileUtil::StatusCallback& callback) override; | 140 const storage::AsyncFileUtil::StatusCallback& callback) override; |
138 AbortCallback AddWatcher( | 141 AbortCallback AddWatcher( |
139 const GURL& origin, | 142 const GURL& origin, |
140 const base::FilePath& entry_path, | 143 const base::FilePath& entry_path, |
141 bool recursive, | 144 bool recursive, |
142 bool persistent, | 145 bool persistent, |
143 const storage::AsyncFileUtil::StatusCallback& callback, | 146 const storage::AsyncFileUtil::StatusCallback& callback, |
144 const storage::WatcherManager::NotificationCallback& | 147 const storage::WatcherManager::NotificationCallback& |
145 notification_callback) override; | 148 notification_callback) override; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 Watchers watchers_; | 198 Watchers watchers_; |
196 | 199 |
197 base::WeakPtrFactory<FakeProvidedFileSystem> weak_ptr_factory_; | 200 base::WeakPtrFactory<FakeProvidedFileSystem> weak_ptr_factory_; |
198 DISALLOW_COPY_AND_ASSIGN(FakeProvidedFileSystem); | 201 DISALLOW_COPY_AND_ASSIGN(FakeProvidedFileSystem); |
199 }; | 202 }; |
200 | 203 |
201 } // namespace file_system_provider | 204 } // namespace file_system_provider |
202 } // namespace chromeos | 205 } // namespace chromeos |
203 | 206 |
204 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTE
M_H_ | 207 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FAKE_PROVIDED_FILE_SYSTE
M_H_ |
OLD | NEW |