106c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu/*
206c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu * Copyright 2010, The Android Open Source Project
306c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu *
406c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu * Redistribution and use in source and binary forms, with or without
506c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu * modification, are permitted provided that the following conditions
606c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu * are met:
706c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu *  * Redistributions of source code must retain the above copyright
806c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu *    notice, this list of conditions and the following disclaimer.
906c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu *  * Redistributions in binary form must reproduce the above copyright
1006c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu *    notice, this list of conditions and the following disclaimer in the
1106c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu *    documentation and/or other materials provided with the distribution.
1206c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu *
1306c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
1406c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1506c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1606c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
1706c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
1806c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
1906c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
2006c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
2106c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2206c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2306c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2406c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu */
2506c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu
2606c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu#include "config.h"
2706c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu#include "JSCustomApplicationInstalledCallback.h"
2806c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu
2906c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu#if PLATFORM(ANDROID) && ENABLE(APPLICATION_INSTALLED)
3006c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu
3106c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu#include "ScriptController.h"
3206c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu#include <runtime/JSLock.h>
3306c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu
3406c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescunamespace WebCore {
3506c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu
3606c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescuusing namespace JSC;
3706c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu
3806c8f75ebb768453c256ee2140fb5392ed35bc13Andrei PopescuJSCustomApplicationInstalledCallback::JSCustomApplicationInstalledCallback(JSObject* callback, JSDOMGlobalObject* globalObject)
3906c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu    : m_data(callback, globalObject)
4006c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu{
4106c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu}
4206c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu
4306c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescuvoid JSCustomApplicationInstalledCallback::handleEvent(bool isInstalled)
4406c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu{
4506c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu    RefPtr<JSCustomApplicationInstalledCallback> protect(this);
4606c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu
4706c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu    JSC::JSLock lock(SilenceAssertionsOnly);
4806c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu    ExecState* exec = m_data.globalObject()->globalExec();
4906c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu    MarkedArgumentBuffer args;
5006c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu    args.append(jsBoolean(isInstalled));
5106c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu    m_data.invokeCallback(args);
5206c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu}
5306c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu
5406c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu} // namespace WebCore
5506c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu
5606c8f75ebb768453c256ee2140fb5392ed35bc13Andrei Popescu#endif // PLATFORM(ANDROID) && ENABLE(APPLICATION_INSTALLED)
57