1/*
2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
18 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
24 * THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#ifndef QtBuiltinBundlePage_h
28#define QtBuiltinBundlePage_h
29
30#include "JSObjectRef.h"
31#include "WKBundlePage.h"
32#include "WKBundleScriptWorld.h"
33
34namespace WebKit {
35
36class QtBuiltinBundle;
37
38class QtBuiltinBundlePage {
39public:
40    QtBuiltinBundlePage(QtBuiltinBundle*, WKBundlePageRef);
41    ~QtBuiltinBundlePage();
42
43    WKBundlePageRef page() const { return m_page; }
44
45    // Loader Client.
46    static void didClearWindowForFrame(WKBundlePageRef, WKBundleFrameRef, WKBundleScriptWorldRef, const void*);
47
48    void didClearWindowForFrame(WKBundleFrameRef, WKBundleScriptWorldRef);
49
50    void postMessageFromNavigatorQtObject(WKStringRef message);
51    void didReceiveMessageToNavigatorQtObject(WKStringRef message);
52
53    bool navigatorQtObjectEnabled() const { return m_navigatorQtObjectEnabled; }
54    void setNavigatorQtObjectEnabled(bool);
55
56private:
57    void registerNavigatorQtObject(JSGlobalContextRef);
58
59    static JSClassRef navigatorQtObjectClass();
60
61    QtBuiltinBundle* m_bundle;
62    WKBundlePageRef m_page;
63    JSObjectRef m_navigatorQtObject;
64    bool m_navigatorQtObjectEnabled;
65};
66
67} // namespace WebKit
68
69#endif // QtBuiltinBundlePage_h
70