| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 #include "core/dom/CrossThreadTask.h" | 34 #include "core/dom/CrossThreadTask.h" |
| 35 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
| 36 #include "core/dom/ExceptionCode.h" | 36 #include "core/dom/ExceptionCode.h" |
| 37 #include "core/dom/ScriptExecutionContext.h" | 37 #include "core/dom/ScriptExecutionContext.h" |
| 38 #include "core/fileapi/FileError.h" | 38 #include "core/fileapi/FileError.h" |
| 39 #include "core/page/Page.h" | 39 #include "core/page/Page.h" |
| 40 #include "core/platform/AsyncFileSystemCallbacks.h" | 40 #include "core/platform/AsyncFileSystemCallbacks.h" |
| 41 #include "modules/filesystem/FileSystemClient.h" | 41 #include "modules/filesystem/FileSystemClient.h" |
| 42 #include "modules/filesystem/WorkerLocalFileSystem.h" | 42 #include "modules/filesystem/WorkerLocalFileSystem.h" |
| 43 #include "public/platform/Platform.h" |
| 44 #include "public/platform/WebFileSystem.h" |
| 43 | 45 |
| 44 namespace WebCore { | 46 namespace WebCore { |
| 45 | 47 |
| 46 namespace { | 48 namespace { |
| 47 | 49 |
| 48 void fileSystemNotAllowed(ScriptExecutionContext*, PassOwnPtr<AsyncFileSystemCal
lbacks> callbacks) | 50 void fileSystemNotAllowed(ScriptExecutionContext*, PassOwnPtr<AsyncFileSystemCal
lbacks> callbacks) |
| 49 { | 51 { |
| 50 callbacks->didFail(FileError::ABORT_ERR); | 52 callbacks->didFail(FileError::ABORT_ERR); |
| 51 } | 53 } |
| 52 | 54 |
| 53 } // namespace | 55 } // namespace |
| 54 | 56 |
| 55 LocalFileSystemBase::~LocalFileSystemBase() | 57 LocalFileSystemBase::~LocalFileSystemBase() |
| 56 { | 58 { |
| 57 } | 59 } |
| 58 | 60 |
| 59 void LocalFileSystemBase::readFileSystem(ScriptExecutionContext* context, FileSy
stemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) | 61 void LocalFileSystemBase::resolveURL(ScriptExecutionContext* context, KURL fileS
ystemURL, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) |
| 60 { | 62 { |
| 61 if (!client() || !client()->allowFileSystem(context)) { | 63 if (!client() || !client()->allowFileSystem(context)) { |
| 62 context->postTask(createCallbackTask(&fileSystemNotAllowed, callbacks)); | 64 context->postTask(createCallbackTask(&fileSystemNotAllowed, callbacks)); |
| 63 return; | 65 return; |
| 64 } | 66 } |
| 65 client()->openFileSystem(context, type, callbacks, 0, OpenExistingFileSystem
); | 67 WebKit::Platform::current()->fileSystem()->resolveURL(fileSystemURL, callbac
ks); |
| 66 } | 68 } |
| 67 | 69 |
| 68 void LocalFileSystemBase::requestFileSystem(ScriptExecutionContext* context, Fil
eSystemType type, long long size, PassOwnPtr<AsyncFileSystemCallbacks> callbacks
) | 70 void LocalFileSystemBase::requestFileSystem(ScriptExecutionContext* context, Fil
eSystemType type, long long size, PassOwnPtr<AsyncFileSystemCallbacks> callbacks
) |
| 69 { | 71 { |
| 70 if (!client() || !client()->allowFileSystem(context)) { | 72 if (!client() || !client()->allowFileSystem(context)) { |
| 71 context->postTask(createCallbackTask(&fileSystemNotAllowed, callbacks)); | 73 context->postTask(createCallbackTask(&fileSystemNotAllowed, callbacks)); |
| 72 return; | 74 return; |
| 73 } | 75 } |
| 74 client()->openFileSystem(context, type, callbacks, size, CreateFileSystemIfN
otPresent); | 76 client()->openFileSystem(context, type, callbacks, size, CreateFileSystemIfN
otPresent); |
| 75 } | 77 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 { | 116 { |
| 115 return static_cast<LocalFileSystem*>(Supplement<Page>::from(toDocument(conte
xt)->page(), supplementName())); | 117 return static_cast<LocalFileSystem*>(Supplement<Page>::from(toDocument(conte
xt)->page(), supplementName())); |
| 116 } | 118 } |
| 117 | 119 |
| 118 void provideLocalFileSystemTo(Page* page, PassOwnPtr<FileSystemClient> client) | 120 void provideLocalFileSystemTo(Page* page, PassOwnPtr<FileSystemClient> client) |
| 119 { | 121 { |
| 120 LocalFileSystem::provideTo(page, LocalFileSystem::supplementName(), LocalFil
eSystem::create(client)); | 122 LocalFileSystem::provideTo(page, LocalFileSystem::supplementName(), LocalFil
eSystem::create(client)); |
| 121 } | 123 } |
| 122 | 124 |
| 123 } // namespace WebCore | 125 } // namespace WebCore |
| OLD | NEW |