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

Side by Side Diff: webkit/fileapi/test_mount_point_provider.cc

Issue 14352004: Split Media-related code from IsolatedMountPointProvider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 8 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
« no previous file with comments | « webkit/fileapi/test_mount_point_provider.h ('k') | webkit/fileapi/webkit_fileapi.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "webkit/fileapi/test_mount_point_provider.h" 5 #include "webkit/fileapi/test_mount_point_provider.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 private: 65 private:
66 int64 usage_; 66 int64 usage_;
67 }; 67 };
68 68
69 TestMountPointProvider::TestMountPointProvider( 69 TestMountPointProvider::TestMountPointProvider(
70 base::SequencedTaskRunner* task_runner, 70 base::SequencedTaskRunner* task_runner,
71 const base::FilePath& base_path) 71 const base::FilePath& base_path)
72 : base_path_(base_path), 72 : base_path_(base_path),
73 task_runner_(task_runner), 73 task_runner_(task_runner),
74 local_file_util_(new AsyncFileUtilAdapter(new LocalFileUtil())), 74 local_file_util_(new AsyncFileUtilAdapter(new LocalFileUtil())),
75 quota_util_(new QuotaUtil) { 75 quota_util_(new QuotaUtil),
76 require_copy_or_move_validator_(false) {
76 UpdateObserverList::Source source; 77 UpdateObserverList::Source source;
77 source.AddObserver(quota_util_.get(), task_runner_); 78 source.AddObserver(quota_util_.get(), task_runner_);
78 observers_ = UpdateObserverList(source); 79 observers_ = UpdateObserverList(source);
79 } 80 }
80 81
81 TestMountPointProvider::~TestMountPointProvider() { 82 TestMountPointProvider::~TestMountPointProvider() {
82 } 83 }
83 84
84 bool TestMountPointProvider::CanHandleType(FileSystemType type) const { 85 bool TestMountPointProvider::CanHandleType(FileSystemType type) const {
85 return (type == kFileSystemTypeTest); 86 return (type == kFileSystemTypeTest);
(...skipping 28 matching lines...) Expand all
114 115
115 AsyncFileUtil* TestMountPointProvider::GetAsyncFileUtil(FileSystemType type) { 116 AsyncFileUtil* TestMountPointProvider::GetAsyncFileUtil(FileSystemType type) {
116 return local_file_util_.get(); 117 return local_file_util_.get();
117 } 118 }
118 119
119 CopyOrMoveFileValidatorFactory* 120 CopyOrMoveFileValidatorFactory*
120 TestMountPointProvider::GetCopyOrMoveFileValidatorFactory( 121 TestMountPointProvider::GetCopyOrMoveFileValidatorFactory(
121 FileSystemType type, base::PlatformFileError* error_code) { 122 FileSystemType type, base::PlatformFileError* error_code) {
122 DCHECK(error_code); 123 DCHECK(error_code);
123 *error_code = base::PLATFORM_FILE_OK; 124 *error_code = base::PLATFORM_FILE_OK;
125 if (require_copy_or_move_validator_) {
126 if (!copy_or_move_file_validator_factory_)
127 *error_code = base::PLATFORM_FILE_ERROR_SECURITY;
128 return copy_or_move_file_validator_factory_.get();
129 }
124 return NULL; 130 return NULL;
125 } 131 }
126 132
127 void TestMountPointProvider::InitializeCopyOrMoveFileValidatorFactory( 133 void TestMountPointProvider::InitializeCopyOrMoveFileValidatorFactory(
128 FileSystemType type, scoped_ptr<CopyOrMoveFileValidatorFactory> factory) { 134 FileSystemType type, scoped_ptr<CopyOrMoveFileValidatorFactory> factory) {
129 DCHECK(!factory); 135 if (!require_copy_or_move_validator_) {
136 DCHECK(!factory);
137 return;
138 }
139 if (!copy_or_move_file_validator_factory_)
140 copy_or_move_file_validator_factory_ = factory.Pass();
130 } 141 }
131 142
132 FilePermissionPolicy TestMountPointProvider::GetPermissionPolicy( 143 FilePermissionPolicy TestMountPointProvider::GetPermissionPolicy(
133 const FileSystemURL& url, int permissions) const { 144 const FileSystemURL& url, int permissions) const {
134 return FILE_PERMISSION_ALWAYS_DENY; 145 return FILE_PERMISSION_ALWAYS_DENY;
135 } 146 }
136 147
137 FileSystemOperation* TestMountPointProvider::CreateFileSystemOperation( 148 FileSystemOperation* TestMountPointProvider::CreateFileSystemOperation(
138 const FileSystemURL& url, 149 const FileSystemURL& url,
139 FileSystemContext* context, 150 FileSystemContext* context,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 NOTREACHED(); 189 NOTREACHED();
179 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); 190 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
180 } 191 }
181 192
182 const UpdateObserverList* TestMountPointProvider::GetUpdateObservers( 193 const UpdateObserverList* TestMountPointProvider::GetUpdateObservers(
183 FileSystemType type) const { 194 FileSystemType type) const {
184 return &observers_; 195 return &observers_;
185 } 196 }
186 197
187 } // namespace fileapi 198 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/test_mount_point_provider.h ('k') | webkit/fileapi/webkit_fileapi.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698