1/*
2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 *    notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 *    notice, this list of conditions and the following disclaimer in the
11 *    documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#ifndef InjectedBundlePageUIClient_h
27#define InjectedBundlePageUIClient_h
28
29#include "APIClient.h"
30#include "APIInjectedBundlePageUIClient.h"
31#include "WKBundlePage.h"
32#include "WebEvent.h"
33#include <WebCore/RenderSnapshottedPlugIn.h>
34#include <wtf/Forward.h>
35
36namespace API {
37class Object;
38
39template<> struct ClientTraits<WKBundlePageUIClientBase> {
40    typedef std::tuple<WKBundlePageUIClientV0, WKBundlePageUIClientV1, WKBundlePageUIClientV2> Versions;
41};
42}
43
44namespace WebKit {
45
46class InjectedBundlePageUIClient : public API::Client<WKBundlePageUIClientBase>, public API::InjectedBundle::PageUIClient {
47public:
48    explicit InjectedBundlePageUIClient(const WKBundlePageUIClientBase*);
49
50    void willAddMessageToConsole(WebPage*, const String& message, int32_t lineNumber) override;
51    void willSetStatusbarText(WebPage*, const String&) override;
52    void willRunJavaScriptAlert(WebPage*, const String&, WebFrame*) override;
53    void willRunJavaScriptConfirm(WebPage*, const String&, WebFrame*) override;
54    void willRunJavaScriptPrompt(WebPage*, const String&, const String&, WebFrame*) override;
55    void mouseDidMoveOverElement(WebPage*, const WebCore::HitTestResult&, WebEvent::Modifiers, RefPtr<API::Object>& userData) override;
56    void pageDidScroll(WebPage*) override;
57
58    String shouldGenerateFileForUpload(WebPage*, const String& originalFilePath) override;
59    String generateFileForUpload(WebPage*, const String& originalFilePath) override;
60
61    UIElementVisibility statusBarIsVisible(WebPage*) override;
62    UIElementVisibility menuBarIsVisible(WebPage*) override;
63    UIElementVisibility toolbarsAreVisible(WebPage*) override;
64
65    bool didReachApplicationCacheOriginQuota(WebPage*, WebSecurityOrigin*, int64_t totalBytesNeeded) override;
66    uint64_t didExceedDatabaseQuota(WebPage*, WebSecurityOrigin*, const String& databaseName, const String& databaseDisplayName, uint64_t currentQuotaBytes, uint64_t currentOriginUsageBytes, uint64_t currentDatabaseUsageBytes, uint64_t expectedUsageBytes) override;
67
68    String plugInStartLabelTitle(const String& mimeType) const override;
69    String plugInStartLabelSubtitle(const String& mimeType) const override;
70    String plugInExtraStyleSheet() const override;
71    String plugInExtraScript() const override;
72};
73
74} // namespace WebKit
75
76#endif // InjectedBundlePageUIClient_h
77