OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/common/fileapi/file_system_dispatcher.h" | 5 #include "content/common/fileapi/file_system_dispatcher.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/process.h" | 8 #include "base/process.h" |
9 #include "content/common/child_thread.h" | 9 #include "content/common/child_thread.h" |
10 #include "content/common/fileapi/file_system_messages.h" | 10 #include "content/common/fileapi/file_system_messages.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 int request_id = dispatchers_.Add(dispatcher); | 258 int request_id = dispatchers_.Add(dispatcher); |
259 if (!ChildThread::current()->Send( | 259 if (!ChildThread::current()->Send( |
260 new FileSystemHostMsg_CreateSnapshotFile( | 260 new FileSystemHostMsg_CreateSnapshotFile( |
261 request_id, file_path))) { | 261 request_id, file_path))) { |
262 dispatchers_.Remove(request_id); // destroys |dispatcher| | 262 dispatchers_.Remove(request_id); // destroys |dispatcher| |
263 return false; | 263 return false; |
264 } | 264 } |
265 return true; | 265 return true; |
266 } | 266 } |
267 | 267 |
268 bool FileSystemDispatcher::CreateSnapshotFile_Deprecated( | |
269 const GURL& blob_url, | |
270 const GURL& file_path, | |
271 fileapi::FileSystemCallbackDispatcher* dispatcher) { | |
272 int request_id = dispatchers_.Add(dispatcher); | |
273 if (!ChildThread::current()->Send( | |
274 new FileSystemHostMsg_CreateSnapshotFile_Deprecated( | |
275 request_id, blob_url, file_path))) { | |
276 dispatchers_.Remove(request_id); // destroys |dispatcher| | |
277 return false; | |
278 } | |
279 return true; | |
280 } | |
281 | |
282 void FileSystemDispatcher::OnDidOpenFileSystem(int request_id, | 268 void FileSystemDispatcher::OnDidOpenFileSystem(int request_id, |
283 const std::string& name, | 269 const std::string& name, |
284 const GURL& root) { | 270 const GURL& root) { |
285 DCHECK(root.is_valid()); | 271 DCHECK(root.is_valid()); |
286 fileapi::FileSystemCallbackDispatcher* dispatcher = | 272 fileapi::FileSystemCallbackDispatcher* dispatcher = |
287 dispatchers_.Lookup(request_id); | 273 dispatchers_.Lookup(request_id); |
288 DCHECK(dispatcher); | 274 DCHECK(dispatcher); |
289 dispatcher->DidOpenFileSystem(name, root); | 275 dispatcher->DidOpenFileSystem(name, root); |
290 dispatchers_.Remove(request_id); | 276 dispatchers_.Remove(request_id); |
291 } | 277 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 quota::QuotaLimitType quota_policy) { | 342 quota::QuotaLimitType quota_policy) { |
357 fileapi::FileSystemCallbackDispatcher* dispatcher = | 343 fileapi::FileSystemCallbackDispatcher* dispatcher = |
358 dispatchers_.Lookup(request_id); | 344 dispatchers_.Lookup(request_id); |
359 DCHECK(dispatcher); | 345 DCHECK(dispatcher); |
360 dispatcher->DidOpenFile(IPC::PlatformFileForTransitToPlatformFile(file), | 346 dispatcher->DidOpenFile(IPC::PlatformFileForTransitToPlatformFile(file), |
361 quota_policy); | 347 quota_policy); |
362 dispatchers_.Remove(request_id); | 348 dispatchers_.Remove(request_id); |
363 } | 349 } |
364 | 350 |
365 } // namespace content | 351 } // namespace content |
OLD | NEW |