Home | History | Annotate | Download | only in UIProcess
      1 /*
      2  * Copyright (C) 2010, 2011 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 WebUIClient_h
     27 #define WebUIClient_h
     28 
     29 #include "APIClient.h"
     30 #include "WKPage.h"
     31 #include "WebEvent.h"
     32 #include "WebOpenPanelParameters.h"
     33 #include <wtf/Forward.h>
     34 #include <wtf/PassRefPtr.h>
     35 
     36 namespace WebCore {
     37     class FloatRect;
     38     class IntSize;
     39     struct WindowFeatures;
     40 }
     41 
     42 namespace WebKit {
     43 
     44 class APIObject;
     45 class GeolocationPermissionRequestProxy;
     46 class NativeWebKeyboardEvent;
     47 class WebData;
     48 class WebFrameProxy;
     49 class WebPageProxy;
     50 class WebSecurityOrigin;
     51 class WebOpenPanelResultListenerProxy;
     52 
     53 class WebUIClient : public APIClient<WKPageUIClient> {
     54 public:
     55     PassRefPtr<WebPageProxy> createNewPage(WebPageProxy*, const WebCore::WindowFeatures&, WebEvent::Modifiers, WebMouseEvent::Button);
     56     void showPage(WebPageProxy*);
     57     void close(WebPageProxy*);
     58 
     59     void takeFocus(WebPageProxy*, WKFocusDirection);
     60     void focus(WebPageProxy*);
     61     void unfocus(WebPageProxy*);
     62 
     63     void runJavaScriptAlert(WebPageProxy*, const String&, WebFrameProxy*);
     64     bool runJavaScriptConfirm(WebPageProxy*, const String&, WebFrameProxy*);
     65     String runJavaScriptPrompt(WebPageProxy*, const String&, const String&, WebFrameProxy*);
     66 
     67     void setStatusText(WebPageProxy*, const String&);
     68     void mouseDidMoveOverElement(WebPageProxy*, WebEvent::Modifiers, APIObject*);
     69     void missingPluginButtonClicked(WebPageProxy*, const String& mimeType, const String& url, const String& pluginsPageURL);
     70 
     71     bool implementsDidNotHandleKeyEvent() const;
     72     void didNotHandleKeyEvent(WebPageProxy*, const NativeWebKeyboardEvent&);
     73 
     74     bool toolbarsAreVisible(WebPageProxy*);
     75     void setToolbarsAreVisible(WebPageProxy*, bool);
     76     bool menuBarIsVisible(WebPageProxy*);
     77     void setMenuBarIsVisible(WebPageProxy*, bool);
     78     bool statusBarIsVisible(WebPageProxy*);
     79     void setStatusBarIsVisible(WebPageProxy*, bool);
     80     bool isResizable(WebPageProxy*);
     81     void setIsResizable(WebPageProxy*, bool);
     82 
     83     void setWindowFrame(WebPageProxy*, const WebCore::FloatRect&);
     84     WebCore::FloatRect windowFrame(WebPageProxy*);
     85 
     86     bool canRunBeforeUnloadConfirmPanel() const;
     87     bool runBeforeUnloadConfirmPanel(WebPageProxy*, const String&, WebFrameProxy*);
     88 
     89     void didDraw(WebPageProxy*);
     90     void pageDidScroll(WebPageProxy*);
     91 
     92     unsigned long long exceededDatabaseQuota(WebPageProxy*, WebFrameProxy*, WebSecurityOrigin*, const String& databaseName, const String& databaseDisplayName, unsigned long long currentQuota, unsigned long long currentUsage, unsigned long long expectedUsage);
     93 
     94     bool runOpenPanel(WebPageProxy*, WebFrameProxy*, const WebOpenPanelParameters::Data&, WebOpenPanelResultListenerProxy*);
     95     bool decidePolicyForGeolocationPermissionRequest(WebPageProxy*, WebFrameProxy*, WebSecurityOrigin*, GeolocationPermissionRequestProxy*);
     96 
     97     // Printing.
     98     float headerHeight(WebPageProxy*, WebFrameProxy*);
     99     float footerHeight(WebPageProxy*, WebFrameProxy*);
    100     void drawHeader(WebPageProxy*, WebFrameProxy*, const WebCore::FloatRect&);
    101     void drawFooter(WebPageProxy*, WebFrameProxy*, const WebCore::FloatRect&);
    102     void printFrame(WebPageProxy*, WebFrameProxy*);
    103 
    104     bool canRunModal() const;
    105     void runModal(WebPageProxy*);
    106 
    107     void didCompleteRubberBandForMainFrame(WebPageProxy*, const WebCore::IntSize&);
    108 
    109     void saveDataToFileInDownloadsFolder(WebPageProxy*, const String& suggestedFilename, const String& mimeType, const String& originatingURLString, WebData*);
    110 };
    111 
    112 } // namespace WebKit
    113 
    114 #endif // WebUIClient_h
    115