Home | History | Annotate | Download | only in WebCoreSupport
      1 /*
      2  * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
      3  * Copyright (C) 2008 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  *
      9  * 1.  Redistributions of source code must retain the above copyright
     10  *     notice, this list of conditions and the following disclaimer.
     11  * 2.  Redistributions in binary form must reproduce the above copyright
     12  *     notice, this list of conditions and the following disclaimer in the
     13  *     documentation and/or other materials provided with the distribution.
     14  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
     15  *     its contributors may be used to endorse or promote products derived
     16  *     from this software without specific prior written permission.
     17  *
     18  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
     19  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     20  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     21  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
     22  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     24  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
     25  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     27  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     28  */
     29 
     30 #import <WebCore/ChromeClient.h>
     31 #import <WebCore/FocusDirection.h>
     32 #import <wtf/Forward.h>
     33 
     34 @class WebView;
     35 
     36 class WebChromeClient : public WebCore::ChromeClient {
     37 public:
     38     WebChromeClient(WebView *webView);
     39     WebView *webView() { return m_webView; }
     40 
     41     virtual void chromeDestroyed();
     42 
     43     virtual void setWindowRect(const WebCore::FloatRect&);
     44     virtual WebCore::FloatRect windowRect();
     45 
     46     virtual WebCore::FloatRect pageRect();
     47 
     48     virtual float scaleFactor();
     49 
     50     virtual void focus();
     51     virtual void unfocus();
     52 
     53     virtual bool canTakeFocus(WebCore::FocusDirection);
     54     virtual void takeFocus(WebCore::FocusDirection);
     55 
     56     virtual void focusedNodeChanged(WebCore::Node*);
     57 
     58     virtual WebCore::Page* createWindow(WebCore::Frame*, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&);
     59     virtual void show();
     60 
     61     virtual bool canRunModal();
     62     virtual void runModal();
     63 
     64     virtual void setToolbarsVisible(bool);
     65     virtual bool toolbarsVisible();
     66 
     67     virtual void setStatusbarVisible(bool);
     68     virtual bool statusbarVisible();
     69 
     70     virtual void setScrollbarsVisible(bool);
     71     virtual bool scrollbarsVisible();
     72 
     73     virtual void setMenubarVisible(bool);
     74     virtual bool menubarVisible();
     75 
     76     virtual void setResizable(bool);
     77 
     78     virtual void addMessageToConsole(WebCore::MessageSource source, WebCore::MessageType type, WebCore::MessageLevel level, const WebCore::String& message, unsigned int lineNumber, const WebCore::String& sourceURL);
     79 
     80     virtual bool canRunBeforeUnloadConfirmPanel();
     81     virtual bool runBeforeUnloadConfirmPanel(const WebCore::String& message, WebCore::Frame* frame);
     82 
     83     virtual void closeWindowSoon();
     84 
     85     virtual void runJavaScriptAlert(WebCore::Frame*, const WebCore::String&);
     86     virtual bool runJavaScriptConfirm(WebCore::Frame*, const WebCore::String&);
     87     virtual bool runJavaScriptPrompt(WebCore::Frame*, const WebCore::String& message, const WebCore::String& defaultValue, WebCore::String& result);
     88     virtual bool shouldInterruptJavaScript();
     89 
     90     virtual bool tabsToLinks() const;
     91 
     92     virtual WebCore::IntRect windowResizerRect() const;
     93 
     94     virtual void repaint(const WebCore::IntRect&, bool contentChanged, bool immediate = false, bool repaintContentOnly = false);
     95     virtual void scroll(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& rectToScroll, const WebCore::IntRect& clipRect);
     96     virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) const;
     97     virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) const;
     98     virtual PlatformPageClient platformPageClient() const;
     99     virtual void contentsSizeChanged(WebCore::Frame*, const WebCore::IntSize&) const;
    100     virtual void scrollRectIntoView(const WebCore::IntRect&, const WebCore::ScrollView*) const;
    101 
    102     virtual void setStatusbarText(const WebCore::String&);
    103 
    104     virtual void scrollbarsModeDidChange() const { }
    105     virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags);
    106 
    107     virtual void setToolTip(const WebCore::String&, WebCore::TextDirection);
    108 
    109     virtual void print(WebCore::Frame*);
    110 #if ENABLE(DATABASE)
    111     virtual void exceededDatabaseQuota(WebCore::Frame*, const WebCore::String& databaseName);
    112 #endif
    113 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
    114     virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
    115 #endif
    116     virtual void populateVisitedLinks();
    117 
    118 #if ENABLE(DASHBOARD_SUPPORT)
    119     virtual void dashboardRegionsChanged();
    120 #endif
    121 
    122     virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>);
    123 
    124     virtual bool setCursor(WebCore::PlatformCursorHandle) { return false; }
    125 
    126     virtual WebCore::FloatRect customHighlightRect(WebCore::Node*, const WebCore::AtomicString& type,
    127         const WebCore::FloatRect& lineRect);
    128     virtual void paintCustomHighlight(WebCore::Node*, const WebCore::AtomicString& type,
    129         const WebCore::FloatRect& boxRect, const WebCore::FloatRect& lineRect,
    130         bool behindText, bool entireLine);
    131 
    132     virtual WebCore::KeyboardUIMode keyboardUIMode();
    133 
    134     virtual NSResponder *firstResponder();
    135     virtual void makeFirstResponder(NSResponder *);
    136 
    137     virtual void willPopUpMenu(NSMenu *);
    138 
    139     virtual bool shouldReplaceWithGeneratedFileForUpload(const WebCore::String& path, WebCore::String &generatedFilename);
    140     virtual WebCore::String generateReplacementFile(const WebCore::String& path);
    141 
    142     virtual void formStateDidChange(const WebCore::Node*);
    143 
    144     virtual void formDidFocus(const WebCore::Node*);
    145     virtual void formDidBlur(const WebCore::Node*);
    146 
    147     virtual PassOwnPtr<WebCore::HTMLParserQuirks> createHTMLParserQuirks() { return 0; }
    148 
    149 #if USE(ACCELERATED_COMPOSITING)
    150     virtual void attachRootGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*);
    151     virtual void setNeedsOneShotDrawingSynchronization();
    152     virtual void scheduleCompositingLayerSync();
    153 #endif
    154 
    155 #if ENABLE(VIDEO)
    156     virtual bool supportsFullscreenForNode(const WebCore::Node*);
    157     virtual void enterFullscreenForNode(WebCore::Node*);
    158     virtual void exitFullscreenForNode(WebCore::Node*);
    159 #endif
    160 
    161     virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*);
    162     virtual void cancelGeolocationPermissionRequestForFrame(WebCore::Frame*) { }
    163 
    164 private:
    165     WebView *m_webView;
    166 };
    167