OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/file_system/file_system_dispatcher_host.h" | 5 #include "content/browser/file_system/file_system_dispatcher_host.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 const GURL& path, FilePath* platform_path) { | 287 const GURL& path, FilePath* platform_path) { |
288 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 288 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
289 DCHECK(platform_path); | 289 DCHECK(platform_path); |
290 *platform_path = FilePath(); | 290 *platform_path = FilePath(); |
291 base::PlatformFileInfo info; | 291 base::PlatformFileInfo info; |
292 GURL origin_url; | 292 GURL origin_url; |
293 fileapi::FileSystemType type; | 293 fileapi::FileSystemType type; |
294 FilePath virtual_path; | 294 FilePath virtual_path; |
295 if (!CrackFileSystemURL(path, &origin_url, &type, &virtual_path)) | 295 if (!CrackFileSystemURL(path, &origin_url, &type, &virtual_path)) |
296 return; | 296 return; |
297 FileSystemFileUtil* file_util = | 297 FileSystemFileUtil* file_util = context_->path_manager()->GetFileUtil(type); |
298 context_->path_manager()->GetFileSystemFileUtil(type); | |
299 if (!file_util) | 298 if (!file_util) |
300 return; | 299 return; |
301 FileSystemOperationContext operation_context(context_, file_util); | 300 FileSystemOperationContext operation_context(context_, file_util); |
302 operation_context.set_src_origin_url(origin_url); | 301 operation_context.set_src_origin_url(origin_url); |
303 operation_context.set_src_type(type); | 302 operation_context.set_src_type(type); |
304 file_util->GetFileInfo(&operation_context, virtual_path, | 303 file_util->GetFileInfo(&operation_context, virtual_path, |
305 &info, platform_path); | 304 &info, platform_path); |
306 } | 305 } |
307 | 306 |
308 FileSystemOperation* FileSystemDispatcherHost::GetNewOperation( | 307 FileSystemOperation* FileSystemDispatcherHost::GetNewOperation( |
309 int request_id) { | 308 int request_id) { |
310 BrowserFileSystemCallbackDispatcher* dispatcher = | 309 BrowserFileSystemCallbackDispatcher* dispatcher = |
311 new BrowserFileSystemCallbackDispatcher(this, request_id); | 310 new BrowserFileSystemCallbackDispatcher(this, request_id); |
312 FileSystemOperation* operation = new FileSystemOperation( | 311 FileSystemOperation* operation = new FileSystemOperation( |
313 dispatcher, | 312 dispatcher, |
314 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), | 313 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), |
315 context_, | 314 context_, |
316 NULL); | 315 NULL); |
317 operations_.AddWithID(operation, request_id); | 316 operations_.AddWithID(operation, request_id); |
318 return operation; | 317 return operation; |
319 } | 318 } |
320 | 319 |
321 void FileSystemDispatcherHost::UnregisterOperation(int request_id) { | 320 void FileSystemDispatcherHost::UnregisterOperation(int request_id) { |
322 DCHECK(operations_.Lookup(request_id)); | 321 DCHECK(operations_.Lookup(request_id)); |
323 operations_.Remove(request_id); | 322 operations_.Remove(request_id); |
324 } | 323 } |
OLD | NEW |