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

Side by Side Diff: webkit/tools/test_shell/simple_file_system.cc

Issue 13891009: FileSystem mods: Remove some dead snapshot creation code. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: 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/tools/test_shell/simple_file_system.h ('k') | no next file » | 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/tools/test_shell/simple_file_system.h" 5 #include "webkit/tools/test_shell/simple_file_system.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 WebFileSystemCallbacks* callbacks) { 247 WebFileSystemCallbacks* callbacks) {
248 FileSystemURL url(file_system_context()->CrackURL(path)); 248 FileSystemURL url(file_system_context()->CrackURL(path));
249 if (!HasFilePermission(url, fileapi::kReadFilePermissions)) { 249 if (!HasFilePermission(url, fileapi::kReadFilePermissions)) {
250 callbacks->didFail(WebKit::WebFileErrorSecurity); 250 callbacks->didFail(WebKit::WebFileErrorSecurity);
251 return; 251 return;
252 } 252 }
253 GetNewOperation(url)->CreateSnapshotFile( 253 GetNewOperation(url)->CreateSnapshotFile(
254 url, SnapshotFileHandler(callbacks)); 254 url, SnapshotFileHandler(callbacks));
255 } 255 }
256 256
257 // DEPRECATED
258 void SimpleFileSystem::createSnapshotFileAndReadMetadata(
259 const WebURL& blobURL,
260 const WebURL& path,
261 WebFileSystemCallbacks* callbacks) {
262 FileSystemURL url(file_system_context()->CrackURL(path));
263 if (!HasFilePermission(url, fileapi::kReadFilePermissions)) {
264 callbacks->didFail(WebKit::WebFileErrorSecurity);
265 return;
266 }
267 GetNewOperation(url)->CreateSnapshotFile(
268 url, SnapshotFileHandler_Deprecated(blobURL, callbacks));
269 }
270
271 // static 257 // static
272 void SimpleFileSystem::InitializeOnIOThread( 258 void SimpleFileSystem::InitializeOnIOThread(
273 webkit_blob::BlobStorageController* blob_storage_controller) { 259 webkit_blob::BlobStorageController* blob_storage_controller) {
274 g_io_thread = MessageLoop::current(); 260 g_io_thread = MessageLoop::current();
275 g_blob_storage_controller = blob_storage_controller; 261 g_blob_storage_controller = blob_storage_controller;
276 } 262 }
277 263
278 // static 264 // static
279 void SimpleFileSystem::CleanupOnIOThread() { 265 void SimpleFileSystem::CleanupOnIOThread() {
280 g_io_thread = NULL; 266 g_io_thread = NULL;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 AsWeakPtr(), callbacks); 315 AsWeakPtr(), callbacks);
330 } 316 }
331 317
332 FileSystemOperation::SnapshotFileCallback 318 FileSystemOperation::SnapshotFileCallback
333 SimpleFileSystem::SnapshotFileHandler( 319 SimpleFileSystem::SnapshotFileHandler(
334 WebFileSystemCallbacks* callbacks) { 320 WebFileSystemCallbacks* callbacks) {
335 return base::Bind(&SimpleFileSystem::DidCreateSnapshotFile, 321 return base::Bind(&SimpleFileSystem::DidCreateSnapshotFile,
336 AsWeakPtr(), base::Unretained(callbacks)); 322 AsWeakPtr(), base::Unretained(callbacks));
337 } 323 }
338 324
339 FileSystemOperation::SnapshotFileCallback
340 SimpleFileSystem::SnapshotFileHandler_Deprecated(
341 const GURL& blob_url,
342 WebFileSystemCallbacks* callbacks) {
343 return base::Bind(&SimpleFileSystem::DidCreateSnapshotFile_Deprecated,
344 AsWeakPtr(), blob_url, base::Unretained(callbacks));
345 }
346
347 void SimpleFileSystem::DidFinish(WebFileSystemCallbacks* callbacks, 325 void SimpleFileSystem::DidFinish(WebFileSystemCallbacks* callbacks,
348 base::PlatformFileError result) { 326 base::PlatformFileError result) {
349 if (result == base::PLATFORM_FILE_OK) 327 if (result == base::PLATFORM_FILE_OK)
350 callbacks->didSucceed(); 328 callbacks->didSucceed();
351 else 329 else
352 callbacks->didFail(fileapi::PlatformFileErrorToWebFileError(result)); 330 callbacks->didFail(fileapi::PlatformFileErrorToWebFileError(result));
353 } 331 }
354 332
355 void SimpleFileSystem::DidGetMetadata(WebFileSystemCallbacks* callbacks, 333 void SimpleFileSystem::DidGetMetadata(WebFileSystemCallbacks* callbacks,
356 base::PlatformFileError result, 334 base::PlatformFileError result,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 web_file_info.modificationTime = info.last_modified.ToDoubleT(); 404 web_file_info.modificationTime = info.last_modified.ToDoubleT();
427 web_file_info.type = info.is_directory ? 405 web_file_info.type = info.is_directory ?
428 WebFileInfo::TypeDirectory : WebFileInfo::TypeFile; 406 WebFileInfo::TypeDirectory : WebFileInfo::TypeFile;
429 web_file_info.platformPath = 407 web_file_info.platformPath =
430 webkit_base::FilePathToWebString(platform_path); 408 webkit_base::FilePathToWebString(platform_path);
431 callbacks->didCreateSnapshotFile(web_file_info); 409 callbacks->didCreateSnapshotFile(web_file_info);
432 } else { 410 } else {
433 callbacks->didFail(fileapi::PlatformFileErrorToWebFileError(result)); 411 callbacks->didFail(fileapi::PlatformFileErrorToWebFileError(result));
434 } 412 }
435 } 413 }
436
437 void SimpleFileSystem::DidCreateSnapshotFile_Deprecated(
438 const GURL& blob_url,
439 WebFileSystemCallbacks* callbacks,
440 base::PlatformFileError result,
441 const base::PlatformFileInfo& info,
442 const base::FilePath& platform_path,
443 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) {
444 DCHECK(g_io_thread);
445 if (result == base::PLATFORM_FILE_OK) {
446 g_io_thread->PostTask(
447 FROM_HERE,
448 base::Bind(&RegisterBlob, blob_url, platform_path));
449 }
450 DidGetMetadata(callbacks, result, info, platform_path);
451 }
OLDNEW
« no previous file with comments | « webkit/tools/test_shell/simple_file_system.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698