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 "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
14 #include "webkit/blob/local_file_reader.h" | 15 #include "webkit/blob/local_file_reader.h" |
15 #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" |
16 #include "webkit/fileapi/file_system_file_reader.h" | 18 #include "webkit/fileapi/file_system_file_reader.h" |
17 #include "webkit/fileapi/file_system_operation.h" | 19 #include "webkit/fileapi/file_system_operation.h" |
18 #include "webkit/fileapi/file_system_types.h" | 20 #include "webkit/fileapi/file_system_types.h" |
19 #include "webkit/fileapi/file_system_util.h" | 21 #include "webkit/fileapi/file_system_util.h" |
20 #include "webkit/fileapi/isolated_context.h" | 22 #include "webkit/fileapi/isolated_context.h" |
21 #include "webkit/fileapi/isolated_file_util.h" | 23 #include "webkit/fileapi/isolated_file_util.h" |
22 #include "webkit/fileapi/native_file_util.h" | 24 #include "webkit/fileapi/native_file_util.h" |
23 | 25 |
24 namespace fileapi { | 26 namespace fileapi { |
25 | 27 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 if (!isolated_context()->CrackIsolatedPath(virtual_path, &fsid, &root, &path)) | 90 if (!isolated_context()->CrackIsolatedPath(virtual_path, &fsid, &root, &path)) |
89 return FilePath(); | 91 return FilePath(); |
90 return path; | 92 return path; |
91 } | 93 } |
92 | 94 |
93 FileSystemOperationInterface* | 95 FileSystemOperationInterface* |
94 IsolatedMountPointProvider::CreateFileSystemOperation( | 96 IsolatedMountPointProvider::CreateFileSystemOperation( |
95 const GURL& origin_url, | 97 const GURL& origin_url, |
96 FileSystemType file_system_type, | 98 FileSystemType file_system_type, |
97 const FilePath& virtual_path, | 99 const FilePath& virtual_path, |
98 base::MessageLoopProxy* file_proxy, | |
99 FileSystemContext* context) const { | 100 FileSystemContext* context) const { |
100 return new FileSystemOperation(file_proxy, context); | 101 return new FileSystemOperation(context); |
101 } | 102 } |
102 | 103 |
103 webkit_blob::FileReader* IsolatedMountPointProvider::CreateFileReader( | 104 webkit_blob::FileReader* IsolatedMountPointProvider::CreateFileReader( |
104 const GURL& url, | 105 const GURL& url, |
105 int64 offset, | 106 int64 offset, |
106 base::MessageLoopProxy* file_proxy, | |
107 FileSystemContext* context) const { | 107 FileSystemContext* context) const { |
108 GURL origin_url; | 108 GURL origin_url; |
109 FileSystemType file_system_type = kFileSystemTypeUnknown; | 109 FileSystemType file_system_type = kFileSystemTypeUnknown; |
110 FilePath virtual_path; | 110 FilePath virtual_path; |
111 if (!CrackFileSystemURL(url, &origin_url, &file_system_type, &virtual_path)) | 111 if (!CrackFileSystemURL(url, &origin_url, &file_system_type, &virtual_path)) |
112 return NULL; | 112 return NULL; |
113 std::string fsid; | 113 std::string fsid; |
114 FilePath path; | 114 FilePath path; |
115 if (!isolated_context()->CrackIsolatedPath(virtual_path, &fsid, NULL, &path)) | 115 if (!isolated_context()->CrackIsolatedPath(virtual_path, &fsid, NULL, &path)) |
116 return NULL; | 116 return NULL; |
117 if (path.empty()) | 117 if (path.empty()) |
118 return NULL; | 118 return NULL; |
119 return new webkit_blob::LocalFileReader( | 119 return new webkit_blob::LocalFileReader( |
120 file_proxy, path, offset, base::Time()); | 120 context->file_task_runner(), path, offset, base::Time()); |
121 } | 121 } |
122 | 122 |
123 IsolatedContext* IsolatedMountPointProvider::isolated_context() const { | 123 IsolatedContext* IsolatedMountPointProvider::isolated_context() const { |
124 return IsolatedContext::GetInstance(); | 124 return IsolatedContext::GetInstance(); |
125 } | 125 } |
126 | 126 |
127 } // namespace fileapi | 127 } // namespace fileapi |
OLD | NEW |