Commit 82391b05 authored by kinuko@chromium.org's avatar kinuko@chromium.org

2010-09-13 Kinuko Yasuda <kinuko@chromium.org>

        Reviewed by Adam Barth.

        Make FileEntry and DirectoryEntry methods accessible via Entry instance
        https://bugs.webkit.org/show_bug.cgi?id=45553

        FileEntry- and DirectoryEntry- specific methods must be available on Entry object based on its internal type.

        Added custom toJS/toV8 implementation to Entry interface.

        No new tests; test will be added later when we have complete implementation for the API.

        * CMakeLists.txt:
        * GNUmakefile.am:
        * WebCore.gypi:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSEntryCustom.cpp: Added.
        (WebCore::toJS):
        * bindings/v8/custom/V8EntryCustom.cpp: Added.
        (WebCore::toV8):
        * fileapi/DirectoryEntry.h: Nits fix.
        * fileapi/DirectoryEntry.idl: Added ConvertUndefinedOrNullToString to path parameter.
        * fileapi/Entry.idl: Added CustomToJS attribute.
        * fileapi/FileEntry.cpp:
        (WebCore::FileEntry::createWriter):
        (WebCore::FileEntry::file):
        * fileapi/FileEntry.h:
        * fileapi/FileEntry.idl:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67443 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 89aef7bb
