| 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 const GURL& path, FilePath* platform_path) { | 284 const GURL& path, FilePath* platform_path) { |
| 285 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 285 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 286 DCHECK(platform_path); | 286 DCHECK(platform_path); |
| 287 *platform_path = FilePath(); | 287 *platform_path = FilePath(); |
| 288 base::PlatformFileInfo info; | 288 base::PlatformFileInfo info; |
| 289 GURL origin_url; | 289 GURL origin_url; |
| 290 fileapi::FileSystemType type; | 290 fileapi::FileSystemType type; |
| 291 FilePath virtual_path; | 291 FilePath virtual_path; |
| 292 if (!CrackFileSystemURL(path, &origin_url, &type, &virtual_path)) | 292 if (!CrackFileSystemURL(path, &origin_url, &type, &virtual_path)) |
| 293 return; | 293 return; |
| 294 FileSystemFileUtil* file_util = | 294 FileSystemFileUtil* file_util = context_->path_manager()->GetFileUtil(type); |
| 295 context_->path_manager()->GetFileSystemFileUtil(type); | |
| 296 if (!file_util) | 295 if (!file_util) |
| 297 return; | 296 return; |
| 298 FileSystemOperationContext operation_context(context_, file_util); | 297 FileSystemOperationContext operation_context(context_, file_util); |
| 299 operation_context.set_src_origin_url(origin_url); | 298 operation_context.set_src_origin_url(origin_url); |
| 300 operation_context.set_src_type(type); | 299 operation_context.set_src_type(type); |
| 301 file_util->GetFileInfo(&operation_context, virtual_path, | 300 file_util->GetFileInfo(&operation_context, virtual_path, |
| 302 &info, platform_path); | 301 &info, platform_path); |
| 303 } | 302 } |
| 304 | 303 |
| 305 FileSystemOperation* FileSystemDispatcherHost::GetNewOperation( | 304 FileSystemOperation* FileSystemDispatcherHost::GetNewOperation( |
| 306 int request_id) { | 305 int request_id) { |
| 307 BrowserFileSystemCallbackDispatcher* dispatcher = | 306 BrowserFileSystemCallbackDispatcher* dispatcher = |
| 308 new BrowserFileSystemCallbackDispatcher(this, request_id); | 307 new BrowserFileSystemCallbackDispatcher(this, request_id); |
| 309 FileSystemOperation* operation = new FileSystemOperation( | 308 FileSystemOperation* operation = new FileSystemOperation( |
| 310 dispatcher, | 309 dispatcher, |
| 311 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), | 310 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), |
| 312 context_, | 311 context_, |
| 313 NULL); | 312 NULL); |
| 314 operations_.AddWithID(operation, request_id); | 313 operations_.AddWithID(operation, request_id); |
| 315 return operation; | 314 return operation; |
| 316 } | 315 } |
| 317 | 316 |
| 318 void FileSystemDispatcherHost::UnregisterOperation(int request_id) { | 317 void FileSystemDispatcherHost::UnregisterOperation(int request_id) { |
| 319 DCHECK(operations_.Lookup(request_id)); | 318 DCHECK(operations_.Lookup(request_id)); |
| 320 operations_.Remove(request_id); | 319 operations_.Remove(request_id); |
| 321 } | 320 } |
| OLD | NEW |