OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2010, 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 static void deleteFileSystemNotAllowed(ScriptExecutionContext*, PassOwnPtr<Async
FileSystemCallbacks> callbacks) | 150 static void deleteFileSystemNotAllowed(ScriptExecutionContext*, PassOwnPtr<Async
FileSystemCallbacks> callbacks) |
151 { | 151 { |
152 callbacks->didFail(WebKit::WebFileErrorAbort); | 152 callbacks->didFail(WebKit::WebFileErrorAbort); |
153 } | 153 } |
154 | 154 |
155 static void openFileSystemHelper(ScriptExecutionContext* context, FileSystemType
type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileSystemSynchronousType
synchronousType, long long size, CreationFlag create) | 155 static void openFileSystemHelper(ScriptExecutionContext* context, FileSystemType
type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileSystemSynchronousType
synchronousType, long long size, CreationFlag create) |
156 { | 156 { |
157 bool allowed = true; | 157 bool allowed = true; |
158 ASSERT(context); | 158 ASSERT(context); |
159 if (context->isDocument()) { | 159 if (context->isDocument()) { |
160 Document* document = static_cast<Document*>(context); | 160 Document* document = toDocument(context); |
161 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); | 161 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); |
162 WebKit::WebViewImpl* webView = webFrame->viewImpl(); | 162 WebKit::WebViewImpl* webView = webFrame->viewImpl(); |
163 if (webView->permissionClient() && !webView->permissionClient()->allowFi
leSystem(webFrame)) | 163 if (webView->permissionClient() && !webView->permissionClient()->allowFi
leSystem(webFrame)) |
164 allowed = false; | 164 allowed = false; |
165 else | 165 else |
166 webFrame->client()->openFileSystem(webFrame, static_cast<WebFileSyst
emType>(type), size, create == CreateIfNotPresent, new WebFileSystemCallbacksImp
l(callbacks)); | 166 webFrame->client()->openFileSystem(webFrame, static_cast<WebFileSyst
emType>(type), size, create == CreateIfNotPresent, new WebFileSystemCallbacksImp
l(callbacks)); |
167 } else { | 167 } else { |
168 WorkerGlobalScope* workerGlobalScope = static_cast<WorkerGlobalScope*>(c
ontext); | 168 WorkerGlobalScope* workerGlobalScope = static_cast<WorkerGlobalScope*>(c
ontext); |
169 WebWorkerBase* webWorker = static_cast<WebWorkerBase*>(workerGlobalScope
->thread()->workerLoaderProxy().toWebWorkerBase()); | 169 WebWorkerBase* webWorker = static_cast<WebWorkerBase*>(workerGlobalScope
->thread()->workerLoaderProxy().toWebWorkerBase()); |
170 if (!allowFileSystemForWorker()) | 170 if (!allowFileSystemForWorker()) |
(...skipping 16 matching lines...) Expand all Loading... |
187 void LocalFileSystem::requestFileSystem(ScriptExecutionContext* context, FileSys
temType type, long long size, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, Fi
leSystemSynchronousType synchronousType) | 187 void LocalFileSystem::requestFileSystem(ScriptExecutionContext* context, FileSys
temType type, long long size, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, Fi
leSystemSynchronousType synchronousType) |
188 { | 188 { |
189 openFileSystemHelper(context, type, callbacks, synchronousType, size, Create
IfNotPresent); | 189 openFileSystemHelper(context, type, callbacks, synchronousType, size, Create
IfNotPresent); |
190 } | 190 } |
191 | 191 |
192 void LocalFileSystem::deleteFileSystem(ScriptExecutionContext* context, FileSyst
emType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) | 192 void LocalFileSystem::deleteFileSystem(ScriptExecutionContext* context, FileSyst
emType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) |
193 { | 193 { |
194 ASSERT(context); | 194 ASSERT(context); |
195 ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument()); | 195 ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument()); |
196 | 196 |
197 Document* document = static_cast<Document*>(context); | 197 Document* document = toDocument(context); |
198 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); | 198 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); |
199 WebKit::WebViewImpl* webView = webFrame->viewImpl(); | 199 WebKit::WebViewImpl* webView = webFrame->viewImpl(); |
200 if (webView->permissionClient() && !webView->permissionClient()->allowFileSy
stem(webFrame)) { | 200 if (webView->permissionClient() && !webView->permissionClient()->allowFileSy
stem(webFrame)) { |
201 context->postTask(createCallbackTask(&deleteFileSystemNotAllowed, callba
cks)); | 201 context->postTask(createCallbackTask(&deleteFileSystemNotAllowed, callba
cks)); |
202 return; | 202 return; |
203 } | 203 } |
204 | 204 |
205 webFrame->client()->deleteFileSystem(webFrame, static_cast<WebFileSystemType
>(type), new WebFileSystemCallbacksImpl(callbacks)); | 205 webFrame->client()->deleteFileSystem(webFrame, static_cast<WebFileSystemType
>(type), new WebFileSystemCallbacksImpl(callbacks)); |
206 } | 206 } |
207 | 207 |
208 } // namespace WebCore | 208 } // namespace WebCore |
OLD | NEW |