......@@ -1569,6 +1569,7 @@ ENDIF ()
if (ENABLE_FILE_SYSTEM)
LIST(APPEND WebCore_SOURCES
bindings/js/JSEntryCustom.cpp
fileapi/DirectoryEntry.cpp
fileapi/DirectoryReader.cpp
fileapi/DOMFilePath.cpp
......
2010-09-13 Kinuko Yasuda <kinuko@chromium.org>
Reviewed by Adam Barth.
Make FileEntry and DirectoryEntry methods accessible via Entry instance
https://bugs.webkit.org/show_bug.cgi?id=45553
FileEntry- and DirectoryEntry- specific methods must be available on Entry object based on its internal type.
Added custom toJS/toV8 implementation to Entry interface.
No new tests; test will be added later when we have complete implementation for the API.
* CMakeLists.txt:
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSEntryCustom.cpp: Added.
(WebCore::toJS):
* bindings/v8/custom/V8EntryCustom.cpp: Added.
(WebCore::toV8):
* fileapi/DirectoryEntry.h: Nits fix.
* fileapi/DirectoryEntry.idl: Added ConvertUndefinedOrNullToString to path parameter.
* fileapi/Entry.idl: Added CustomToJS attribute.
* fileapi/FileEntry.cpp:
(WebCore::FileEntry::createWriter):
(WebCore::FileEntry::file):
* fileapi/FileEntry.h:
* fileapi/FileEntry.idl:
2010-09-13 Ryosuke Niwa <rniwa@webkit.org>
Reviewed by Darin Adler.
......@@ -699,6 +699,7 @@ webcore_sources += \
WebCore/bindings/js/JSDOMWrapper.cpp \
WebCore/bindings/js/JSDOMWrapper.h \
WebCore/bindings/js/JSElementCustom.cpp \
WebCore/bindings/js/JSEntryCustom.cpp \
WebCore/bindings/js/JSEventCustom.cpp \
WebCore/bindings/js/JSEventListener.cpp \
WebCore/bindings/js/JSEventListener.h \
......
......@@ -581,6 +581,7 @@
'bindings/js/JSDOMWrapper.cpp',
'bindings/js/JSDOMWrapper.h',
'bindings/js/JSElementCustom.cpp',
'bindings/js/JSEntryCustom.cpp',
'bindings/js/JSEventCustom.cpp',
'bindings/js/JSEventListener.cpp',
'bindings/js/JSEventListener.h',
......@@ -765,6 +766,7 @@
'bindings/v8/custom/V8DOMWindowCustom.cpp',
'bindings/v8/custom/V8DocumentCustom.cpp',
'bindings/v8/custom/V8ElementCustom.cpp',
'bindings/v8/custom/V8EntryCustom.cpp',
'bindings/v8/custom/V8EventCustom.cpp',
'bindings/v8/custom/V8EventSourceConstructor.cpp',
'bindings/v8/custom/V8GeolocationCustom.cpp',
......
......@@ -2939,6 +2939,7 @@ contains(DEFINES, ENABLE_FILE_SYSTEM=1) {
platform/AsyncFileSystemCallbacks.h
SOURCES += \
bindings/js/JSEntryCustom.cpp \
fileapi/DirectoryEntry.cpp \
fileapi/DirectoryReader.cpp \
fileapi/DOMFilePath.cpp \
......
......@@ -46683,6 +46683,10 @@
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBTransaction.h"
>
</File>
<File
RelativePath="..\bindings\js\JSEntryCustom.cpp"
>
</File>
<File
RelativePath="..\bindings\js\JSImageConstructor.cpp"
>
......@@ -2384,6 +2384,7 @@
893C47B81238A099002B3D86 /* JSFileCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 893C47B61238A099002B3D86 /* JSFileCallback.h */; };
893C47BB1238A0A9002B3D86 /* JSFileWriterCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 893C47B91238A0A9002B3D86 /* JSFileWriterCallback.cpp */; };
893C47BC1238A0A9002B3D86 /* JSFileWriterCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 893C47BA1238A0A9002B3D86 /* JSFileWriterCallback.h */; };
893C47CC123EEBA2002B3D86 /* JSEntryCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 893C47CA123EEBA2002B3D86 /* JSEntryCustom.cpp */; };
89878552122CA064003AABDA /* DirectoryEntry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 89878539122CA064003AABDA /* DirectoryEntry.cpp */; };
89878553122CA064003AABDA /* DirectoryEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 8987853A122CA064003AABDA /* DirectoryEntry.h */; };
89878554122CA064003AABDA /* DirectoryReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8987853B122CA064003AABDA /* DirectoryReader.cpp */; };
......@@ -8288,6 +8289,7 @@
893C47B61238A099002B3D86 /* JSFileCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFileCallback.h; sourceTree = "<group>"; };
893C47B91238A0A9002B3D86 /* JSFileWriterCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFileWriterCallback.cpp; sourceTree = "<group>"; };
893C47BA1238A0A9002B3D86 /* JSFileWriterCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFileWriterCallback.h; sourceTree = "<group>"; };
893C47CA123EEBA2002B3D86 /* JSEntryCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEntryCustom.cpp; sourceTree = "<group>"; };
89878539122CA064003AABDA /* DirectoryEntry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DirectoryEntry.cpp; path = fileapi/DirectoryEntry.cpp; sourceTree = "<group>"; };
8987853A122CA064003AABDA /* DirectoryEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DirectoryEntry.h; path = fileapi/DirectoryEntry.h; sourceTree = "<group>"; };
8987853B122CA064003AABDA /* DirectoryReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DirectoryReader.cpp; path = fileapi/DirectoryReader.cpp; sourceTree = "<group>"; };
......@@ -16374,6 +16376,7 @@
BCD9C25E0C17AA67005C90A2 /* JSDOMWindowCustom.cpp */,
652FBBBB0DE27CB60001D386 /* JSDOMWindowCustom.h */,
BC2ED5540C6B9BD300920BFF /* JSElementCustom.cpp */,
893C47CA123EEBA2002B3D86 /* JSEntryCustom.cpp */,
BCEFAF4D0C317E6900FA81F6 /* JSEventCustom.cpp */,
BC275B8011C5D2B400C9206C /* JSEventSourceCustom.cpp */,
49EECF7210508D9C00099FAB /* JSFloat32ArrayCustom.cpp */,
......@@ -23031,6 +23034,7 @@
893C47B71238A099002B3D86 /* JSFileCallback.cpp in Sources */,
893C47BB1238A0A9002B3D86 /* JSFileWriterCallback.cpp in Sources */,
93E2A306123E9DC0009FE12A /* HTMLParserIdioms.cpp in Sources */,
893C47CC123EEBA2002B3D86 /* JSEntryCustom.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "JSEntry.h"
#if ENABLE(FILE_SYSTEM)
#include "Entry.h"
#include "JSDOMBinding.h"
#include "JSDirectoryEntry.h"
#include "JSFileEntry.h"
#include <wtf/Assertions.h>
using namespace JSC;
namespace WebCore {
JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, Entry* entry)
{
if (!entry)
return jsNull();
if (entry->isFile())
return getDOMObjectWrapper<JSFileEntry>(exec, globalObject, static_cast<FileEntry*>(entry));
ASSERT(entry->isDirectory());
return getDOMObjectWrapper<JSDirectoryEntry>(exec, globalObject, static_cast<DirectoryEntry*>(entry));
}
} // namespace WebCore
#endif // ENABLE(FILE_SYSTEM)
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "Entry.h"
#if ENABLE(FILE_SYSTEM)
#include "V8Attr.h"
#include "V8Binding.h"
#include "V8BindingState.h"
#include "V8DirectoryEntry.h"
#include "V8Entry.h"
#include "V8FileEntry.h"
#include "V8Proxy.h"
#include <wtf/RefPtr.h>
namespace WebCore {
v8::Handle<v8::Value> toV8(Entry* impl)
{
if (!impl)
return v8::Null();
if (impl->isFile())
return toV8(static_cast<FileEntry*>(impl));
ASSERT(impl->isDirectory());
return toV8(static_cast<DirectoryEntry*>(impl));
}
} // namespace WebCore
#endif // ENABLE(FILE_SYSTEM)
......@@ -54,8 +54,8 @@ public:
virtual bool isDirectory() const { return true; }
PassRefPtr<DirectoryReader> createReader();
void getFile(const String& path, PassRefPtr<Flags> options = 0, PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0);
void getDirectory(const String& path, PassRefPtr<Flags> options = 0, PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0);
void getFile(const String& path, PassRefPtr<Flags> = 0, PassRefPtr<EntryCallback> = 0, PassRefPtr<ErrorCallback> = 0);
void getDirectory(const String& path, PassRefPtr<Flags> = 0, PassRefPtr<EntryCallback> = 0, PassRefPtr<ErrorCallback> = 0);
private:
DirectoryEntry(DOMFileSystem* fileSystem, const String& fullPath);
......
......@@ -35,7 +35,7 @@ module storage {
GenerateToJS
] DirectoryEntry : Entry {
DirectoryReader createReader();
void getFile(in DOMString path, in [Optional] Flags options, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback);
void getDirectory(in DOMString path, in [Optional] Flags options, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback);
void getFile(in [ConvertUndefinedOrNullToNullString] DOMString path, in [Optional] Flags flags, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback);
void getDirectory(in [ConvertUndefinedOrNullToNullString] DOMString path, in [Optional] Flags flags, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback);
};
}
......@@ -30,7 +30,8 @@
module storage {
interface [
Conditional=FILE_SYSTEM
Conditional=FILE_SYSTEM,
CustomToJS
] Entry {
readonly attribute boolean isFile;
readonly attribute boolean isDirectory;
......@@ -39,8 +40,8 @@ module storage {
readonly attribute DOMFileSystem filesystem;
void getMetadata(in [Optional, Callback] MetadataCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback);
void moveTo(in Entry parent, in [Optional] DOMString name, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback);
void copyTo(in Entry parent, in [Optional] DOMString name, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback);
void moveTo(in Entry parent, in [Optional, ConvertUndefinedOrNullToNullString] DOMString name, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback);
void copyTo(in Entry parent, in [Optional, ConvertUndefinedOrNullToNullString] DOMString name, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback);
void remove(in [Optional, Callback] VoidCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback);
void getParent(in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback);
};
......
......@@ -33,6 +33,9 @@
#if ENABLE(FILE_SYSTEM)
#include "FileCallback.h"
#include "FileWriterCallback.h"
namespace WebCore {
FileEntry::FileEntry(DOMFileSystem* fileSystem, const String& fullPath)
......@@ -40,6 +43,18 @@ FileEntry::FileEntry(DOMFileSystem* fileSystem, const String& fullPath)
{
}
#if ENABLE(FILE_WRITER)
void FileEntry::createWriter(PassRefPtr<FileWriterCallback>, PassRefPtr<ErrorCallback>)
{
// FIXME: to be implemented.
}
#endif
void FileEntry::file(PassRefPtr<FileCallback>, PassRefPtr<ErrorCallback>)
{
// FIXME: to be implemented.
}
} // namespace
#endif // ENABLE(FILE_SYSTEM)
......@@ -34,6 +34,8 @@
#if ENABLE(FILE_SYSTEM)
#include "Entry.h"
#include "FileCallback.h"
#include "FileWriterCallback.h"
namespace WebCore {
......@@ -45,6 +47,12 @@ public:
{
return adoptRef(new FileEntry(fileSystem, fullPath));
}
#if ENABLE(FILE_WRITER)
void createWriter(PassRefPtr<FileWriterCallback>, PassRefPtr<ErrorCallback> = 0);
#endif
void file(PassRefPtr<FileCallback>, PassRefPtr<ErrorCallback> = 0);
virtual bool isFile() const { return true; }
private:
......
......@@ -34,5 +34,9 @@ module storage {
GenerateNativeConverter,
GenerateToJS
] FileEntry : Entry {
#if defined(ENABLE_FILE_WRITER) && ENABLE_FILE_WRITER
void createWriter(in [Callback] FileWriterCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback);
#endif
void file(in [Callback] FileCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback);
};
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment