Chromium Code Reviews| 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 "webkit/blob/local_file_stream_reader.h" | 14 #include "webkit/blob/local_file_stream_reader.h" |
| 15 #include "webkit/fileapi/file_system_callback_dispatcher.h" | 15 #include "webkit/fileapi/file_system_callback_dispatcher.h" |
| 16 #include "webkit/fileapi/file_system_context.h" | 16 #include "webkit/fileapi/file_system_context.h" |
| 17 #include "webkit/fileapi/file_system_file_stream_reader.h" | 17 #include "webkit/fileapi/file_system_file_stream_reader.h" |
| 18 #include "webkit/fileapi/file_system_operation.h" | 18 #include "webkit/fileapi/file_system_operation.h" |
| 19 #include "webkit/fileapi/file_system_types.h" | 19 #include "webkit/fileapi/file_system_types.h" |
| 20 #include "webkit/fileapi/file_system_util.h" | 20 #include "webkit/fileapi/file_system_util.h" |
| 21 #include "webkit/fileapi/isolated_context.h" | 21 #include "webkit/fileapi/isolated_context.h" |
| 22 #include "webkit/fileapi/isolated_file_util.h" | 22 #include "webkit/fileapi/isolated_file_util.h" |
| 23 #include "webkit/fileapi/media_file_system_operation.h" | |
| 24 #include "webkit/fileapi/media_file_system_proxy_win.h" | |
| 23 #include "webkit/fileapi/local_file_stream_writer.h" | 25 #include "webkit/fileapi/local_file_stream_writer.h" |
| 24 #include "webkit/fileapi/native_file_util.h" | 26 #include "webkit/fileapi/native_file_util.h" |
| 25 | 27 |
| 26 namespace fileapi { | 28 namespace fileapi { |
| 27 | 29 |
| 28 namespace { | 30 namespace { |
| 29 | 31 |
| 30 IsolatedContext* isolated_context() { | 32 IsolatedContext* isolated_context() { |
| 31 return IsolatedContext::GetInstance(); | 33 return IsolatedContext::GetInstance(); |
| 32 } | 34 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 FilePath path; | 104 FilePath path; |
| 103 if (!isolated_context()->CrackIsolatedPath(virtual_path, &fsid, NULL, &path)) | 105 if (!isolated_context()->CrackIsolatedPath(virtual_path, &fsid, NULL, &path)) |
| 104 return FilePath(); | 106 return FilePath(); |
| 105 return path; | 107 return path; |
| 106 } | 108 } |
| 107 | 109 |
| 108 FileSystemOperationInterface* | 110 FileSystemOperationInterface* |
| 109 IsolatedMountPointProvider::CreateFileSystemOperation( | 111 IsolatedMountPointProvider::CreateFileSystemOperation( |
| 110 const FileSystemURL& url, | 112 const FileSystemURL& url, |
| 111 FileSystemContext* context) const { | 113 FileSystemContext* context) const { |
| 114 FilePath temp = GetPathFromURL(url); | |
|
kinuko
2012/07/18 10:33:24
Please check if the path is not empty. GetPathFro
| |
| 115 printf("temp.path:%s\n", temp.value().c_str()); | |
|
kinuko
2012/07/18 10:33:24
Please remove this when you create a final patch
| |
| 116 FilePath::StringType Filename(temp.value()); | |
|
kinuko
2012/07/18 10:33:24
nit: Filename -> filename
| |
| 117 const wchar_t file_prefix[] = L"\\?\\"; | |
|
kinuko
2012/07/18 10:33:24
wchar_t -> FilePath::CharType
Since this works on
| |
| 118 int res = Filename.compare(0,4, file_prefix); | |
| 119 if (!res) { | |
| 120 return new fileapi::MediaFileSystemOperation(context, new fileapi::MediaFile SystemProxyWin(Filename)); | |
|
kinuko
2012/07/18 10:33:24
Ditto. We should have a platform-common factory me
| |
| 121 } | |
| 112 return new FileSystemOperation(context); | 122 return new FileSystemOperation(context); |
| 113 } | 123 } |
| 114 | 124 |
| 115 webkit_blob::FileStreamReader* | 125 webkit_blob::FileStreamReader* |
| 116 IsolatedMountPointProvider::CreateFileStreamReader( | 126 IsolatedMountPointProvider::CreateFileStreamReader( |
| 117 const FileSystemURL& url, | 127 const FileSystemURL& url, |
| 118 int64 offset, | 128 int64 offset, |
| 119 FileSystemContext* context) const { | 129 FileSystemContext* context) const { |
| 120 FilePath path = GetPathFromURL(url); | 130 FilePath path = GetPathFromURL(url); |
| 121 return path.empty() ? NULL : new webkit_blob::LocalFileStreamReader( | 131 return path.empty() ? NULL : new webkit_blob::LocalFileStreamReader( |
| 122 context->file_task_runner(), path, offset, base::Time()); | 132 context->file_task_runner(), path, offset, base::Time()); |
| 123 } | 133 } |
| 124 | 134 |
| 125 FileStreamWriter* IsolatedMountPointProvider::CreateFileStreamWriter( | 135 FileStreamWriter* IsolatedMountPointProvider::CreateFileStreamWriter( |
| 126 const FileSystemURL& url, | 136 const FileSystemURL& url, |
| 127 int64 offset, | 137 int64 offset, |
| 128 FileSystemContext* context) const { | 138 FileSystemContext* context) const { |
| 129 FilePath path = GetPathFromURL(url); | 139 FilePath path = GetPathFromURL(url); |
| 130 return path.empty() ? NULL : new LocalFileStreamWriter(path, offset); | 140 return path.empty() ? NULL : new LocalFileStreamWriter(path, offset); |
| 131 } | 141 } |
| 132 | 142 |
| 133 FileSystemQuotaUtil* IsolatedMountPointProvider::GetQuotaUtil() { | 143 FileSystemQuotaUtil* IsolatedMountPointProvider::GetQuotaUtil() { |
| 134 // No quota support. | 144 // No quota support. |
| 135 return NULL; | 145 return NULL; |
| 136 } | 146 } |
| 137 | 147 |
| 138 } // namespace fileapi | 148 } // namespace fileapi |
| OLD | NEW |