WebKit/chromium/src/ChromeClientImpl.h
changeset 0 4f2f89ce4247
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     1 /*
       
     2  * Copyright (C) 2009 Google 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 are
       
     6  * met:
       
     7  *
       
     8  *     * Redistributions of source code must retain the above copyright
       
     9  * notice, this list of conditions and the following disclaimer.
       
    10  *     * Redistributions in binary form must reproduce the above
       
    11  * copyright notice, this list of conditions and the following disclaimer
       
    12  * in the documentation and/or other materials provided with the
       
    13  * distribution.
       
    14  *     * Neither the name of Google Inc. nor the names of its
       
    15  * contributors may be used to endorse or promote products derived from
       
    16  * this software without specific prior written permission.
       
    17  *
       
    18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
       
    19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
       
    20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
       
    21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
       
    22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
       
    23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
       
    24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
       
    25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
       
    26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
       
    27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
       
    28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
       
    29  */
       
    30 
       
    31 #ifndef ChromeClientImpl_h
       
    32 #define ChromeClientImpl_h
       
    33 
       
    34 #include "ChromeClientChromium.h"
       
    35 
       
    36 namespace WebCore {
       
    37 class AccessibilityObject;
       
    38 class FileChooser;
       
    39 class HTMLParserQuirks;
       
    40 class PopupContainer;
       
    41 class SecurityOrigin;
       
    42 struct WindowFeatures;
       
    43 }
       
    44 
       
    45 namespace WebKit {
       
    46 class WebViewImpl;
       
    47 struct WebCursorInfo;
       
    48 struct WebPopupMenuInfo;
       
    49 
       
    50 // Handles window-level notifications from WebCore on behalf of a WebView.
       
    51 class ChromeClientImpl : public WebCore::ChromeClientChromium {
       
    52 public:
       
    53     explicit ChromeClientImpl(WebViewImpl* webView);
       
    54     virtual ~ChromeClientImpl();
       
    55 
       
    56     WebViewImpl* webView() const { return m_webView; }
       
    57 
       
    58     // ChromeClient methods:
       
    59     virtual void chromeDestroyed();
       
    60     virtual void setWindowRect(const WebCore::FloatRect&);
       
    61     virtual WebCore::FloatRect windowRect();
       
    62     virtual WebCore::FloatRect pageRect();
       
    63     virtual float scaleFactor();
       
    64     virtual void focus();
       
    65     virtual void unfocus();
       
    66     virtual bool canTakeFocus(WebCore::FocusDirection);
       
    67     virtual void takeFocus(WebCore::FocusDirection);
       
    68     virtual void focusedNodeChanged(WebCore::Node*);
       
    69     virtual WebCore::Page* createWindow(
       
    70         WebCore::Frame*, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&);
       
    71     virtual void show();
       
    72     virtual bool canRunModal();
       
    73     virtual void runModal();
       
    74     virtual void setToolbarsVisible(bool);
       
    75     virtual bool toolbarsVisible();
       
    76     virtual void setStatusbarVisible(bool);
       
    77     virtual bool statusbarVisible();
       
    78     virtual void setScrollbarsVisible(bool);
       
    79     virtual bool scrollbarsVisible();
       
    80     virtual void setMenubarVisible(bool);
       
    81     virtual bool menubarVisible();
       
    82     virtual void setResizable(bool);
       
    83     virtual void addMessageToConsole(
       
    84         WebCore::MessageSource, WebCore::MessageType, WebCore::MessageLevel,
       
    85         const WebCore::String& message, unsigned lineNumber,
       
    86         const WebCore::String& sourceID);
       
    87     virtual bool canRunBeforeUnloadConfirmPanel();
       
    88     virtual bool runBeforeUnloadConfirmPanel(
       
    89         const WebCore::String& message, WebCore::Frame*);
       
    90     virtual void closeWindowSoon();
       
    91     virtual void runJavaScriptAlert(WebCore::Frame*, const WebCore::String&);
       
    92     virtual bool runJavaScriptConfirm(WebCore::Frame*, const WebCore::String&);
       
    93     virtual bool runJavaScriptPrompt(
       
    94         WebCore::Frame*, const WebCore::String& message,
       
    95         const WebCore::String& defaultValue, WebCore::String& result);
       
    96     virtual void setStatusbarText(const WebCore::String& message);
       
    97     virtual bool shouldInterruptJavaScript();
       
    98     virtual bool tabsToLinks() const;
       
    99     virtual WebCore::IntRect windowResizerRect() const;
       
   100     virtual void invalidateWindow(const WebCore::IntRect&, bool);
       
   101     virtual void invalidateContentsAndWindow(const WebCore::IntRect&, bool);
       
   102     virtual void invalidateContentsForSlowScroll(const WebCore::IntRect&, bool);
       
   103     virtual void scroll(
       
   104         const WebCore::IntSize& scrollDelta, const WebCore::IntRect& rectToScroll,
       
   105         const WebCore::IntRect& clipRect);
       
   106     virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) const;
       
   107     virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) const;
       
   108     virtual PlatformPageClient platformPageClient() const { return 0; }
       
   109     virtual void contentsSizeChanged(WebCore::Frame*, const WebCore::IntSize&) const;
       
   110     virtual void scrollRectIntoView(
       
   111         const WebCore::IntRect&, const WebCore::ScrollView*) const { }
       
   112     virtual void scrollbarsModeDidChange() const;
       
   113     virtual void mouseDidMoveOverElement(
       
   114         const WebCore::HitTestResult& result, unsigned modifierFlags);
       
   115     virtual void setToolTip(const WebCore::String& tooltipText, WebCore::TextDirection);
       
   116     virtual void print(WebCore::Frame*);
       
   117     virtual void exceededDatabaseQuota(
       
   118         WebCore::Frame*, const WebCore::String& databaseName);
       
   119 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
       
   120     virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
       
   121 #endif
       
   122 #if ENABLE(NOTIFICATIONS)
       
   123     virtual WebCore::NotificationPresenter* notificationPresenter() const;
       
   124 #endif
       
   125     virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*);
       
   126     virtual void cancelGeolocationPermissionRequestForFrame(WebCore::Frame*, WebCore::Geolocation*);
       
   127     virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>);
       
   128     virtual void chooseIconForFiles(const Vector<WebCore::String>&, WebCore::FileChooser*);
       
   129     virtual void setCursor(const WebCore::Cursor&) { }
       
   130     virtual void formStateDidChange(const WebCore::Node*);
       
   131     virtual PassOwnPtr<WebCore::HTMLParserQuirks> createHTMLParserQuirks() { return 0; }
       
   132 #if ENABLE(TOUCH_EVENTS)
       
   133     // FIXME: All touch events are forwarded regardless of whether or not they are needed.
       
   134     virtual void needTouchEvents(bool needTouchEvents) { }
       
   135 #endif
       
   136 
       
   137 #if USE(ACCELERATED_COMPOSITING)
       
   138     // Pass 0 as the GraphicsLayer to detatch the root layer.
       
   139     virtual void attachRootGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*);
       
   140 
       
   141     // Sets a flag to specify that the next time content is drawn to the window,
       
   142     // the changes appear on the screen in synchrony with updates to GraphicsLayers.
       
   143     virtual void setNeedsOneShotDrawingSynchronization() { }
       
   144 
       
   145     // Sets a flag to specify that the view needs to be updated, so we need
       
   146     // to do an eager layout before the drawing.
       
   147     virtual void scheduleCompositingLayerSync();
       
   148 
       
   149     virtual PassOwnPtr<WebCore::GLES2Context> getOnscreenGLES2Context();
       
   150     virtual PassOwnPtr<WebCore::GLES2Context> getOffscreenGLES2Context();
       
   151 #endif
       
   152 
       
   153     virtual bool supportsFullscreenForNode(const WebCore::Node*);
       
   154     virtual void enterFullscreenForNode(WebCore::Node*);
       
   155     virtual void exitFullscreenForNode(WebCore::Node*);
       
   156 
       
   157     // ChromeClientChromium methods:
       
   158     virtual void popupOpened(WebCore::PopupContainer* popupContainer,
       
   159                              const WebCore::IntRect& bounds,
       
   160                              bool handleExternally);
       
   161     virtual void popupClosed(WebCore::PopupContainer* popupContainer);
       
   162     virtual void didChangeAccessibilityObjectState(WebCore::AccessibilityObject*);
       
   163 
       
   164     // ChromeClientImpl:
       
   165     void setCursor(const WebCursorInfo& cursor);
       
   166     void setCursorForPlugin(const WebCursorInfo& cursor);
       
   167 
       
   168 private:
       
   169     void getPopupMenuInfo(WebCore::PopupContainer*, WebPopupMenuInfo*);
       
   170 
       
   171     WebViewImpl* m_webView;  // weak pointer
       
   172     bool m_toolbarsVisible;
       
   173     bool m_statusbarVisible;
       
   174     bool m_scrollbarsVisible;
       
   175     bool m_menubarVisible;
       
   176     bool m_resizable;
       
   177 };
       
   178 
       
   179 } // namespace WebKit
       
   180 
       
   181 #endif