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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 } else { | 88 } else { |
89 LOG(WARNING) << "Failed to create a temp dir for the filesystem." | 89 LOG(WARNING) << "Failed to create a temp dir for the filesystem." |
90 "FileSystem feature will be disabled."; | 90 "FileSystem feature will be disabled."; |
91 } | 91 } |
92 } | 92 } |
93 | 93 |
94 SimpleFileSystem::~SimpleFileSystem() { | 94 SimpleFileSystem::~SimpleFileSystem() { |
95 } | 95 } |
96 | 96 |
97 void SimpleFileSystem::OpenFileSystem( | 97 void SimpleFileSystem::OpenFileSystem( |
98 WebFrame* frame, WebFileSystem::Type type, | 98 WebFrame* frame, |
| 99 #ifdef WEBKIT_USE_NEW_WEBFILESYSTEMTYPE |
| 100 WebKit::WebFileSystemType type, |
| 101 #else |
| 102 WebFileSystem::Type type, |
| 103 #endif |
99 long long, bool create, | 104 long long, bool create, |
100 WebFileSystemCallbacks* callbacks) { | 105 WebFileSystemCallbacks* callbacks) { |
101 if (!frame || !file_system_context_.get()) { | 106 if (!frame || !file_system_context_.get()) { |
102 // The FileSystem temp directory was not initialized successfully. | 107 // The FileSystem temp directory was not initialized successfully. |
103 callbacks->didFail(WebKit::WebFileErrorSecurity); | 108 callbacks->didFail(WebKit::WebFileErrorSecurity); |
104 return; | 109 return; |
105 } | 110 } |
106 | 111 |
107 GURL origin_url(frame->document().securityOrigin().toString()); | 112 GURL origin_url(frame->document().securityOrigin().toString()); |
108 file_system_context_->OpenFileSystem( | 113 file_system_context_->OpenFileSystem( |
109 origin_url, static_cast<fileapi::FileSystemType>(type), create, | 114 origin_url, static_cast<fileapi::FileSystemType>(type), create, |
110 OpenFileSystemHandler(callbacks)); | 115 OpenFileSystemHandler(callbacks)); |
111 } | 116 } |
112 | 117 |
113 void SimpleFileSystem::DeleteFileSystem( | 118 void SimpleFileSystem::DeleteFileSystem( |
114 WebFrame* frame, WebFileSystem::Type type, | 119 WebFrame* frame, |
| 120 #ifdef WEBKIT_USE_NEW_WEBFILESYSTEMTYPE |
| 121 WebKit::WebFileSystemType type, |
| 122 #else |
| 123 WebFileSystem::Type type, |
| 124 #endif |
115 WebFileSystemCallbacks* callbacks) { | 125 WebFileSystemCallbacks* callbacks) { |
116 if (!frame || !file_system_context_.get()) { | 126 if (!frame || !file_system_context_.get()) { |
117 callbacks->didFail(WebKit::WebFileErrorSecurity); | 127 callbacks->didFail(WebKit::WebFileErrorSecurity); |
118 return; | 128 return; |
119 } | 129 } |
120 | 130 |
121 GURL origin_url(frame->document().securityOrigin().toString()); | 131 GURL origin_url(frame->document().securityOrigin().toString()); |
122 file_system_context_->DeleteFileSystem( | 132 file_system_context_->DeleteFileSystem( |
123 origin_url, static_cast<fileapi::FileSystemType>(type), | 133 origin_url, static_cast<fileapi::FileSystemType>(type), |
124 DeleteFileSystemHandler(callbacks)); | 134 DeleteFileSystemHandler(callbacks)); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 const base::FilePath& platform_path, | 450 const base::FilePath& platform_path, |
441 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { | 451 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { |
442 DCHECK(g_io_thread); | 452 DCHECK(g_io_thread); |
443 if (result == base::PLATFORM_FILE_OK) { | 453 if (result == base::PLATFORM_FILE_OK) { |
444 g_io_thread->PostTask( | 454 g_io_thread->PostTask( |
445 FROM_HERE, | 455 FROM_HERE, |
446 base::Bind(&RegisterBlob, blob_url, platform_path)); | 456 base::Bind(&RegisterBlob, blob_url, platform_path)); |
447 } | 457 } |
448 DidGetMetadata(callbacks, result, info, platform_path); | 458 DidGetMetadata(callbacks, result, info, platform_path); |
449 } | 459 } |
OLD | NEW |