| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/chromeos/fileapi/file_system_backend.h" | 5 #include "chrome/browser/chromeos/fileapi/file_system_backend.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/message_loop.h" | 9 #include "base/message_loop/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" | 14 #include "chrome/browser/chromeos/fileapi/file_access_permissions.h" |
| 15 #include "chrome/browser/chromeos/fileapi/file_system_backend_delegate.h" | 15 #include "chrome/browser/chromeos/fileapi/file_system_backend_delegate.h" |
| 16 #include "chromeos/dbus/cros_disks_client.h" | 16 #include "chromeos/dbus/cros_disks_client.h" |
| 17 #include "webkit/browser/blob/file_stream_reader.h" | 17 #include "webkit/browser/blob/file_stream_reader.h" |
| 18 #include "webkit/browser/fileapi/async_file_util_adapter.h" | 18 #include "webkit/browser/fileapi/async_file_util_adapter.h" |
| 19 #include "webkit/browser/fileapi/external_mount_points.h" | 19 #include "webkit/browser/fileapi/external_mount_points.h" |
| 20 #include "webkit/browser/fileapi/file_system_context.h" | 20 #include "webkit/browser/fileapi/file_system_context.h" |
| 21 #include "webkit/browser/fileapi/file_system_file_stream_reader.h" | 21 #include "webkit/browser/fileapi/file_system_file_stream_reader.h" |
| 22 #include "webkit/browser/fileapi/file_system_operation_context.h" | 22 #include "webkit/browser/fileapi/file_system_operation_context.h" |
| 23 #include "webkit/browser/fileapi/file_system_operation_impl.h" |
| 23 #include "webkit/browser/fileapi/file_system_task_runners.h" | 24 #include "webkit/browser/fileapi/file_system_task_runners.h" |
| 24 #include "webkit/browser/fileapi/file_system_url.h" | 25 #include "webkit/browser/fileapi/file_system_url.h" |
| 25 #include "webkit/browser/fileapi/isolated_context.h" | 26 #include "webkit/browser/fileapi/isolated_context.h" |
| 26 #include "webkit/browser/fileapi/isolated_file_util.h" | 27 #include "webkit/browser/fileapi/isolated_file_util.h" |
| 27 #include "webkit/browser/fileapi/local_file_stream_writer.h" | 28 #include "webkit/browser/fileapi/local_file_stream_writer.h" |
| 28 #include "webkit/browser/fileapi/local_file_system_operation.h" | |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 const char kChromeUIScheme[] = "chrome"; | 32 const char kChromeUIScheme[] = "chrome"; |
| 33 | 33 |
| 34 } // namespace | 34 } // namespace |
| 35 | 35 |
| 36 namespace chromeos { | 36 namespace chromeos { |
| 37 | 37 |
| 38 // static | 38 // static |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 *error_code = base::PLATFORM_FILE_ERROR_SECURITY; | 243 *error_code = base::PLATFORM_FILE_ERROR_SECURITY; |
| 244 return NULL; | 244 return NULL; |
| 245 } | 245 } |
| 246 | 246 |
| 247 DCHECK(url.type() == fileapi::kFileSystemTypeNativeLocal || | 247 DCHECK(url.type() == fileapi::kFileSystemTypeNativeLocal || |
| 248 url.type() == fileapi::kFileSystemTypeRestrictedNativeLocal || | 248 url.type() == fileapi::kFileSystemTypeRestrictedNativeLocal || |
| 249 url.type() == fileapi::kFileSystemTypeDrive); | 249 url.type() == fileapi::kFileSystemTypeDrive); |
| 250 scoped_ptr<fileapi::FileSystemOperationContext> operation_context( | 250 scoped_ptr<fileapi::FileSystemOperationContext> operation_context( |
| 251 new fileapi::FileSystemOperationContext(context)); | 251 new fileapi::FileSystemOperationContext(context)); |
| 252 operation_context->set_root_path(GetFileSystemRootPath(url)); | 252 operation_context->set_root_path(GetFileSystemRootPath(url)); |
| 253 return new fileapi::LocalFileSystemOperation(url, context, | 253 return new fileapi::FileSystemOperationImpl(url, context, |
| 254 operation_context.Pass()); | 254 operation_context.Pass()); |
| 255 } | 255 } |
| 256 | 256 |
| 257 scoped_ptr<webkit_blob::FileStreamReader> | 257 scoped_ptr<webkit_blob::FileStreamReader> |
| 258 FileSystemBackend::CreateFileStreamReader( | 258 FileSystemBackend::CreateFileStreamReader( |
| 259 const fileapi::FileSystemURL& url, | 259 const fileapi::FileSystemURL& url, |
| 260 int64 offset, | 260 int64 offset, |
| 261 const base::Time& expected_modification_time, | 261 const base::Time& expected_modification_time, |
| 262 fileapi::FileSystemContext* context) const { | 262 fileapi::FileSystemContext* context) const { |
| 263 DCHECK(url.is_valid()); | 263 DCHECK(url.is_valid()); |
| 264 | 264 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 std::string mount_name = url.filesystem_id(); | 314 std::string mount_name = url.filesystem_id(); |
| 315 if (!mount_points_->GetRegisteredPath(mount_name, &root_path) && | 315 if (!mount_points_->GetRegisteredPath(mount_name, &root_path) && |
| 316 !system_mount_points_->GetRegisteredPath(mount_name, &root_path)) { | 316 !system_mount_points_->GetRegisteredPath(mount_name, &root_path)) { |
| 317 return base::FilePath(); | 317 return base::FilePath(); |
| 318 } | 318 } |
| 319 | 319 |
| 320 return root_path.DirName(); | 320 return root_path.DirName(); |
| 321 } | 321 } |
| 322 | 322 |
| 323 } // namespace chromeos | 323 } // namespace chromeos |
| OLD | NEW |