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/browser/chromeos/fileapi/cros_mount_point_provider.h" | 5 #include "chrome/browser/chromeos/fileapi/cros_mount_point_provider.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
| 14 #include "chrome/browser/chromeos/fileapi/file_access_permissions.h" |
| 15 #include "chrome/browser/chromeos/fileapi/remote_file_stream_writer.h" |
| 16 #include "chrome/browser/chromeos/fileapi/remote_file_system_operation.h" |
14 #include "chromeos/dbus/cros_disks_client.h" | 17 #include "chromeos/dbus/cros_disks_client.h" |
15 #include "third_party/WebKit/public/platform/WebCString.h" | |
16 #include "third_party/WebKit/public/platform/WebFileSystem.h" | |
17 #include "third_party/WebKit/public/platform/WebString.h" | |
18 #include "webkit/browser/chromeos/fileapi/file_access_permissions.h" | |
19 #include "webkit/browser/chromeos/fileapi/remote_file_stream_writer.h" | |
20 #include "webkit/browser/chromeos/fileapi/remote_file_system_operation.h" | |
21 #include "webkit/browser/fileapi/async_file_util_adapter.h" | 18 #include "webkit/browser/fileapi/async_file_util_adapter.h" |
22 #include "webkit/browser/fileapi/copy_or_move_file_validator.h" | 19 #include "webkit/browser/fileapi/copy_or_move_file_validator.h" |
23 #include "webkit/browser/fileapi/external_mount_points.h" | 20 #include "webkit/browser/fileapi/external_mount_points.h" |
24 #include "webkit/browser/fileapi/file_system_context.h" | 21 #include "webkit/browser/fileapi/file_system_context.h" |
25 #include "webkit/browser/fileapi/file_system_file_stream_reader.h" | 22 #include "webkit/browser/fileapi/file_system_file_stream_reader.h" |
26 #include "webkit/browser/fileapi/file_system_operation_context.h" | 23 #include "webkit/browser/fileapi/file_system_operation_context.h" |
27 #include "webkit/browser/fileapi/file_system_task_runners.h" | 24 #include "webkit/browser/fileapi/file_system_task_runners.h" |
28 #include "webkit/browser/fileapi/file_system_url.h" | 25 #include "webkit/browser/fileapi/file_system_url.h" |
29 #include "webkit/browser/fileapi/isolated_context.h" | 26 #include "webkit/browser/fileapi/isolated_context.h" |
30 #include "webkit/browser/fileapi/isolated_file_util.h" | 27 #include "webkit/browser/fileapi/isolated_file_util.h" |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 base::PlatformFileError* error_code) const { | 265 base::PlatformFileError* error_code) const { |
269 DCHECK(url.is_valid()); | 266 DCHECK(url.is_valid()); |
270 | 267 |
271 if (url.type() == fileapi::kFileSystemTypeDrive) { | 268 if (url.type() == fileapi::kFileSystemTypeDrive) { |
272 fileapi::RemoteFileSystemProxyInterface* remote_proxy = | 269 fileapi::RemoteFileSystemProxyInterface* remote_proxy = |
273 GetRemoteProxy(url.filesystem_id()); | 270 GetRemoteProxy(url.filesystem_id()); |
274 if (!remote_proxy) { | 271 if (!remote_proxy) { |
275 *error_code = base::PLATFORM_FILE_ERROR_NOT_FOUND; | 272 *error_code = base::PLATFORM_FILE_ERROR_NOT_FOUND; |
276 return NULL; | 273 return NULL; |
277 } | 274 } |
278 return new chromeos::RemoteFileSystemOperation(remote_proxy); | 275 return new RemoteFileSystemOperation(remote_proxy); |
279 } | 276 } |
280 | 277 |
281 DCHECK(url.type() == fileapi::kFileSystemTypeNativeLocal || | 278 DCHECK(url.type() == fileapi::kFileSystemTypeNativeLocal || |
282 url.type() == fileapi::kFileSystemTypeRestrictedNativeLocal); | 279 url.type() == fileapi::kFileSystemTypeRestrictedNativeLocal); |
283 scoped_ptr<fileapi::FileSystemOperationContext> operation_context( | 280 scoped_ptr<fileapi::FileSystemOperationContext> operation_context( |
284 new fileapi::FileSystemOperationContext(context)); | 281 new fileapi::FileSystemOperationContext(context)); |
285 operation_context->set_root_path(GetFileSystemRootPath(url)); | 282 operation_context->set_root_path(GetFileSystemRootPath(url)); |
286 return new fileapi::LocalFileSystemOperation(url, context, | 283 return new fileapi::LocalFileSystemOperation(url, context, |
287 operation_context.Pass()); | 284 operation_context.Pass()); |
288 } | 285 } |
(...skipping 27 matching lines...) Expand all Loading... |
316 int64 offset, | 313 int64 offset, |
317 fileapi::FileSystemContext* context) const { | 314 fileapi::FileSystemContext* context) const { |
318 DCHECK(url.is_valid()); | 315 DCHECK(url.is_valid()); |
319 | 316 |
320 if (url.type() == fileapi::kFileSystemTypeDrive) { | 317 if (url.type() == fileapi::kFileSystemTypeDrive) { |
321 fileapi::RemoteFileSystemProxyInterface* remote_proxy = | 318 fileapi::RemoteFileSystemProxyInterface* remote_proxy = |
322 GetRemoteProxy(url.filesystem_id()); | 319 GetRemoteProxy(url.filesystem_id()); |
323 if (!remote_proxy) | 320 if (!remote_proxy) |
324 return scoped_ptr<fileapi::FileStreamWriter>(); | 321 return scoped_ptr<fileapi::FileStreamWriter>(); |
325 return scoped_ptr<fileapi::FileStreamWriter>( | 322 return scoped_ptr<fileapi::FileStreamWriter>( |
326 new fileapi::RemoteFileStreamWriter( | 323 new RemoteFileStreamWriter( |
327 remote_proxy, url, offset, | 324 remote_proxy, url, offset, |
328 context->task_runners()->file_task_runner())); | 325 context->task_runners()->file_task_runner())); |
329 } | 326 } |
330 | 327 |
331 if (url.type() == fileapi::kFileSystemTypeRestrictedNativeLocal) | 328 if (url.type() == fileapi::kFileSystemTypeRestrictedNativeLocal) |
332 return scoped_ptr<fileapi::FileStreamWriter>(); | 329 return scoped_ptr<fileapi::FileStreamWriter>(); |
333 | 330 |
334 DCHECK(url.type() == fileapi::kFileSystemTypeNativeLocal); | 331 DCHECK(url.type() == fileapi::kFileSystemTypeNativeLocal); |
335 return scoped_ptr<fileapi::FileStreamWriter>( | 332 return scoped_ptr<fileapi::FileStreamWriter>( |
336 new fileapi::LocalFileStreamWriter( | 333 new fileapi::LocalFileStreamWriter( |
(...skipping 26 matching lines...) Expand all Loading... |
363 std::string mount_name = url.filesystem_id(); | 360 std::string mount_name = url.filesystem_id(); |
364 if (!mount_points_->GetRegisteredPath(mount_name, &root_path) && | 361 if (!mount_points_->GetRegisteredPath(mount_name, &root_path) && |
365 !system_mount_points_->GetRegisteredPath(mount_name, &root_path)) { | 362 !system_mount_points_->GetRegisteredPath(mount_name, &root_path)) { |
366 return base::FilePath(); | 363 return base::FilePath(); |
367 } | 364 } |
368 | 365 |
369 return root_path.DirName(); | 366 return root_path.DirName(); |
370 } | 367 } |
371 | 368 |
372 } // namespace chromeos | 369 } // namespace chromeos |
OLD | NEW |