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/chromeos/fileapi/cros_mount_point_provider.h" | 5 #include "webkit/chromeos/fileapi/cros_mount_point_provider.h" |
6 | 6 |
7 #include "base/chromeos/chromeos_version.h" | 7 #include "base/chromeos/chromeos_version.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h
" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h
" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSyste
m.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSyste
m.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
18 #include "webkit/chromeos/fileapi/file_access_permissions.h" | 18 #include "webkit/chromeos/fileapi/file_access_permissions.h" |
19 #include "webkit/chromeos/fileapi/remote_file_stream_writer.h" | 19 #include "webkit/chromeos/fileapi/remote_file_stream_writer.h" |
20 #include "webkit/chromeos/fileapi/remote_file_system_operation.h" | 20 #include "webkit/chromeos/fileapi/remote_file_system_operation.h" |
21 #include "webkit/fileapi/file_system_file_stream_reader.h" | 21 #include "webkit/fileapi/file_system_file_stream_reader.h" |
| 22 #include "webkit/fileapi/file_system_operation_context.h" |
22 #include "webkit/fileapi/file_system_url.h" | 23 #include "webkit/fileapi/file_system_url.h" |
23 #include "webkit/fileapi/file_system_util.h" | 24 #include "webkit/fileapi/file_system_util.h" |
24 #include "webkit/fileapi/local_file_stream_writer.h" | 25 #include "webkit/fileapi/local_file_stream_writer.h" |
25 #include "webkit/fileapi/local_file_system_operation.h" | 26 #include "webkit/fileapi/local_file_system_operation.h" |
26 #include "webkit/glue/webkit_glue.h" | 27 #include "webkit/glue/webkit_glue.h" |
27 | 28 |
28 namespace { | 29 namespace { |
29 | 30 |
30 const char kChromeUIScheme[] = "chrome"; | 31 const char kChromeUIScheme[] = "chrome"; |
31 | 32 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 } | 246 } |
246 | 247 |
247 fileapi::FileSystemOperationInterface* | 248 fileapi::FileSystemOperationInterface* |
248 CrosMountPointProvider::CreateFileSystemOperation( | 249 CrosMountPointProvider::CreateFileSystemOperation( |
249 const fileapi::FileSystemURL& url, | 250 const fileapi::FileSystemURL& url, |
250 fileapi::FileSystemContext* context) const { | 251 fileapi::FileSystemContext* context) const { |
251 const MountPoint* mount_point = GetMountPoint(url.path()); | 252 const MountPoint* mount_point = GetMountPoint(url.path()); |
252 if (mount_point && mount_point->location == REMOTE) | 253 if (mount_point && mount_point->location == REMOTE) |
253 return new chromeos::RemoteFileSystemOperation(mount_point->remote_proxy); | 254 return new chromeos::RemoteFileSystemOperation(mount_point->remote_proxy); |
254 | 255 |
255 return new fileapi::LocalFileSystemOperation(context); | 256 scoped_ptr<fileapi::FileSystemOperationContext> operation_context( |
| 257 new fileapi::FileSystemOperationContext(context)); |
| 258 return new fileapi::LocalFileSystemOperation(context, |
| 259 operation_context.Pass()); |
256 } | 260 } |
257 | 261 |
258 webkit_blob::FileStreamReader* CrosMountPointProvider::CreateFileStreamReader( | 262 webkit_blob::FileStreamReader* CrosMountPointProvider::CreateFileStreamReader( |
259 const fileapi::FileSystemURL& url, | 263 const fileapi::FileSystemURL& url, |
260 int64 offset, | 264 int64 offset, |
261 fileapi::FileSystemContext* context) const { | 265 fileapi::FileSystemContext* context) const { |
262 // For now we return a generic Reader implementation which utilizes | 266 // For now we return a generic Reader implementation which utilizes |
263 // CreateSnapshotFile internally (i.e. will download everything first). | 267 // CreateSnapshotFile internally (i.e. will download everything first). |
264 // TODO(satorux,zel): implement more efficient reader for remote cases. | 268 // TODO(satorux,zel): implement more efficient reader for remote cases. |
265 return new fileapi::FileSystemFileStreamReader(context, url, offset); | 269 return new fileapi::FileSystemFileStreamReader(context, url, offset); |
(...skipping 28 matching lines...) Expand all Loading... |
294 if (mount_prefix == filesystem_path) { | 298 if (mount_prefix == filesystem_path) { |
295 return true; | 299 return true; |
296 } else if (mount_prefix.AppendRelativePath(filesystem_path, virtual_path)) { | 300 } else if (mount_prefix.AppendRelativePath(filesystem_path, virtual_path)) { |
297 return true; | 301 return true; |
298 } | 302 } |
299 } | 303 } |
300 return false; | 304 return false; |
301 } | 305 } |
302 | 306 |
303 } // namespace chromeos | 307 } // namespace chromeos |
OLD | NEW |