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

Side by Side Diff: webkit/browser/fileapi/plugin_private_file_system_backend.cc

Issue 101393006: FileAPI: Rename *OnFileThread to *OnFileTaskRunner (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser/fileapi/plugin_private_file_system_backend.h" 5 #include "webkit/browser/fileapi/plugin_private_file_system_backend.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 Map map_; 59 Map map_;
60 }; 60 };
61 61
62 namespace { 62 namespace {
63 63
64 const base::FilePath::CharType* kFileSystemDirectory = 64 const base::FilePath::CharType* kFileSystemDirectory =
65 SandboxFileSystemBackendDelegate::kFileSystemDirectory; 65 SandboxFileSystemBackendDelegate::kFileSystemDirectory;
66 const base::FilePath::CharType* kPluginPrivateDirectory = 66 const base::FilePath::CharType* kPluginPrivateDirectory =
67 FILE_PATH_LITERAL("Plugins"); 67 FILE_PATH_LITERAL("Plugins");
68 68
69 base::PlatformFileError OpenFileSystemOnFileThread( 69 base::PlatformFileError OpenFileSystemOnFileTaskRunner(
70 ObfuscatedFileUtil* file_util, 70 ObfuscatedFileUtil* file_util,
71 PluginPrivateFileSystemBackend::FileSystemIDToPluginMap* plugin_map, 71 PluginPrivateFileSystemBackend::FileSystemIDToPluginMap* plugin_map,
72 const GURL& origin_url, 72 const GURL& origin_url,
73 const std::string& filesystem_id, 73 const std::string& filesystem_id,
74 const std::string& plugin_id, 74 const std::string& plugin_id,
75 OpenFileSystemMode mode) { 75 OpenFileSystemMode mode) {
76 base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED; 76 base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
77 const bool create = (mode == OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT); 77 const bool create = (mode == OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT);
78 file_util->GetDirectoryForOriginAndType( 78 file_util->GetDirectoryForOriginAndType(
79 origin_url, plugin_id, create, &error); 79 origin_url, plugin_id, create, &error);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 const StatusCallback& callback) { 123 const StatusCallback& callback) {
124 if (!CanHandleType(type) || file_system_options_.is_incognito()) { 124 if (!CanHandleType(type) || file_system_options_.is_incognito()) {
125 base::MessageLoopProxy::current()->PostTask( 125 base::MessageLoopProxy::current()->PostTask(
126 FROM_HERE, base::Bind(callback, base::PLATFORM_FILE_ERROR_SECURITY)); 126 FROM_HERE, base::Bind(callback, base::PLATFORM_FILE_ERROR_SECURITY));
127 return; 127 return;
128 } 128 }
129 129
130 PostTaskAndReplyWithResult( 130 PostTaskAndReplyWithResult(
131 file_task_runner_.get(), 131 file_task_runner_.get(),
132 FROM_HERE, 132 FROM_HERE,
133 base::Bind(&OpenFileSystemOnFileThread, 133 base::Bind(&OpenFileSystemOnFileTaskRunner,
134 obfuscated_file_util(), plugin_map_, 134 obfuscated_file_util(), plugin_map_,
135 origin_url, filesystem_id, plugin_id, mode), 135 origin_url, filesystem_id, plugin_id, mode),
136 callback); 136 callback);
137 } 137 }
138 138
139 bool PluginPrivateFileSystemBackend::CanHandleType(FileSystemType type) const { 139 bool PluginPrivateFileSystemBackend::CanHandleType(FileSystemType type) const {
140 return type == kFileSystemTypePluginPrivate; 140 return type == kFileSystemTypePluginPrivate;
141 } 141 }
142 142
143 void PluginPrivateFileSystemBackend::Initialize(FileSystemContext* context) { 143 void PluginPrivateFileSystemBackend::Initialize(FileSystemContext* context) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 int64 offset, 194 int64 offset,
195 FileSystemContext* context) const { 195 FileSystemContext* context) const {
196 return scoped_ptr<FileStreamWriter>(); 196 return scoped_ptr<FileStreamWriter>();
197 } 197 }
198 198
199 FileSystemQuotaUtil* PluginPrivateFileSystemBackend::GetQuotaUtil() { 199 FileSystemQuotaUtil* PluginPrivateFileSystemBackend::GetQuotaUtil() {
200 return this; 200 return this;
201 } 201 }
202 202
203 base::PlatformFileError 203 base::PlatformFileError
204 PluginPrivateFileSystemBackend::DeleteOriginDataOnFileThread( 204 PluginPrivateFileSystemBackend::DeleteOriginDataOnFileTaskRunner(
205 FileSystemContext* context, 205 FileSystemContext* context,
206 quota::QuotaManagerProxy* proxy, 206 quota::QuotaManagerProxy* proxy,
207 const GURL& origin_url, 207 const GURL& origin_url,
208 FileSystemType type) { 208 FileSystemType type) {
209 if (!CanHandleType(type)) 209 if (!CanHandleType(type))
210 return base::PLATFORM_FILE_ERROR_SECURITY; 210 return base::PLATFORM_FILE_ERROR_SECURITY;
211 bool result = obfuscated_file_util()->DeleteDirectoryForOriginAndType( 211 bool result = obfuscated_file_util()->DeleteDirectoryForOriginAndType(
212 origin_url, std::string()); 212 origin_url, std::string());
213 if (result) 213 if (result)
214 return base::PLATFORM_FILE_OK; 214 return base::PLATFORM_FILE_OK;
215 return base::PLATFORM_FILE_ERROR_FAILED; 215 return base::PLATFORM_FILE_ERROR_FAILED;
216 } 216 }
217 217
218 void PluginPrivateFileSystemBackend::GetOriginsForTypeOnFileThread( 218 void PluginPrivateFileSystemBackend::GetOriginsForTypeOnFileTaskRunner(
219 FileSystemType type, 219 FileSystemType type,
220 std::set<GURL>* origins) { 220 std::set<GURL>* origins) {
221 if (!CanHandleType(type)) 221 if (!CanHandleType(type))
222 return; 222 return;
223 scoped_ptr<ObfuscatedFileUtil::AbstractOriginEnumerator> enumerator( 223 scoped_ptr<ObfuscatedFileUtil::AbstractOriginEnumerator> enumerator(
224 obfuscated_file_util()->CreateOriginEnumerator()); 224 obfuscated_file_util()->CreateOriginEnumerator());
225 GURL origin; 225 GURL origin;
226 while (!(origin = enumerator->Next()).is_empty()) 226 while (!(origin = enumerator->Next()).is_empty())
227 origins->insert(origin); 227 origins->insert(origin);
228 } 228 }
229 229
230 void PluginPrivateFileSystemBackend::GetOriginsForHostOnFileThread( 230 void PluginPrivateFileSystemBackend::GetOriginsForHostOnFileTaskRunner(
231 FileSystemType type, 231 FileSystemType type,
232 const std::string& host, 232 const std::string& host,
233 std::set<GURL>* origins) { 233 std::set<GURL>* origins) {
234 if (!CanHandleType(type)) 234 if (!CanHandleType(type))
235 return; 235 return;
236 scoped_ptr<ObfuscatedFileUtil::AbstractOriginEnumerator> enumerator( 236 scoped_ptr<ObfuscatedFileUtil::AbstractOriginEnumerator> enumerator(
237 obfuscated_file_util()->CreateOriginEnumerator()); 237 obfuscated_file_util()->CreateOriginEnumerator());
238 GURL origin; 238 GURL origin;
239 while (!(origin = enumerator->Next()).is_empty()) { 239 while (!(origin = enumerator->Next()).is_empty()) {
240 if (host == net::GetHostOrSpecFromURL(origin)) 240 if (host == net::GetHostOrSpecFromURL(origin))
241 origins->insert(origin); 241 origins->insert(origin);
242 } 242 }
243 } 243 }
244 244
245 int64 PluginPrivateFileSystemBackend::GetOriginUsageOnFileThread( 245 int64 PluginPrivateFileSystemBackend::GetOriginUsageOnFileTaskRunner(
246 FileSystemContext* context, 246 FileSystemContext* context,
247 const GURL& origin_url, 247 const GURL& origin_url,
248 FileSystemType type) { 248 FileSystemType type) {
249 // We don't track usage on this filesystem. 249 // We don't track usage on this filesystem.
250 return 0; 250 return 0;
251 } 251 }
252 252
253 scoped_refptr<QuotaReservation> 253 scoped_refptr<QuotaReservation>
254 PluginPrivateFileSystemBackend::CreateQuotaReservationOnFileTaskRunner( 254 PluginPrivateFileSystemBackend::CreateQuotaReservationOnFileTaskRunner(
255 const GURL& origin_url, 255 const GURL& origin_url,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 FileSystemType type) const { 288 FileSystemType type) const {
289 return NULL; 289 return NULL;
290 } 290 }
291 291
292 ObfuscatedFileUtil* PluginPrivateFileSystemBackend::obfuscated_file_util() { 292 ObfuscatedFileUtil* PluginPrivateFileSystemBackend::obfuscated_file_util() {
293 return static_cast<ObfuscatedFileUtil*>( 293 return static_cast<ObfuscatedFileUtil*>(
294 static_cast<AsyncFileUtilAdapter*>(file_util_.get())->sync_file_util()); 294 static_cast<AsyncFileUtilAdapter*>(file_util_.get())->sync_file_util());
295 } 295 }
296 296
297 } // namespace fileapi 297 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698