18a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block/*
28a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * Copyright (C) 2010 Google Inc. All rights reserved.
38a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block *
48a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * Redistribution and use in source and binary forms, with or without
58a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * modification, are permitted provided that the following conditions are
68a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * met:
78a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block *
88a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block *     * Redistributions of source code must retain the above copyright
98a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * notice, this list of conditions and the following disclaimer.
108a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block *     * Redistributions in binary form must reproduce the above
118a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * copyright notice, this list of conditions and the following disclaimer
128a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * in the documentation and/or other materials provided with the
138a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * distribution.
148a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block *     * Neither the name of Google Inc. nor the names of its
158a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * contributors may be used to endorse or promote products derived from
168a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * this software without specific prior written permission.
178a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block *
188a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
198a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
208a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
218a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
228a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
238a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
248a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
258a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
268a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
278a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
288a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
298a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block */
308a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block
3168513a70bcd92384395513322f1b801e7bf9c729Steve Block#include "config.h"
3268513a70bcd92384395513322f1b801e7bf9c729Steve Block
3368513a70bcd92384395513322f1b801e7bf9c729Steve Block#if ENABLE(FILE_SYSTEM)
3468513a70bcd92384395513322f1b801e7bf9c729Steve Block
3568513a70bcd92384395513322f1b801e7bf9c729Steve Block#include "JSEntry.h"
3668513a70bcd92384395513322f1b801e7bf9c729Steve Block
3768513a70bcd92384395513322f1b801e7bf9c729Steve Block#include "Entry.h"
3868513a70bcd92384395513322f1b801e7bf9c729Steve Block#include "JSDOMBinding.h"
3968513a70bcd92384395513322f1b801e7bf9c729Steve Block#include "JSDirectoryEntry.h"
4068513a70bcd92384395513322f1b801e7bf9c729Steve Block#include "JSFileEntry.h"
4168513a70bcd92384395513322f1b801e7bf9c729Steve Block#include <wtf/Assertions.h>
4268513a70bcd92384395513322f1b801e7bf9c729Steve Block
4368513a70bcd92384395513322f1b801e7bf9c729Steve Blockusing namespace JSC;
448a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block
4568513a70bcd92384395513322f1b801e7bf9c729Steve Blocknamespace WebCore {
4668513a70bcd92384395513322f1b801e7bf9c729Steve Block
4768513a70bcd92384395513322f1b801e7bf9c729Steve BlockJSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, Entry* entry)
4868513a70bcd92384395513322f1b801e7bf9c729Steve Block{
4968513a70bcd92384395513322f1b801e7bf9c729Steve Block    if (!entry)
5068513a70bcd92384395513322f1b801e7bf9c729Steve Block        return jsNull();
5168513a70bcd92384395513322f1b801e7bf9c729Steve Block
5268513a70bcd92384395513322f1b801e7bf9c729Steve Block    if (entry->isFile())
5368513a70bcd92384395513322f1b801e7bf9c729Steve Block        return getDOMObjectWrapper<JSFileEntry>(exec, globalObject, static_cast<FileEntry*>(entry));
5468513a70bcd92384395513322f1b801e7bf9c729Steve Block
5568513a70bcd92384395513322f1b801e7bf9c729Steve Block    ASSERT(entry->isDirectory());
5668513a70bcd92384395513322f1b801e7bf9c729Steve Block    return getDOMObjectWrapper<JSDirectoryEntry>(exec, globalObject, static_cast<DirectoryEntry*>(entry));
578a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block}
5868513a70bcd92384395513322f1b801e7bf9c729Steve Block
5968513a70bcd92384395513322f1b801e7bf9c729Steve Block} // namespace WebCore
6068513a70bcd92384395513322f1b801e7bf9c729Steve Block
6168513a70bcd92384395513322f1b801e7bf9c729Steve Block#endif // ENABLE(FILE_SYSTEM)
62