OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/local_discovery/storage/privet_filesystem_backend.h" | 5 #include "chrome/browser/local_discovery/storage/privet_filesystem_backend.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "chrome/browser/local_discovery/storage/privet_filesystem_async_util.h" | 9 #include "chrome/browser/local_discovery/storage/privet_filesystem_async_util.h" |
10 #include "chrome/browser/local_discovery/storage/privet_filesystem_constants.h" | 10 #include "chrome/browser/local_discovery/storage/privet_filesystem_constants.h" |
11 #include "webkit/browser/fileapi/file_system_operation.h" | 11 #include "storage/browser/fileapi/file_system_operation.h" |
12 #include "webkit/browser/fileapi/file_system_url.h" | 12 #include "storage/browser/fileapi/file_system_url.h" |
13 | 13 |
14 namespace local_discovery { | 14 namespace local_discovery { |
15 | 15 |
16 PrivetFileSystemBackend::PrivetFileSystemBackend( | 16 PrivetFileSystemBackend::PrivetFileSystemBackend( |
17 fileapi::ExternalMountPoints* mount_points, | 17 storage::ExternalMountPoints* mount_points, |
18 content::BrowserContext* browser_context) | 18 content::BrowserContext* browser_context) |
19 : mount_points_(mount_points), | 19 : mount_points_(mount_points), |
20 async_util_(new PrivetFileSystemAsyncUtil(browser_context)) { | 20 async_util_(new PrivetFileSystemAsyncUtil(browser_context)) { |
21 } | 21 } |
22 | 22 |
23 PrivetFileSystemBackend::~PrivetFileSystemBackend() { | 23 PrivetFileSystemBackend::~PrivetFileSystemBackend() { |
24 } | 24 } |
25 | 25 |
26 bool PrivetFileSystemBackend::CanHandleType( | 26 bool PrivetFileSystemBackend::CanHandleType( |
27 fileapi::FileSystemType type) const { | 27 storage::FileSystemType type) const { |
28 return (type == fileapi::kFileSystemTypeCloudDevice); | 28 return (type == storage::kFileSystemTypeCloudDevice); |
29 } | 29 } |
30 | 30 |
31 void PrivetFileSystemBackend::Initialize(fileapi::FileSystemContext* context) { | 31 void PrivetFileSystemBackend::Initialize(storage::FileSystemContext* context) { |
32 mount_points_->RegisterFileSystem( | 32 mount_points_->RegisterFileSystem("privet", |
33 "privet", | 33 storage::kFileSystemTypeCloudDevice, |
34 fileapi::kFileSystemTypeCloudDevice, | 34 storage::FileSystemMountOption(), |
35 fileapi::FileSystemMountOption(), | 35 base::FilePath(kPrivetFilePath)); |
36 base::FilePath(kPrivetFilePath)); | |
37 } | 36 } |
38 | 37 |
39 void PrivetFileSystemBackend::ResolveURL( | 38 void PrivetFileSystemBackend::ResolveURL( |
40 const fileapi::FileSystemURL& url, | 39 const storage::FileSystemURL& url, |
41 fileapi::OpenFileSystemMode mode, | 40 storage::OpenFileSystemMode mode, |
42 const OpenFileSystemCallback& callback) { | 41 const OpenFileSystemCallback& callback) { |
43 // TODO(noamsml): Provide a proper root url and a proper name. | 42 // TODO(noamsml): Provide a proper root url and a proper name. |
44 GURL root_url = GURL( | 43 GURL root_url = GURL( |
45 fileapi::GetExternalFileSystemRootURIString(url.origin(), std::string())); | 44 storage::GetExternalFileSystemRootURIString(url.origin(), std::string())); |
46 callback.Run(root_url, std::string(), base::File::FILE_OK); | 45 callback.Run(root_url, std::string(), base::File::FILE_OK); |
47 } | 46 } |
48 | 47 |
49 fileapi::FileSystemQuotaUtil* PrivetFileSystemBackend::GetQuotaUtil() { | 48 storage::FileSystemQuotaUtil* PrivetFileSystemBackend::GetQuotaUtil() { |
50 // No quota support. | 49 // No quota support. |
51 return NULL; | 50 return NULL; |
52 } | 51 } |
53 | 52 |
54 fileapi::AsyncFileUtil* PrivetFileSystemBackend::GetAsyncFileUtil( | 53 storage::AsyncFileUtil* PrivetFileSystemBackend::GetAsyncFileUtil( |
55 fileapi::FileSystemType type) { | 54 storage::FileSystemType type) { |
56 return async_util_.get(); | 55 return async_util_.get(); |
57 } | 56 } |
58 | 57 |
59 fileapi::CopyOrMoveFileValidatorFactory* | 58 storage::CopyOrMoveFileValidatorFactory* |
60 PrivetFileSystemBackend::GetCopyOrMoveFileValidatorFactory( | 59 PrivetFileSystemBackend::GetCopyOrMoveFileValidatorFactory( |
61 fileapi::FileSystemType type, base::File::Error* error_code) { | 60 storage::FileSystemType type, |
| 61 base::File::Error* error_code) { |
62 DCHECK(error_code); | 62 DCHECK(error_code); |
63 *error_code = base::File::FILE_OK; | 63 *error_code = base::File::FILE_OK; |
64 return NULL; | 64 return NULL; |
65 } | 65 } |
66 | 66 |
67 fileapi::FileSystemOperation* | 67 storage::FileSystemOperation* |
68 PrivetFileSystemBackend::CreateFileSystemOperation( | 68 PrivetFileSystemBackend::CreateFileSystemOperation( |
69 const fileapi::FileSystemURL& url, | 69 const storage::FileSystemURL& url, |
70 fileapi::FileSystemContext* context, | 70 storage::FileSystemContext* context, |
71 base::File::Error* error_code) const { | 71 base::File::Error* error_code) const { |
72 return fileapi::FileSystemOperation::Create( | 72 return storage::FileSystemOperation::Create( |
73 url, context, | 73 url, |
74 make_scoped_ptr(new fileapi::FileSystemOperationContext(context))); | 74 context, |
| 75 make_scoped_ptr(new storage::FileSystemOperationContext(context))); |
75 } | 76 } |
76 | 77 |
77 bool PrivetFileSystemBackend::SupportsStreaming( | 78 bool PrivetFileSystemBackend::SupportsStreaming( |
78 const fileapi::FileSystemURL& url) const { | 79 const storage::FileSystemURL& url) const { |
79 return false; | 80 return false; |
80 } | 81 } |
81 | 82 |
82 scoped_ptr<webkit_blob::FileStreamReader> | 83 scoped_ptr<storage::FileStreamReader> |
83 PrivetFileSystemBackend::CreateFileStreamReader( | 84 PrivetFileSystemBackend::CreateFileStreamReader( |
84 const fileapi::FileSystemURL& url, | 85 const storage::FileSystemURL& url, |
85 int64 offset, | 86 int64 offset, |
86 const base::Time& expected_modification_time, | 87 const base::Time& expected_modification_time, |
87 fileapi::FileSystemContext* context) const { | 88 storage::FileSystemContext* context) const { |
88 return scoped_ptr<webkit_blob::FileStreamReader>(); | 89 return scoped_ptr<storage::FileStreamReader>(); |
89 } | 90 } |
90 | 91 |
91 scoped_ptr<fileapi::FileStreamWriter> | 92 scoped_ptr<storage::FileStreamWriter> |
92 PrivetFileSystemBackend::CreateFileStreamWriter( | 93 PrivetFileSystemBackend::CreateFileStreamWriter( |
93 const fileapi::FileSystemURL& url, | 94 const storage::FileSystemURL& url, |
94 int64 offset, | 95 int64 offset, |
95 fileapi::FileSystemContext* context) const { | 96 storage::FileSystemContext* context) const { |
96 return scoped_ptr<fileapi::FileStreamWriter>(); | 97 return scoped_ptr<storage::FileStreamWriter>(); |
97 } | 98 } |
98 | 99 |
99 } // namespace local_discovery | 100 } // namespace local_discovery |
OLD | NEW |