| 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 "webkit/fileapi/isolated_mount_point_provider.h" | 5 #include "webkit/fileapi/isolated_mount_point_provider.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/message_loop_proxy.h" | 12 #include "base/message_loop_proxy.h" |
| 13 #include "base/sequenced_task_runner.h" | 13 #include "base/sequenced_task_runner.h" |
| 14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
| 15 #include "webkit/blob/local_file_reader.h" | 15 #include "webkit/blob/local_file_stream_reader.h" |
| 16 #include "webkit/fileapi/file_system_callback_dispatcher.h" | 16 #include "webkit/fileapi/file_system_callback_dispatcher.h" |
| 17 #include "webkit/fileapi/file_system_context.h" | 17 #include "webkit/fileapi/file_system_context.h" |
| 18 #include "webkit/fileapi/file_system_file_reader.h" | 18 #include "webkit/fileapi/file_system_file_stream_reader.h" |
| 19 #include "webkit/fileapi/file_system_operation.h" | 19 #include "webkit/fileapi/file_system_operation.h" |
| 20 #include "webkit/fileapi/file_system_types.h" | 20 #include "webkit/fileapi/file_system_types.h" |
| 21 #include "webkit/fileapi/file_system_util.h" | 21 #include "webkit/fileapi/file_system_util.h" |
| 22 #include "webkit/fileapi/isolated_context.h" | 22 #include "webkit/fileapi/isolated_context.h" |
| 23 #include "webkit/fileapi/isolated_file_util.h" | 23 #include "webkit/fileapi/isolated_file_util.h" |
| 24 #include "webkit/fileapi/local_file_writer.h" | 24 #include "webkit/fileapi/local_file_writer.h" |
| 25 #include "webkit/fileapi/native_file_util.h" | 25 #include "webkit/fileapi/native_file_util.h" |
| 26 | 26 |
| 27 namespace fileapi { | 27 namespace fileapi { |
| 28 | 28 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 FileSystemOperationInterface* | 96 FileSystemOperationInterface* |
| 97 IsolatedMountPointProvider::CreateFileSystemOperation( | 97 IsolatedMountPointProvider::CreateFileSystemOperation( |
| 98 const GURL& origin_url, | 98 const GURL& origin_url, |
| 99 FileSystemType file_system_type, | 99 FileSystemType file_system_type, |
| 100 const FilePath& virtual_path, | 100 const FilePath& virtual_path, |
| 101 FileSystemContext* context) const { | 101 FileSystemContext* context) const { |
| 102 return new FileSystemOperation(context); | 102 return new FileSystemOperation(context); |
| 103 } | 103 } |
| 104 | 104 |
| 105 webkit_blob::FileReader* IsolatedMountPointProvider::CreateFileReader( | 105 webkit_blob::FileStreamReader* |
| 106 IsolatedMountPointProvider::CreateFileStreamReader( |
| 106 const GURL& url, | 107 const GURL& url, |
| 107 int64 offset, | 108 int64 offset, |
| 108 FileSystemContext* context) const { | 109 FileSystemContext* context) const { |
| 109 FilePath path = GetPathFromURL(url); | 110 FilePath path = GetPathFromURL(url); |
| 110 return path.empty() ? NULL : new webkit_blob::LocalFileReader( | 111 return path.empty() ? NULL : new webkit_blob::LocalFileStreamReader( |
| 111 context->file_task_runner(), path, offset, base::Time()); | 112 context->file_task_runner(), path, offset, base::Time()); |
| 112 } | 113 } |
| 113 | 114 |
| 114 FileWriter* IsolatedMountPointProvider::CreateFileWriter( | 115 FileWriter* IsolatedMountPointProvider::CreateFileWriter( |
| 115 const GURL& url, | 116 const GURL& url, |
| 116 int64 offset, | 117 int64 offset, |
| 117 FileSystemContext* context) const { | 118 FileSystemContext* context) const { |
| 118 FilePath path = GetPathFromURL(url); | 119 FilePath path = GetPathFromURL(url); |
| 119 return path.empty() ? NULL : new LocalFileWriter(path, offset); | 120 return path.empty() ? NULL : new LocalFileWriter(path, offset); |
| 120 } | 121 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 135 if (!CrackFileSystemURL(url, &origin_url, &file_system_type, &virtual_path)) | 136 if (!CrackFileSystemURL(url, &origin_url, &file_system_type, &virtual_path)) |
| 136 return FilePath(); | 137 return FilePath(); |
| 137 std::string fsid; | 138 std::string fsid; |
| 138 FilePath path; | 139 FilePath path; |
| 139 if (!isolated_context()->CrackIsolatedPath(virtual_path, &fsid, NULL, &path)) | 140 if (!isolated_context()->CrackIsolatedPath(virtual_path, &fsid, NULL, &path)) |
| 140 return FilePath(); | 141 return FilePath(); |
| 141 return path; | 142 return path; |
| 142 } | 143 } |
| 143 | 144 |
| 144 } // namespace fileapi | 145 } // namespace fileapi |
| OLD | NEW |