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

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 // System mount pints
mtomasz 2014/01/09 01:07:04 nit: Coma after the comment.
kinuko 2014/01/09 04:27:41 You probably meant 'period' after comments? :) Al
Noam Samuel 2014/01/09 20:23:24 That comment doesn't really make a whole lot of se
82
83 std::vector<base::FilePath> root_dirs;
84 for (size_t i = 0; i < mount_points.size(); ++i)
85 root_dirs.push_back(mount_points[i].path);
86 return root_dirs;
87 }
88
89 fileapi::AsyncFileUtil* PrivetFileSystemBackend::GetAsyncFileUtil(
90 fileapi::FileSystemType type) {
91 return async_util_.get();
92 }
93
94 fileapi::CopyOrMoveFileValidatorFactory*
95 PrivetFileSystemBackend::GetCopyOrMoveFileValidatorFactory(
96 fileapi::FileSystemType type, base::PlatformFileError* error_code) {
97 DCHECK(error_code);
98 *error_code = base::PLATFORM_FILE_OK;
99 return NULL;
100 }
101
102 fileapi::FileSystemOperation*
103 PrivetFileSystemBackend::CreateFileSystemOperation(
104 const fileapi::FileSystemURL& url,
105 fileapi::FileSystemContext* context,
106 base::PlatformFileError* error_code) const {
107 return fileapi::FileSystemOperation::Create(
108 url, context,
109 make_scoped_ptr(new fileapi::FileSystemOperationContext(context)));
110 }
111
112 scoped_ptr<webkit_blob::FileStreamReader>
113 PrivetFileSystemBackend::CreateFileStreamReader(
114 const fileapi::FileSystemURL& url,
115 int64 offset,
116 const base::Time& expected_modification_time,
117 fileapi::FileSystemContext* context) const {
118 return scoped_ptr<webkit_blob::FileStreamReader>();
119 }
120
121
mtomasz 2014/01/09 01:07:04 nit: Remove the extra line.
Noam Samuel 2014/01/09 20:23:24 Done.
122 scoped_ptr<fileapi::FileStreamWriter>
123 PrivetFileSystemBackend::CreateFileStreamWriter(
124 const fileapi::FileSystemURL& url,
125 int64 offset,
126 fileapi::FileSystemContext* context) const {
127 return scoped_ptr<fileapi::FileStreamWriter>();
128 }
129
130 bool PrivetFileSystemBackend::GetVirtualPath(
131 const base::FilePath& filesystem_path,
132 base::FilePath* virtual_path) {
133 return mount_points_->GetVirtualPath(filesystem_path, virtual_path);
134 }
135
136 } // namespace local_discovery
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698