| OLD | NEW |
| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 WebFrame* frame, | 92 WebFrame* frame, |
| 93 WebKit::WebFileSystemType type, | 93 WebKit::WebFileSystemType type, |
| 94 long long, bool create, | 94 long long, bool create, |
| 95 WebFileSystemCallbacks* callbacks) { | 95 WebFileSystemCallbacks* callbacks) { |
| 96 if (!frame || !file_system_context_) { | 96 if (!frame || !file_system_context_) { |
| 97 // The FileSystem temp directory was not initialized successfully. | 97 // The FileSystem temp directory was not initialized successfully. |
| 98 callbacks->didFail(WebKit::WebFileErrorSecurity); | 98 callbacks->didFail(WebKit::WebFileErrorSecurity); |
| 99 return; | 99 return; |
| 100 } | 100 } |
| 101 | 101 |
| 102 fileapi::OpenFileSystemMode mode = |
| 103 create ? fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT |
| 104 : fileapi::OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT; |
| 102 GURL origin_url(frame->document().securityOrigin().toString()); | 105 GURL origin_url(frame->document().securityOrigin().toString()); |
| 103 file_system_context_->OpenFileSystem( | 106 file_system_context_->OpenFileSystem( |
| 104 origin_url, static_cast<fileapi::FileSystemType>(type), create, | 107 origin_url, static_cast<fileapi::FileSystemType>(type), mode, |
| 105 OpenFileSystemHandler(callbacks)); | 108 OpenFileSystemHandler(callbacks)); |
| 106 } | 109 } |
| 107 | 110 |
| 108 void SimpleFileSystem::DeleteFileSystem( | 111 void SimpleFileSystem::DeleteFileSystem( |
| 109 WebFrame* frame, | 112 WebFrame* frame, |
| 110 WebKit::WebFileSystemType type, | 113 WebKit::WebFileSystemType type, |
| 111 WebFileSystemCallbacks* callbacks) { | 114 WebFileSystemCallbacks* callbacks) { |
| 112 if (!frame || !file_system_context_) { | 115 if (!frame || !file_system_context_) { |
| 113 callbacks->didFail(WebKit::WebFileErrorSecurity); | 116 callbacks->didFail(WebKit::WebFileErrorSecurity); |
| 114 return; | 117 return; |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 web_file_info.modificationTime = info.last_modified.ToDoubleT(); | 401 web_file_info.modificationTime = info.last_modified.ToDoubleT(); |
| 399 web_file_info.type = info.is_directory ? | 402 web_file_info.type = info.is_directory ? |
| 400 WebFileInfo::TypeDirectory : WebFileInfo::TypeFile; | 403 WebFileInfo::TypeDirectory : WebFileInfo::TypeFile; |
| 401 web_file_info.platformPath = | 404 web_file_info.platformPath = |
| 402 webkit_base::FilePathToWebString(platform_path); | 405 webkit_base::FilePathToWebString(platform_path); |
| 403 callbacks->didCreateSnapshotFile(web_file_info); | 406 callbacks->didCreateSnapshotFile(web_file_info); |
| 404 } else { | 407 } else { |
| 405 callbacks->didFail(fileapi::PlatformFileErrorToWebFileError(result)); | 408 callbacks->didFail(fileapi::PlatformFileErrorToWebFileError(result)); |
| 406 } | 409 } |
| 407 } | 410 } |
| OLD | NEW |