Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: chrome/browser/local_discovery/storage/privet_filesystem_backend.cc

Issue 120533006: Stub for Privet file system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 // TODO(noamsml): Any access controls
54
55 bool PrivetFileSystemBackend::IsAccessAllowed(
56 const fileapi::FileSystemURL& url) const {
57 // TODO(noamsml): Implement (http://crbug.com/332182)
58 return true;
59 }
60
61 void PrivetFileSystemBackend::GrantFullAccessToExtension(
62 const std::string& extension_id) {
63 // TODO(noamsml): Implement (http://crbug.com/332182)
64 }
65
66 void PrivetFileSystemBackend::GrantFileAccessToExtension(
67 const std::string& extension_id, const base::FilePath& virtual_path) {
68 // TODO(noamsml): Implement (http://crbug.com/332182)
69 }
70
71 void PrivetFileSystemBackend::RevokeAccessForExtension(
72 const std::string& extension_id) {
73 // TODO(noamsml): Implement (http://crbug.com/332182)
74 }
75
76 // Copied from file_system_backend.cc:193
77 std::vector<base::FilePath>
78 PrivetFileSystemBackend::GetRootDirectories() const {
79 std::vector<fileapi::MountPoints::MountPointInfo> mount_points;
80 mount_points_->AddMountPointInfosTo(&mount_points);
81
82 std::vector<base::FilePath> root_dirs;
83 for (size_t i = 0; i < mount_points.size(); ++i)
84 root_dirs.push_back(mount_points[i].path);
85 return root_dirs;
86 }
87
88 fileapi::AsyncFileUtil* PrivetFileSystemBackend::GetAsyncFileUtil(
89 fileapi::FileSystemType type) {
90 return async_util_.get();
91 }
92
93 fileapi::CopyOrMoveFileValidatorFactory*
94 PrivetFileSystemBackend::GetCopyOrMoveFileValidatorFactory(
95 fileapi::FileSystemType type, base::PlatformFileError* error_code) {
96 DCHECK(error_code);
97 *error_code = base::PLATFORM_FILE_OK;
98 return NULL;
99 }
100
101 fileapi::FileSystemOperation*
102 PrivetFileSystemBackend::CreateFileSystemOperation(
103 const fileapi::FileSystemURL& url,
104 fileapi::FileSystemContext* context,
105 base::PlatformFileError* error_code) const {
106 return fileapi::FileSystemOperation::Create(
107 url, context,
108 make_scoped_ptr(new fileapi::FileSystemOperationContext(context)));
109 }
110
111 scoped_ptr<webkit_blob::FileStreamReader>
112 PrivetFileSystemBackend::CreateFileStreamReader(
113 const fileapi::FileSystemURL& url,
114 int64 offset,
115 const base::Time& expected_modification_time,
116 fileapi::FileSystemContext* context) const {
117 return scoped_ptr<webkit_blob::FileStreamReader>();
118 }
119
120 scoped_ptr<fileapi::FileStreamWriter>
121 PrivetFileSystemBackend::CreateFileStreamWriter(
122 const fileapi::FileSystemURL& url,
123 int64 offset,
124 fileapi::FileSystemContext* context) const {
125 return scoped_ptr<fileapi::FileStreamWriter>();
126 }
127
128 bool PrivetFileSystemBackend::GetVirtualPath(
129 const base::FilePath& filesystem_path,
130 base::FilePath* virtual_path) {
131 return mount_points_->GetVirtualPath(filesystem_path, virtual_path);
132 }
133
134 } // namespace local_discovery
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698