| 1 | /* |
| 2 | * Copyright (C) 2014 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 | #pragma once |
| 27 | |
| 28 | #include "WebEvent.h" |
| 29 | #include <JavaScriptCore/ConsoleTypes.h> |
| 30 | |
| 31 | namespace WebCore { |
| 32 | class HitTestResult; |
| 33 | } |
| 34 | |
| 35 | namespace WebKit { |
| 36 | class InjectedBundleNodeHandle; |
| 37 | class WebFrame; |
| 38 | class WebPage; |
| 39 | } |
| 40 | |
| 41 | namespace API { |
| 42 | |
| 43 | class Object; |
| 44 | class SecurityOrigin; |
| 45 | |
| 46 | namespace InjectedBundle { |
| 47 | |
| 48 | class PageUIClient { |
| 49 | WTF_MAKE_FAST_ALLOCATED; |
| 50 | public: |
| 51 | virtual ~PageUIClient() { } |
| 52 | |
| 53 | virtual void willAddMessageToConsole(WebKit::WebPage*, JSC::MessageSource, JSC::MessageLevel, const WTF::String& message, unsigned lineNumber, unsigned columnNumber, const WTF::String& sourceID) { UNUSED_PARAM(message); UNUSED_PARAM(lineNumber); UNUSED_PARAM(columnNumber); UNUSED_PARAM(sourceID); } |
| 54 | virtual void willSetStatusbarText(WebKit::WebPage*, const WTF::String&) { } |
| 55 | virtual void willRunJavaScriptAlert(WebKit::WebPage*, const WTF::String&, WebKit::WebFrame*) { } |
| 56 | virtual void willRunJavaScriptConfirm(WebKit::WebPage*, const WTF::String&, WebKit::WebFrame*) { } |
| 57 | virtual void willRunJavaScriptPrompt(WebKit::WebPage*, const WTF::String&, const WTF::String&, WebKit::WebFrame*) { } |
| 58 | virtual void mouseDidMoveOverElement(WebKit::WebPage*, const WebCore::HitTestResult&, OptionSet<WebKit::WebEvent::Modifier>, RefPtr<API::Object>& userData) { UNUSED_PARAM(userData); } |
| 59 | virtual void pageDidScroll(WebKit::WebPage*) { } |
| 60 | |
| 61 | virtual WTF::String shouldGenerateFileForUpload(WebKit::WebPage*, const WTF::String& originalFilePath) { UNUSED_PARAM(originalFilePath); return WTF::String(); } |
| 62 | virtual WTF::String generateFileForUpload(WebKit::WebPage*, const WTF::String& originalFilePath) { UNUSED_PARAM(originalFilePath); return emptyString(); } |
| 63 | |
| 64 | enum class UIElementVisibility { |
| 65 | Unknown, |
| 66 | Visible, |
| 67 | Hidden, |
| 68 | }; |
| 69 | |
| 70 | virtual UIElementVisibility statusBarIsVisible(WebKit::WebPage*) { return UIElementVisibility::Unknown; } |
| 71 | virtual UIElementVisibility (WebKit::WebPage*) { return UIElementVisibility::Unknown; } |
| 72 | virtual UIElementVisibility toolbarsAreVisible(WebKit::WebPage*) { return UIElementVisibility::Unknown; } |
| 73 | |
| 74 | virtual bool didReachApplicationCacheOriginQuota(WebKit::WebPage*, SecurityOrigin*, int64_t totalBytesNeeded) { UNUSED_PARAM(totalBytesNeeded); return false; } |
| 75 | virtual uint64_t didExceedDatabaseQuota(WebKit::WebPage*, SecurityOrigin*, const WTF::String& databaseName, const WTF::String& databaseDisplayName, uint64_t currentQuotaBytes, uint64_t currentOriginUsageBytes, uint64_t currentDatabaseUsageBytes, uint64_t expectedUsageBytes) |
| 76 | { |
| 77 | UNUSED_PARAM(databaseName); |
| 78 | UNUSED_PARAM(databaseDisplayName); |
| 79 | UNUSED_PARAM(currentQuotaBytes); |
| 80 | UNUSED_PARAM(currentOriginUsageBytes); |
| 81 | UNUSED_PARAM(currentDatabaseUsageBytes); |
| 82 | UNUSED_PARAM(expectedUsageBytes); |
| 83 | return 0; |
| 84 | } |
| 85 | |
| 86 | virtual WTF::String plugInStartLabelTitle(const WTF::String& mimeType) const { UNUSED_PARAM(mimeType); return emptyString(); } |
| 87 | virtual WTF::String plugInStartLabelSubtitle(const WTF::String& mimeType) const { UNUSED_PARAM(mimeType); return emptyString(); } |
| 88 | virtual WTF::String () const { return emptyString(); } |
| 89 | virtual WTF::String () const { return emptyString(); } |
| 90 | |
| 91 | virtual void didClickAutoFillButton(WebKit::WebPage&, WebKit::InjectedBundleNodeHandle&, RefPtr<API::Object>&) { } |
| 92 | |
| 93 | virtual void didResignInputElementStrongPasswordAppearance(WebKit::WebPage&, WebKit::InjectedBundleNodeHandle&, RefPtr<API::Object>&) { }; |
| 94 | }; |
| 95 | |
| 96 | } // namespace InjectedBundle |
| 97 | |
| 98 | } // namespace API |
| 99 | |