| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 11 matching lines...) Expand all Loading... |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 #include "modules/filesystem/Entry.h" | 30 #include "modules/filesystem/Entry.h" |
| 31 | 31 |
| 32 #include "core/dom/ExecutionContext.h" | 32 #include "bindings/core/v8/ScriptState.h" |
| 33 #include "core/fileapi/FileError.h" | 33 #include "core/fileapi/FileError.h" |
| 34 #include "core/frame/UseCounter.h" | 34 #include "core/frame/UseCounter.h" |
| 35 #include "core/html/VoidCallback.h" | 35 #include "core/html/VoidCallback.h" |
| 36 #include "modules/filesystem/DirectoryEntry.h" | 36 #include "modules/filesystem/DirectoryEntry.h" |
| 37 #include "modules/filesystem/EntryCallback.h" | 37 #include "modules/filesystem/EntryCallback.h" |
| 38 #include "modules/filesystem/ErrorCallback.h" | 38 #include "modules/filesystem/ErrorCallback.h" |
| 39 #include "modules/filesystem/FileSystemCallbacks.h" | 39 #include "modules/filesystem/FileSystemCallbacks.h" |
| 40 #include "modules/filesystem/MetadataCallback.h" | 40 #include "modules/filesystem/MetadataCallback.h" |
| 41 #include "platform/weborigin/SecurityOrigin.h" | 41 #include "platform/weborigin/SecurityOrigin.h" |
| 42 #include "wtf/text/StringBuilder.h" | 42 #include "wtf/text/StringBuilder.h" |
| 43 | 43 |
| 44 namespace blink { | 44 namespace blink { |
| 45 | 45 |
| 46 Entry::Entry(DOMFileSystemBase* fileSystem, const String& fullPath) | 46 Entry::Entry(DOMFileSystemBase* fileSystem, const String& fullPath) |
| 47 : EntryBase(fileSystem, fullPath) {} | 47 : EntryBase(fileSystem, fullPath) {} |
| 48 | 48 |
| 49 DOMFileSystem* Entry::filesystem(ExecutionContext* context) const { | 49 DOMFileSystem* Entry::filesystem(ScriptState* scriptState) const { |
| 50 if (m_fileSystem->type() == FileSystemTypeIsolated) | 50 if (m_fileSystem->type() == FileSystemTypeIsolated) |
| 51 UseCounter::count( | 51 UseCounter::count( |
| 52 context, | 52 scriptState->getExecutionContext(), |
| 53 UseCounter::Entry_Filesystem_AttributeGetter_IsolatedFileSystem); | 53 UseCounter::Entry_Filesystem_AttributeGetter_IsolatedFileSystem); |
| 54 return filesystem(); | 54 return filesystem(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void Entry::getMetadata(ExecutionContext* context, | 57 void Entry::getMetadata(ScriptState* scriptState, |
| 58 MetadataCallback* successCallback, | 58 MetadataCallback* successCallback, |
| 59 ErrorCallback* errorCallback) { | 59 ErrorCallback* errorCallback) { |
| 60 if (m_fileSystem->type() == FileSystemTypeIsolated) | 60 if (m_fileSystem->type() == FileSystemTypeIsolated) |
| 61 UseCounter::count(context, | 61 UseCounter::count(scriptState->getExecutionContext(), |
| 62 UseCounter::Entry_GetMetadata_Method_IsolatedFileSystem); | 62 UseCounter::Entry_GetMetadata_Method_IsolatedFileSystem); |
| 63 m_fileSystem->getMetadata(this, successCallback, | 63 m_fileSystem->getMetadata(this, successCallback, |
| 64 ScriptErrorCallback::wrap(errorCallback)); | 64 ScriptErrorCallback::wrap(errorCallback)); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void Entry::moveTo(ExecutionContext* context, | 67 void Entry::moveTo(ScriptState* scriptState, |
| 68 DirectoryEntry* parent, | 68 DirectoryEntry* parent, |
| 69 const String& name, | 69 const String& name, |
| 70 EntryCallback* successCallback, | 70 EntryCallback* successCallback, |
| 71 ErrorCallback* errorCallback) const { | 71 ErrorCallback* errorCallback) const { |
| 72 if (m_fileSystem->type() == FileSystemTypeIsolated) | 72 if (m_fileSystem->type() == FileSystemTypeIsolated) |
| 73 UseCounter::count(context, | 73 UseCounter::count(scriptState->getExecutionContext(), |
| 74 UseCounter::Entry_MoveTo_Method_IsolatedFileSystem); | 74 UseCounter::Entry_MoveTo_Method_IsolatedFileSystem); |
| 75 m_fileSystem->move(this, parent, name, successCallback, | 75 m_fileSystem->move(this, parent, name, successCallback, |
| 76 ScriptErrorCallback::wrap(errorCallback)); | 76 ScriptErrorCallback::wrap(errorCallback)); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void Entry::copyTo(ExecutionContext* context, | 79 void Entry::copyTo(ScriptState* scriptState, |
| 80 DirectoryEntry* parent, | 80 DirectoryEntry* parent, |
| 81 const String& name, | 81 const String& name, |
| 82 EntryCallback* successCallback, | 82 EntryCallback* successCallback, |
| 83 ErrorCallback* errorCallback) const { | 83 ErrorCallback* errorCallback) const { |
| 84 if (m_fileSystem->type() == FileSystemTypeIsolated) | 84 if (m_fileSystem->type() == FileSystemTypeIsolated) |
| 85 UseCounter::count(context, | 85 UseCounter::count(scriptState->getExecutionContext(), |
| 86 UseCounter::Entry_CopyTo_Method_IsolatedFileSystem); | 86 UseCounter::Entry_CopyTo_Method_IsolatedFileSystem); |
| 87 m_fileSystem->copy(this, parent, name, successCallback, | 87 m_fileSystem->copy(this, parent, name, successCallback, |
| 88 ScriptErrorCallback::wrap(errorCallback)); | 88 ScriptErrorCallback::wrap(errorCallback)); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void Entry::remove(ExecutionContext* context, | 91 void Entry::remove(ScriptState* scriptState, |
| 92 VoidCallback* successCallback, | 92 VoidCallback* successCallback, |
| 93 ErrorCallback* errorCallback) const { | 93 ErrorCallback* errorCallback) const { |
| 94 if (m_fileSystem->type() == FileSystemTypeIsolated) | 94 if (m_fileSystem->type() == FileSystemTypeIsolated) |
| 95 UseCounter::count(context, | 95 UseCounter::count(scriptState->getExecutionContext(), |
| 96 UseCounter::Entry_Remove_Method_IsolatedFileSystem); | 96 UseCounter::Entry_Remove_Method_IsolatedFileSystem); |
| 97 m_fileSystem->remove(this, successCallback, | 97 m_fileSystem->remove(this, successCallback, |
| 98 ScriptErrorCallback::wrap(errorCallback)); | 98 ScriptErrorCallback::wrap(errorCallback)); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void Entry::getParent(ExecutionContext* context, | 101 void Entry::getParent(ScriptState* scriptState, |
| 102 EntryCallback* successCallback, | 102 EntryCallback* successCallback, |
| 103 ErrorCallback* errorCallback) const { | 103 ErrorCallback* errorCallback) const { |
| 104 if (m_fileSystem->type() == FileSystemTypeIsolated) | 104 if (m_fileSystem->type() == FileSystemTypeIsolated) |
| 105 UseCounter::count(context, | 105 UseCounter::count(scriptState->getExecutionContext(), |
| 106 UseCounter::Entry_GetParent_Method_IsolatedFileSystem); | 106 UseCounter::Entry_GetParent_Method_IsolatedFileSystem); |
| 107 m_fileSystem->getParent(this, successCallback, | 107 m_fileSystem->getParent(this, successCallback, |
| 108 ScriptErrorCallback::wrap(errorCallback)); | 108 ScriptErrorCallback::wrap(errorCallback)); |
| 109 } | 109 } |
| 110 | 110 |
| 111 String Entry::toURL(ExecutionContext* context) const { | 111 String Entry::toURL(ScriptState* scriptState) const { |
| 112 if (m_fileSystem->type() == FileSystemTypeIsolated) | 112 if (m_fileSystem->type() == FileSystemTypeIsolated) |
| 113 UseCounter::count(context, | 113 UseCounter::count(scriptState->getExecutionContext(), |
| 114 UseCounter::Entry_ToURL_Method_IsolatedFileSystem); | 114 UseCounter::Entry_ToURL_Method_IsolatedFileSystem); |
| 115 return static_cast<const EntryBase*>(this)->toURL(); | 115 return static_cast<const EntryBase*>(this)->toURL(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 DEFINE_TRACE(Entry) { | 118 DEFINE_TRACE(Entry) { |
| 119 EntryBase::trace(visitor); | 119 EntryBase::trace(visitor); |
| 120 } | 120 } |
| 121 | 121 |
| 122 } // namespace blink | 122 } // namespace blink |
| OLD | NEW |