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 #include "chrome/browser/chromeos/file_system_provider/provided_file_system.h" | 5 #include "chrome/browser/chromeos/file_system_provider/provided_file_system.h" |
6 | 6 |
| 7 #include <vector> |
| 8 |
7 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
8 #include "base/files/file.h" | 10 #include "base/files/file.h" |
9 #include "chrome/browser/chromeos/file_system_provider/notification_manager.h" | 11 #include "chrome/browser/chromeos/file_system_provider/notification_manager.h" |
| 12 #include "chrome/browser/chromeos/file_system_provider/operations/abort.h" |
10 #include "chrome/browser/chromeos/file_system_provider/operations/close_file.h" | 13 #include "chrome/browser/chromeos/file_system_provider/operations/close_file.h" |
11 #include "chrome/browser/chromeos/file_system_provider/operations/copy_entry.h" | 14 #include "chrome/browser/chromeos/file_system_provider/operations/copy_entry.h" |
12 #include "chrome/browser/chromeos/file_system_provider/operations/create_directo
ry.h" | 15 #include "chrome/browser/chromeos/file_system_provider/operations/create_directo
ry.h" |
13 #include "chrome/browser/chromeos/file_system_provider/operations/create_file.h" | 16 #include "chrome/browser/chromeos/file_system_provider/operations/create_file.h" |
14 #include "chrome/browser/chromeos/file_system_provider/operations/delete_entry.h
" | 17 #include "chrome/browser/chromeos/file_system_provider/operations/delete_entry.h
" |
15 #include "chrome/browser/chromeos/file_system_provider/operations/get_metadata.h
" | 18 #include "chrome/browser/chromeos/file_system_provider/operations/get_metadata.h
" |
16 #include "chrome/browser/chromeos/file_system_provider/operations/move_entry.h" | 19 #include "chrome/browser/chromeos/file_system_provider/operations/move_entry.h" |
17 #include "chrome/browser/chromeos/file_system_provider/operations/open_file.h" | 20 #include "chrome/browser/chromeos/file_system_provider/operations/open_file.h" |
18 #include "chrome/browser/chromeos/file_system_provider/operations/read_directory
.h" | 21 #include "chrome/browser/chromeos/file_system_provider/operations/read_directory
.h" |
19 #include "chrome/browser/chromeos/file_system_provider/operations/read_file.h" | 22 #include "chrome/browser/chromeos/file_system_provider/operations/read_file.h" |
20 #include "chrome/browser/chromeos/file_system_provider/operations/truncate.h" | 23 #include "chrome/browser/chromeos/file_system_provider/operations/truncate.h" |
21 #include "chrome/browser/chromeos/file_system_provider/operations/unmount.h" | 24 #include "chrome/browser/chromeos/file_system_provider/operations/unmount.h" |
22 #include "chrome/browser/chromeos/file_system_provider/operations/write_file.h" | 25 #include "chrome/browser/chromeos/file_system_provider/operations/write_file.h" |
23 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" | 26 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" |
24 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
25 #include "chrome/common/extensions/api/file_system_provider.h" | 28 #include "chrome/common/extensions/api/file_system_provider.h" |
26 #include "extensions/browser/event_router.h" | 29 #include "extensions/browser/event_router.h" |
27 | 30 |
28 namespace net { | 31 namespace net { |
29 class IOBuffer; | 32 class IOBuffer; |
30 } // namespace net | 33 } // namespace net |
31 | 34 |
32 namespace chromeos { | 35 namespace chromeos { |
33 namespace file_system_provider { | 36 namespace file_system_provider { |
| 37 namespace { |
| 38 |
| 39 // Dicards the result of Abort() when called from the destructor. |
| 40 void EmptyStatusCallback(base::File::Error /* result */) { |
| 41 } |
| 42 |
| 43 } // namespace |
34 | 44 |
35 ProvidedFileSystem::ProvidedFileSystem( | 45 ProvidedFileSystem::ProvidedFileSystem( |
36 Profile* profile, | 46 Profile* profile, |
37 const ProvidedFileSystemInfo& file_system_info) | 47 const ProvidedFileSystemInfo& file_system_info) |
38 : profile_(profile), | 48 : profile_(profile), |
39 event_router_(extensions::EventRouter::Get(profile)), // May be NULL. | 49 event_router_(extensions::EventRouter::Get(profile)), // May be NULL. |
40 file_system_info_(file_system_info), | 50 file_system_info_(file_system_info), |
41 notification_manager_( | 51 notification_manager_( |
42 new NotificationManager(profile_, file_system_info_)), | 52 new NotificationManager(profile_, file_system_info_)), |
43 request_manager_(notification_manager_.get()), | 53 request_manager_(notification_manager_.get()), |
44 weak_ptr_factory_(this) { | 54 weak_ptr_factory_(this) { |
45 } | 55 } |
46 | 56 |
47 ProvidedFileSystem::~ProvidedFileSystem() {} | 57 ProvidedFileSystem::~ProvidedFileSystem() { |
48 | 58 const std::vector<int> request_ids = request_manager_.GetActiveRequestIds(); |
49 void ProvidedFileSystem::RequestUnmount( | 59 for (size_t i = 0; i < request_ids.size(); ++i) { |
50 const fileapi::AsyncFileUtil::StatusCallback& callback) { | 60 Abort(request_ids[i], base::Bind(&EmptyStatusCallback)); |
51 if (!request_manager_.CreateRequest( | 61 } |
52 REQUEST_UNMOUNT, | 62 } |
53 scoped_ptr<RequestManager::HandlerInterface>(new operations::Unmount( | 63 |
54 event_router_, file_system_info_, callback)))) { | 64 ProvidedFileSystem::AbortCallback ProvidedFileSystem::RequestUnmount( |
55 callback.Run(base::File::FILE_ERROR_SECURITY); | 65 const fileapi::AsyncFileUtil::StatusCallback& callback) { |
56 } | 66 const int request_id = request_manager_.CreateRequest( |
57 } | 67 REQUEST_UNMOUNT, |
58 | 68 scoped_ptr<RequestManager::HandlerInterface>( |
59 void ProvidedFileSystem::GetMetadata(const base::FilePath& entry_path, | 69 new operations::Unmount(event_router_, file_system_info_, callback))); |
60 const GetMetadataCallback& callback) { | 70 if (!request_id) { |
61 if (!request_manager_.CreateRequest( | 71 callback.Run(base::File::FILE_ERROR_SECURITY); |
62 GET_METADATA, | 72 return AbortCallback(); |
63 scoped_ptr<RequestManager::HandlerInterface>( | 73 } |
64 new operations::GetMetadata( | 74 |
65 event_router_, file_system_info_, entry_path, callback)))) { | 75 return base::Bind( |
| 76 &ProvidedFileSystem::Abort, weak_ptr_factory_.GetWeakPtr(), request_id); |
| 77 } |
| 78 |
| 79 ProvidedFileSystem::AbortCallback ProvidedFileSystem::GetMetadata( |
| 80 const base::FilePath& entry_path, |
| 81 const GetMetadataCallback& callback) { |
| 82 const int request_id = request_manager_.CreateRequest( |
| 83 GET_METADATA, |
| 84 scoped_ptr<RequestManager::HandlerInterface>(new operations::GetMetadata( |
| 85 event_router_, file_system_info_, entry_path, callback))); |
| 86 if (!request_id) { |
66 callback.Run(EntryMetadata(), base::File::FILE_ERROR_SECURITY); | 87 callback.Run(EntryMetadata(), base::File::FILE_ERROR_SECURITY); |
67 } | 88 return AbortCallback(); |
68 } | 89 } |
69 | 90 |
70 void ProvidedFileSystem::ReadDirectory( | 91 return base::Bind( |
| 92 &ProvidedFileSystem::Abort, weak_ptr_factory_.GetWeakPtr(), request_id); |
| 93 } |
| 94 |
| 95 ProvidedFileSystem::AbortCallback ProvidedFileSystem::ReadDirectory( |
71 const base::FilePath& directory_path, | 96 const base::FilePath& directory_path, |
72 const fileapi::AsyncFileUtil::ReadDirectoryCallback& callback) { | 97 const fileapi::AsyncFileUtil::ReadDirectoryCallback& callback) { |
73 if (!request_manager_.CreateRequest( | 98 const int request_id = request_manager_.CreateRequest( |
74 READ_DIRECTORY, | 99 READ_DIRECTORY, |
75 scoped_ptr< | 100 scoped_ptr<RequestManager::HandlerInterface>( |
76 RequestManager::HandlerInterface>(new operations::ReadDirectory( | 101 new operations::ReadDirectory( |
77 event_router_, file_system_info_, directory_path, callback)))) { | 102 event_router_, file_system_info_, directory_path, callback))); |
| 103 if (!request_id) { |
78 callback.Run(base::File::FILE_ERROR_SECURITY, | 104 callback.Run(base::File::FILE_ERROR_SECURITY, |
79 fileapi::AsyncFileUtil::EntryList(), | 105 fileapi::AsyncFileUtil::EntryList(), |
80 false /* has_more */); | 106 false /* has_more */); |
81 } | 107 return AbortCallback(); |
82 } | 108 } |
83 | 109 |
84 void ProvidedFileSystem::ReadFile(int file_handle, | 110 return base::Bind( |
85 net::IOBuffer* buffer, | 111 &ProvidedFileSystem::Abort, weak_ptr_factory_.GetWeakPtr(), request_id); |
86 int64 offset, | 112 } |
87 int length, | 113 |
88 const ReadChunkReceivedCallback& callback) { | 114 ProvidedFileSystem::AbortCallback ProvidedFileSystem::ReadFile( |
| 115 int file_handle, |
| 116 net::IOBuffer* buffer, |
| 117 int64 offset, |
| 118 int length, |
| 119 const ReadChunkReceivedCallback& callback) { |
89 TRACE_EVENT1( | 120 TRACE_EVENT1( |
90 "file_system_provider", "ProvidedFileSystem::ReadFile", "length", length); | 121 "file_system_provider", "ProvidedFileSystem::ReadFile", "length", length); |
91 if (!request_manager_.CreateRequest( | 122 const int request_id = request_manager_.CreateRequest( |
92 READ_FILE, | 123 READ_FILE, |
93 make_scoped_ptr<RequestManager::HandlerInterface>( | 124 make_scoped_ptr<RequestManager::HandlerInterface>( |
94 new operations::ReadFile(event_router_, | 125 new operations::ReadFile(event_router_, |
95 file_system_info_, | 126 file_system_info_, |
96 file_handle, | 127 file_handle, |
97 buffer, | 128 buffer, |
98 offset, | 129 offset, |
99 length, | 130 length, |
100 callback)))) { | 131 callback))); |
| 132 if (!request_id) { |
101 callback.Run(0 /* chunk_length */, | 133 callback.Run(0 /* chunk_length */, |
102 false /* has_more */, | 134 false /* has_more */, |
103 base::File::FILE_ERROR_SECURITY); | 135 base::File::FILE_ERROR_SECURITY); |
104 } | 136 return AbortCallback(); |
105 } | 137 } |
106 | 138 |
107 void ProvidedFileSystem::OpenFile(const base::FilePath& file_path, | 139 return base::Bind( |
108 OpenFileMode mode, | 140 &ProvidedFileSystem::Abort, weak_ptr_factory_.GetWeakPtr(), request_id); |
109 const OpenFileCallback& callback) { | 141 } |
110 if (!request_manager_.CreateRequest( | 142 |
111 OPEN_FILE, | 143 ProvidedFileSystem::AbortCallback ProvidedFileSystem::OpenFile( |
112 scoped_ptr<RequestManager::HandlerInterface>( | 144 const base::FilePath& file_path, |
113 new operations::OpenFile(event_router_, | 145 OpenFileMode mode, |
114 file_system_info_, | 146 const OpenFileCallback& callback) { |
115 file_path, | 147 const int request_id = request_manager_.CreateRequest( |
116 mode, | 148 OPEN_FILE, |
117 callback)))) { | 149 scoped_ptr<RequestManager::HandlerInterface>(new operations::OpenFile( |
| 150 event_router_, file_system_info_, file_path, mode, callback))); |
| 151 if (!request_id) { |
118 callback.Run(0 /* file_handle */, base::File::FILE_ERROR_SECURITY); | 152 callback.Run(0 /* file_handle */, base::File::FILE_ERROR_SECURITY); |
119 } | 153 return AbortCallback(); |
120 } | 154 } |
121 | 155 |
122 void ProvidedFileSystem::CloseFile( | 156 return base::Bind( |
| 157 &ProvidedFileSystem::Abort, weak_ptr_factory_.GetWeakPtr(), request_id); |
| 158 } |
| 159 |
| 160 ProvidedFileSystem::AbortCallback ProvidedFileSystem::CloseFile( |
123 int file_handle, | 161 int file_handle, |
124 const fileapi::AsyncFileUtil::StatusCallback& callback) { | 162 const fileapi::AsyncFileUtil::StatusCallback& callback) { |
125 if (!request_manager_.CreateRequest( | 163 const int request_id = request_manager_.CreateRequest( |
126 CLOSE_FILE, | 164 CLOSE_FILE, |
127 scoped_ptr<RequestManager::HandlerInterface>( | 165 scoped_ptr<RequestManager::HandlerInterface>(new operations::CloseFile( |
128 new operations::CloseFile( | 166 event_router_, file_system_info_, file_handle, callback))); |
129 event_router_, file_system_info_, file_handle, callback)))) { | 167 if (!request_id) { |
130 callback.Run(base::File::FILE_ERROR_SECURITY); | 168 callback.Run(base::File::FILE_ERROR_SECURITY); |
131 } | 169 return AbortCallback(); |
132 } | 170 } |
133 | 171 |
134 void ProvidedFileSystem::CreateDirectory( | 172 return base::Bind( |
| 173 &ProvidedFileSystem::Abort, weak_ptr_factory_.GetWeakPtr(), request_id); |
| 174 } |
| 175 |
| 176 ProvidedFileSystem::AbortCallback ProvidedFileSystem::CreateDirectory( |
135 const base::FilePath& directory_path, | 177 const base::FilePath& directory_path, |
136 bool exclusive, | 178 bool exclusive, |
137 bool recursive, | 179 bool recursive, |
138 const fileapi::AsyncFileUtil::StatusCallback& callback) { | 180 const fileapi::AsyncFileUtil::StatusCallback& callback) { |
139 if (!request_manager_.CreateRequest( | 181 const int request_id = request_manager_.CreateRequest( |
140 CREATE_DIRECTORY, | 182 CREATE_DIRECTORY, |
141 scoped_ptr<RequestManager::HandlerInterface>( | 183 scoped_ptr<RequestManager::HandlerInterface>( |
142 new operations::CreateDirectory(event_router_, | 184 new operations::CreateDirectory(event_router_, |
143 file_system_info_, | 185 file_system_info_, |
144 directory_path, | 186 directory_path, |
145 exclusive, | 187 exclusive, |
146 recursive, | 188 recursive, |
147 callback)))) { | 189 callback))); |
148 callback.Run(base::File::FILE_ERROR_SECURITY); | 190 if (!request_id) { |
149 } | 191 callback.Run(base::File::FILE_ERROR_SECURITY); |
150 } | 192 return AbortCallback(); |
151 | 193 } |
152 void ProvidedFileSystem::DeleteEntry( | 194 |
| 195 return base::Bind( |
| 196 &ProvidedFileSystem::Abort, weak_ptr_factory_.GetWeakPtr(), request_id); |
| 197 } |
| 198 |
| 199 ProvidedFileSystem::AbortCallback ProvidedFileSystem::DeleteEntry( |
153 const base::FilePath& entry_path, | 200 const base::FilePath& entry_path, |
154 bool recursive, | 201 bool recursive, |
155 const fileapi::AsyncFileUtil::StatusCallback& callback) { | 202 const fileapi::AsyncFileUtil::StatusCallback& callback) { |
156 if (!request_manager_.CreateRequest( | 203 const int request_id = request_manager_.CreateRequest( |
157 DELETE_ENTRY, | 204 DELETE_ENTRY, |
158 scoped_ptr<RequestManager::HandlerInterface>( | 205 scoped_ptr<RequestManager::HandlerInterface>(new operations::DeleteEntry( |
159 new operations::DeleteEntry(event_router_, | 206 event_router_, file_system_info_, entry_path, recursive, callback))); |
160 file_system_info_, | 207 if (!request_id) { |
161 entry_path, | 208 callback.Run(base::File::FILE_ERROR_SECURITY); |
162 recursive, | 209 return AbortCallback(); |
163 callback)))) { | 210 } |
164 callback.Run(base::File::FILE_ERROR_SECURITY); | 211 |
165 } | 212 return base::Bind( |
166 } | 213 &ProvidedFileSystem::Abort, weak_ptr_factory_.GetWeakPtr(), request_id); |
167 | 214 } |
168 void ProvidedFileSystem::CreateFile( | 215 |
| 216 ProvidedFileSystem::AbortCallback ProvidedFileSystem::CreateFile( |
169 const base::FilePath& file_path, | 217 const base::FilePath& file_path, |
170 const fileapi::AsyncFileUtil::StatusCallback& callback) { | 218 const fileapi::AsyncFileUtil::StatusCallback& callback) { |
171 if (!request_manager_.CreateRequest( | 219 const int request_id = request_manager_.CreateRequest( |
172 CREATE_FILE, | 220 CREATE_FILE, |
173 scoped_ptr<RequestManager::HandlerInterface>( | 221 scoped_ptr<RequestManager::HandlerInterface>(new operations::CreateFile( |
174 new operations::CreateFile( | 222 event_router_, file_system_info_, file_path, callback))); |
175 event_router_, file_system_info_, file_path, callback)))) { | 223 if (!request_id) { |
176 callback.Run(base::File::FILE_ERROR_SECURITY); | 224 callback.Run(base::File::FILE_ERROR_SECURITY); |
177 } | 225 return AbortCallback(); |
178 } | 226 } |
179 | 227 |
180 void ProvidedFileSystem::CopyEntry( | 228 return base::Bind( |
| 229 &ProvidedFileSystem::Abort, weak_ptr_factory_.GetWeakPtr(), request_id); |
| 230 } |
| 231 |
| 232 ProvidedFileSystem::AbortCallback ProvidedFileSystem::CopyEntry( |
181 const base::FilePath& source_path, | 233 const base::FilePath& source_path, |
182 const base::FilePath& target_path, | 234 const base::FilePath& target_path, |
183 const fileapi::AsyncFileUtil::StatusCallback& callback) { | 235 const fileapi::AsyncFileUtil::StatusCallback& callback) { |
184 if (!request_manager_.CreateRequest( | 236 const int request_id = request_manager_.CreateRequest( |
185 COPY_ENTRY, | 237 COPY_ENTRY, |
186 scoped_ptr<RequestManager::HandlerInterface>( | 238 scoped_ptr<RequestManager::HandlerInterface>( |
187 new operations::CopyEntry(event_router_, | 239 new operations::CopyEntry(event_router_, |
188 file_system_info_, | 240 file_system_info_, |
189 source_path, | 241 source_path, |
190 target_path, | 242 target_path, |
191 callback)))) { | 243 callback))); |
192 callback.Run(base::File::FILE_ERROR_SECURITY); | 244 if (!request_id) { |
193 } | 245 callback.Run(base::File::FILE_ERROR_SECURITY); |
194 } | 246 return AbortCallback(); |
195 | 247 } |
196 void ProvidedFileSystem::WriteFile( | 248 |
| 249 return base::Bind( |
| 250 &ProvidedFileSystem::Abort, weak_ptr_factory_.GetWeakPtr(), request_id); |
| 251 } |
| 252 |
| 253 ProvidedFileSystem::AbortCallback ProvidedFileSystem::WriteFile( |
197 int file_handle, | 254 int file_handle, |
198 net::IOBuffer* buffer, | 255 net::IOBuffer* buffer, |
199 int64 offset, | 256 int64 offset, |
200 int length, | 257 int length, |
201 const fileapi::AsyncFileUtil::StatusCallback& callback) { | 258 const fileapi::AsyncFileUtil::StatusCallback& callback) { |
202 TRACE_EVENT1("file_system_provider", | 259 TRACE_EVENT1("file_system_provider", |
203 "ProvidedFileSystem::WriteFile", | 260 "ProvidedFileSystem::WriteFile", |
204 "length", | 261 "length", |
205 length); | 262 length); |
206 if (!request_manager_.CreateRequest( | 263 const int request_id = request_manager_.CreateRequest( |
207 WRITE_FILE, | 264 WRITE_FILE, |
208 make_scoped_ptr<RequestManager::HandlerInterface>( | 265 make_scoped_ptr<RequestManager::HandlerInterface>( |
209 new operations::WriteFile(event_router_, | 266 new operations::WriteFile(event_router_, |
210 file_system_info_, | 267 file_system_info_, |
211 file_handle, | 268 file_handle, |
212 make_scoped_refptr(buffer), | 269 make_scoped_refptr(buffer), |
213 offset, | 270 offset, |
214 length, | 271 length, |
215 callback)))) { | 272 callback))); |
| 273 if (!request_id) { |
216 callback.Run(base::File::FILE_ERROR_SECURITY); | 274 callback.Run(base::File::FILE_ERROR_SECURITY); |
| 275 return AbortCallback(); |
217 } | 276 } |
| 277 |
| 278 return base::Bind( |
| 279 &ProvidedFileSystem::Abort, weak_ptr_factory_.GetWeakPtr(), request_id); |
218 } | 280 } |
219 | 281 |
220 void ProvidedFileSystem::MoveEntry( | 282 ProvidedFileSystem::AbortCallback ProvidedFileSystem::MoveEntry( |
221 const base::FilePath& source_path, | 283 const base::FilePath& source_path, |
222 const base::FilePath& target_path, | 284 const base::FilePath& target_path, |
223 const fileapi::AsyncFileUtil::StatusCallback& callback) { | 285 const fileapi::AsyncFileUtil::StatusCallback& callback) { |
224 if (!request_manager_.CreateRequest( | 286 const int request_id = request_manager_.CreateRequest( |
225 MOVE_ENTRY, | 287 MOVE_ENTRY, |
226 scoped_ptr<RequestManager::HandlerInterface>( | 288 scoped_ptr<RequestManager::HandlerInterface>( |
227 new operations::MoveEntry(event_router_, | 289 new operations::MoveEntry(event_router_, |
228 file_system_info_, | 290 file_system_info_, |
229 source_path, | 291 source_path, |
230 target_path, | 292 target_path, |
231 callback)))) { | 293 callback))); |
| 294 if (!request_id) { |
232 callback.Run(base::File::FILE_ERROR_SECURITY); | 295 callback.Run(base::File::FILE_ERROR_SECURITY); |
| 296 return AbortCallback(); |
233 } | 297 } |
| 298 |
| 299 return base::Bind( |
| 300 &ProvidedFileSystem::Abort, weak_ptr_factory_.GetWeakPtr(), request_id); |
234 } | 301 } |
235 | 302 |
236 void ProvidedFileSystem::Truncate( | 303 ProvidedFileSystem::AbortCallback ProvidedFileSystem::Truncate( |
237 const base::FilePath& file_path, | 304 const base::FilePath& file_path, |
238 int64 length, | 305 int64 length, |
239 const fileapi::AsyncFileUtil::StatusCallback& callback) { | 306 const fileapi::AsyncFileUtil::StatusCallback& callback) { |
240 if (!request_manager_.CreateRequest( | 307 const int request_id = request_manager_.CreateRequest( |
241 TRUNCATE, | 308 TRUNCATE, |
242 scoped_ptr<RequestManager::HandlerInterface>( | 309 scoped_ptr<RequestManager::HandlerInterface>(new operations::Truncate( |
243 new operations::Truncate(event_router_, | 310 event_router_, file_system_info_, file_path, length, callback))); |
244 file_system_info_, | 311 if (!request_id) { |
245 file_path, | |
246 length, | |
247 callback)))) { | |
248 callback.Run(base::File::FILE_ERROR_SECURITY); | 312 callback.Run(base::File::FILE_ERROR_SECURITY); |
| 313 return AbortCallback(); |
249 } | 314 } |
| 315 |
| 316 return base::Bind( |
| 317 &ProvidedFileSystem::Abort, weak_ptr_factory_.GetWeakPtr(), request_id); |
250 } | 318 } |
251 | 319 |
252 const ProvidedFileSystemInfo& ProvidedFileSystem::GetFileSystemInfo() const { | 320 const ProvidedFileSystemInfo& ProvidedFileSystem::GetFileSystemInfo() const { |
253 return file_system_info_; | 321 return file_system_info_; |
254 } | 322 } |
255 | 323 |
256 RequestManager* ProvidedFileSystem::GetRequestManager() { | 324 RequestManager* ProvidedFileSystem::GetRequestManager() { |
257 return &request_manager_; | 325 return &request_manager_; |
258 } | 326 } |
259 | 327 |
260 base::WeakPtr<ProvidedFileSystemInterface> ProvidedFileSystem::GetWeakPtr() { | 328 base::WeakPtr<ProvidedFileSystemInterface> ProvidedFileSystem::GetWeakPtr() { |
261 return weak_ptr_factory_.GetWeakPtr(); | 329 return weak_ptr_factory_.GetWeakPtr(); |
262 } | 330 } |
263 | 331 |
| 332 void ProvidedFileSystem::Abort( |
| 333 int operation_request_id, |
| 334 const fileapi::AsyncFileUtil::StatusCallback& callback) { |
| 335 request_manager_.RejectRequest(operation_request_id, |
| 336 make_scoped_ptr(new RequestValue()), |
| 337 base::File::FILE_ERROR_ABORT); |
| 338 if (!request_manager_.CreateRequest( |
| 339 ABORT, |
| 340 scoped_ptr<RequestManager::HandlerInterface>( |
| 341 new operations::Abort(event_router_, |
| 342 file_system_info_, |
| 343 operation_request_id, |
| 344 callback)))) { |
| 345 callback.Run(base::File::FILE_ERROR_SECURITY); |
| 346 } |
| 347 } |
| 348 |
264 } // namespace file_system_provider | 349 } // namespace file_system_provider |
265 } // namespace chromeos | 350 } // namespace chromeos |
OLD | NEW |