OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/local_discovery/storage/privet_filesystem_backend.h" |
| 6 |
| 7 #include <string> |
| 8 |
| 9 #include "chrome/browser/local_discovery/storage/privet_filesystem_async_util.h" |
| 10 #include "chrome/browser/local_discovery/storage/privet_filesystem_constants.h" |
| 11 #include "webkit/browser/fileapi/file_system_operation.h" |
| 12 |
| 13 namespace local_discovery { |
| 14 |
| 15 PrivetFileSystemBackend::PrivetFileSystemBackend( |
| 16 fileapi::ExternalMountPoints* mount_points) |
| 17 : mount_points_(mount_points), |
| 18 async_util_(new PrivetFileSystemAsyncUtil()) { |
| 19 } |
| 20 |
| 21 PrivetFileSystemBackend::~PrivetFileSystemBackend() { |
| 22 } |
| 23 |
| 24 bool PrivetFileSystemBackend::CanHandleType( |
| 25 fileapi::FileSystemType type) const { |
| 26 return (type == fileapi::kFileSystemTypeCloudDevice); |
| 27 } |
| 28 |
| 29 void PrivetFileSystemBackend::Initialize(fileapi::FileSystemContext* context) { |
| 30 mount_points_->RegisterFileSystem( |
| 31 "privet", |
| 32 fileapi::kFileSystemTypeCloudDevice, |
| 33 fileapi::FileSystemMountOption(), |
| 34 base::FilePath(kPrivetFilePath)); |
| 35 } |
| 36 |
| 37 void PrivetFileSystemBackend::OpenFileSystem( |
| 38 const GURL& origin_url, |
| 39 fileapi::FileSystemType type, |
| 40 fileapi::OpenFileSystemMode mode, |
| 41 const OpenFileSystemCallback& callback) { |
| 42 // Copied from src/chrome/browser/chromeos/fileapi/file_system_backend.cc |
| 43 // This is deprecated for non-sandboxed filesystems. |
| 44 NOTREACHED(); |
| 45 callback.Run(GURL(), std::string(), base::PLATFORM_FILE_ERROR_SECURITY); |
| 46 } |
| 47 |
| 48 fileapi::FileSystemQuotaUtil* PrivetFileSystemBackend::GetQuotaUtil() { |
| 49 // No quota support. |
| 50 return NULL; |
| 51 } |
| 52 |
| 53 fileapi::AsyncFileUtil* PrivetFileSystemBackend::GetAsyncFileUtil( |
| 54 fileapi::FileSystemType type) { |
| 55 return async_util_.get(); |
| 56 } |
| 57 |
| 58 fileapi::CopyOrMoveFileValidatorFactory* |
| 59 PrivetFileSystemBackend::GetCopyOrMoveFileValidatorFactory( |
| 60 fileapi::FileSystemType type, base::PlatformFileError* error_code) { |
| 61 DCHECK(error_code); |
| 62 *error_code = base::PLATFORM_FILE_OK; |
| 63 return NULL; |
| 64 } |
| 65 |
| 66 fileapi::FileSystemOperation* |
| 67 PrivetFileSystemBackend::CreateFileSystemOperation( |
| 68 const fileapi::FileSystemURL& url, |
| 69 fileapi::FileSystemContext* context, |
| 70 base::PlatformFileError* error_code) const { |
| 71 return fileapi::FileSystemOperation::Create( |
| 72 url, context, |
| 73 make_scoped_ptr(new fileapi::FileSystemOperationContext(context))); |
| 74 } |
| 75 |
| 76 scoped_ptr<webkit_blob::FileStreamReader> |
| 77 PrivetFileSystemBackend::CreateFileStreamReader( |
| 78 const fileapi::FileSystemURL& url, |
| 79 int64 offset, |
| 80 const base::Time& expected_modification_time, |
| 81 fileapi::FileSystemContext* context) const { |
| 82 return scoped_ptr<webkit_blob::FileStreamReader>(); |
| 83 } |
| 84 |
| 85 scoped_ptr<fileapi::FileStreamWriter> |
| 86 PrivetFileSystemBackend::CreateFileStreamWriter( |
| 87 const fileapi::FileSystemURL& url, |
| 88 int64 offset, |
| 89 fileapi::FileSystemContext* context) const { |
| 90 return scoped_ptr<fileapi::FileStreamWriter>(); |
| 91 } |
| 92 |
| 93 } // namespace local_discovery |
OLD | NEW |