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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 } | 86 } |
87 | 87 |
88 SimpleFileSystem::~SimpleFileSystem() { | 88 SimpleFileSystem::~SimpleFileSystem() { |
89 } | 89 } |
90 | 90 |
91 void SimpleFileSystem::OpenFileSystem( | 91 void SimpleFileSystem::OpenFileSystem( |
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_.get()) { |
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 = | 102 fileapi::OpenFileSystemMode mode = |
103 create ? fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT | 103 create ? fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT |
104 : fileapi::OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT; | 104 : fileapi::OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT; |
105 GURL origin_url(frame->document().securityOrigin().toString()); | 105 GURL origin_url(frame->document().securityOrigin().toString()); |
106 file_system_context_->OpenFileSystem( | 106 file_system_context_->OpenFileSystem( |
107 origin_url, static_cast<fileapi::FileSystemType>(type), mode, | 107 origin_url, static_cast<fileapi::FileSystemType>(type), mode, |
108 OpenFileSystemHandler(callbacks)); | 108 OpenFileSystemHandler(callbacks)); |
109 } | 109 } |
110 | 110 |
111 void SimpleFileSystem::DeleteFileSystem( | 111 void SimpleFileSystem::DeleteFileSystem( |
112 WebFrame* frame, | 112 WebFrame* frame, |
113 WebKit::WebFileSystemType type, | 113 WebKit::WebFileSystemType type, |
114 WebFileSystemCallbacks* callbacks) { | 114 WebFileSystemCallbacks* callbacks) { |
115 if (!frame || !file_system_context_) { | 115 if (!frame || !file_system_context_.get()) { |
116 callbacks->didFail(WebKit::WebFileErrorSecurity); | 116 callbacks->didFail(WebKit::WebFileErrorSecurity); |
117 return; | 117 return; |
118 } | 118 } |
119 | 119 |
120 GURL origin_url(frame->document().securityOrigin().toString()); | 120 GURL origin_url(frame->document().securityOrigin().toString()); |
121 file_system_context_->DeleteFileSystem( | 121 file_system_context_->DeleteFileSystem( |
122 origin_url, static_cast<fileapi::FileSystemType>(type), | 122 origin_url, static_cast<fileapi::FileSystemType>(type), |
123 DeleteFileSystemHandler(callbacks)); | 123 DeleteFileSystemHandler(callbacks)); |
124 } | 124 } |
125 | 125 |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 web_file_info.modificationTime = info.last_modified.ToDoubleT(); | 401 web_file_info.modificationTime = info.last_modified.ToDoubleT(); |
402 web_file_info.type = info.is_directory ? | 402 web_file_info.type = info.is_directory ? |
403 WebFileInfo::TypeDirectory : WebFileInfo::TypeFile; | 403 WebFileInfo::TypeDirectory : WebFileInfo::TypeFile; |
404 web_file_info.platformPath = | 404 web_file_info.platformPath = |
405 webkit_base::FilePathToWebString(platform_path); | 405 webkit_base::FilePathToWebString(platform_path); |
406 callbacks->didCreateSnapshotFile(web_file_info); | 406 callbacks->didCreateSnapshotFile(web_file_info); |
407 } else { | 407 } else { |
408 callbacks->didFail(fileapi::PlatformFileErrorToWebFileError(result)); | 408 callbacks->didFail(fileapi::PlatformFileErrorToWebFileError(result)); |
409 } | 409 } |
410 } | 410 } |
OLD | NEW |