118a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu/*
218a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu * Copyright 2010, The Android Open Source Project
318a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu *
418a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu * Redistribution and use in source and binary forms, with or without
518a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu * modification, are permitted provided that the following conditions
618a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu * are met:
718a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu *  * Redistributions of source code must retain the above copyright
818a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu *    notice, this list of conditions and the following disclaimer.
918a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu *  * Redistributions in binary form must reproduce the above copyright
1018a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu *    notice, this list of conditions and the following disclaimer in the
1118a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu *    documentation and/or other materials provided with the distribution.
1218a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu *
1318a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
1418a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1518a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1618a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
1718a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
1818a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
1918a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
2018a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
2118a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2218a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2318a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2418a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu */
2518a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu#if PLATFORM(ANDROID) && ENABLE(APPLICATION_INSTALLED)
2618a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu
2718a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu#ifndef V8CustomApplicationInstalledCallback_h
2818a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu#define V8CustomApplicationInstalledCallback_h
2918a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu
3018a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu#include "ApplicationInstalledCallback.h"
3118a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu#include <v8.h>
3218a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu#include <wtf/PassRefPtr.h>
3318a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu#include <wtf/RefPtr.h>
3418a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu
3518a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescunamespace WebCore {
3618a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu
3718a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescuclass Frame;
3818a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu
3918a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescuclass V8CustomApplicationInstalledCallback : public ApplicationInstalledCallback {
4018a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescupublic:
4118a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu    static PassRefPtr<V8CustomApplicationInstalledCallback> create(v8::Local<v8::Value> value, Frame* frame)
4218a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu    {
4318a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu        ASSERT(value->IsObject());
4418a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu        return adoptRef(new V8CustomApplicationInstalledCallback(value->ToObject(), frame));
4518a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu    }
4618a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu    virtual ~V8CustomApplicationInstalledCallback();
4718a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu
4818a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu    virtual void handleEvent(bool isInstalled);
4918a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu
5018a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescuprivate:
5118a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu    V8CustomApplicationInstalledCallback(v8::Local<v8::Object>, Frame*);
5218a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu
5318a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu    v8::Persistent<v8::Object> m_callback;
5418a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu    RefPtr<Frame> m_frame;
5518a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu};
5618a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu
5718a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu} // namespace WebCore
5818a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu
5918a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu#endif // V8CustomApplicationInstalledCallback_h
6018a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu
6118a7eb20d5f2c5ff04fc2bc74824ff92de2cb0a2Andrei Popescu#endif // PLATFORM(ANDROID) && ENABLE(APPLICATION_INSTALLED)
62