[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Wed Apr 7 23:29:04 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 8c389759073a9edd6d1171808ef587aa6467f9e6
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 10 18:19:44 2009 +0000

    2009-11-10  Yaar Schnitman  <yaar at chromium.org>
    
            Reviewed by Dimitri Glazkov.
    
            Up-streaming Chromium API src files: ChromeClientImpl...ContextMenuClientImpl
    
            https://bugs.webkit.org/show_bug.cgi?id=31276
    
            * src/ChromeClientImpl.cpp: Added.
            (WebKit::ChromeClientImpl::ChromeClientImpl):
            (WebKit::ChromeClientImpl::~ChromeClientImpl):
            (WebKit::ChromeClientImpl::chromeDestroyed):
            (WebKit::ChromeClientImpl::setWindowRect):
            (WebKit::ChromeClientImpl::windowRect):
            (WebKit::ChromeClientImpl::pageRect):
            (WebKit::ChromeClientImpl::scaleFactor):
            (WebKit::ChromeClientImpl::focus):
            (WebKit::ChromeClientImpl::unfocus):
            (WebKit::ChromeClientImpl::canTakeFocus):
            (WebKit::ChromeClientImpl::takeFocus):
            (WebKit::ChromeClientImpl::focusedNodeChanged):
            (WebKit::ChromeClientImpl::createWindow):
            (WebKit::currentEventShouldCauseBackgroundTab):
            (WebKit::ChromeClientImpl::show):
            (WebKit::ChromeClientImpl::canRunModal):
            (WebKit::ChromeClientImpl::runModal):
            (WebKit::ChromeClientImpl::setToolbarsVisible):
            (WebKit::ChromeClientImpl::toolbarsVisible):
            (WebKit::ChromeClientImpl::setStatusbarVisible):
            (WebKit::ChromeClientImpl::statusbarVisible):
            (WebKit::ChromeClientImpl::setScrollbarsVisible):
            (WebKit::ChromeClientImpl::scrollbarsVisible):
            (WebKit::ChromeClientImpl::setMenubarVisible):
            (WebKit::ChromeClientImpl::menubarVisible):
            (WebKit::ChromeClientImpl::setResizable):
            (WebKit::ChromeClientImpl::addMessageToConsole):
            (WebKit::ChromeClientImpl::canRunBeforeUnloadConfirmPanel):
            (WebKit::ChromeClientImpl::runBeforeUnloadConfirmPanel):
            (WebKit::ChromeClientImpl::closeWindowSoon):
            (WebKit::ChromeClientImpl::runJavaScriptAlert):
            (WebKit::ChromeClientImpl::runJavaScriptConfirm):
            (WebKit::ChromeClientImpl::runJavaScriptPrompt):
            (WebKit::ChromeClientImpl::setStatusbarText):
            (WebKit::ChromeClientImpl::shouldInterruptJavaScript):
            (WebKit::ChromeClientImpl::tabsToLinks):
            (WebKit::ChromeClientImpl::windowResizerRect):
            (WebKit::ChromeClientImpl::repaint):
            (WebKit::ChromeClientImpl::scroll):
            (WebKit::ChromeClientImpl::screenToWindow):
            (WebKit::ChromeClientImpl::windowToScreen):
            (WebKit::ChromeClientImpl::contentsSizeChanged):
            (WebKit::ChromeClientImpl::scrollbarsModeDidChange):
            (WebKit::ChromeClientImpl::mouseDidMoveOverElement):
            (WebKit::ChromeClientImpl::setToolTip):
            (WebKit::ChromeClientImpl::print):
            (WebKit::ChromeClientImpl::exceededDatabaseQuota):
            (WebKit::ChromeClientImpl::reachedMaxAppCacheSize):
            (WebKit::ChromeClientImpl::runOpenPanel):
            (WebKit::ChromeClientImpl::popupOpened):
            (WebKit::ChromeClientImpl::setCursor):
            (WebKit::ChromeClientImpl::setCursorForPlugin):
            (WebKit::ChromeClientImpl::formStateDidChange):
            (WebKit::ChromeClientImpl::getPopupMenuInfo):
            (WebKit::ChromeClientImpl::notificationPresenter):
            * src/ChromeClientImpl.h: Added.
            (WebKit::ChromeClientImpl::webView):
            (WebKit::ChromeClientImpl::platformPageClient):
            (WebKit::ChromeClientImpl::scrollRectIntoView):
            (WebKit::ChromeClientImpl::requestGeolocationPermissionForFrame):
            (WebKit::ChromeClientImpl::setCursor):
            (WebKit::ChromeClientImpl::createHTMLParserQuirks):
            * src/ChromiumBridge.cpp: Added.
            (WebCore::toChromeClientImpl):
            (WebCore::toWebWidgetClient):
            (WebCore::ChromiumBridge::clipboardIsFormatAvailable):
            (WebCore::ChromiumBridge::clipboardReadPlainText):
            (WebCore::ChromiumBridge::clipboardReadHTML):
            (WebCore::ChromiumBridge::clipboardWriteSelection):
            (WebCore::ChromiumBridge::clipboardWritePlainText):
            (WebCore::ChromiumBridge::clipboardWriteURL):
            (WebCore::ChromiumBridge::clipboardWriteImage):
            (WebCore::ChromiumBridge::setCookies):
            (WebCore::ChromiumBridge::cookies):
            (WebCore::ChromiumBridge::rawCookies):
            (WebCore::ChromiumBridge::deleteCookie):
            (WebCore::ChromiumBridge::prefetchDNS):
            (WebCore::ChromiumBridge::fileExists):
            (WebCore::ChromiumBridge::deleteFile):
            (WebCore::ChromiumBridge::deleteEmptyDirectory):
            (WebCore::ChromiumBridge::getFileSize):
            (WebCore::ChromiumBridge::getFileModificationTime):
            (WebCore::ChromiumBridge::directoryName):
            (WebCore::ChromiumBridge::pathByAppendingComponent):
            (WebCore::ChromiumBridge::makeAllDirectories):
            (WebCore::ChromiumBridge::getAbsolutePath):
            (WebCore::ChromiumBridge::isDirectory):
            (WebCore::ChromiumBridge::filePathToURL):
            (WebCore::ChromiumBridge::ensureFontLoaded):
            (WebCore::ChromiumBridge::getFontFamilyForCharacters):
            (WebCore::ChromiumBridge::databaseOpenFile):
            (WebCore::ChromiumBridge::databaseDeleteFile):
            (WebCore::ChromiumBridge::databaseGetFileAttributes):
            (WebCore::ChromiumBridge::databaseGetFileSize):
            (WebCore::ChromiumBridge::signedPublicKeyAndChallengeString):
            (WebCore::ChromiumBridge::computedDefaultLanguage):
            (WebCore::ChromiumBridge::layoutTestMode):
            (WebCore::ChromiumBridge::isSupportedImageMIMEType):
            (WebCore::ChromiumBridge::isSupportedJavaScriptMIMEType):
            (WebCore::ChromiumBridge::isSupportedNonImageMIMEType):
            (WebCore::ChromiumBridge::mimeTypeForExtension):
            (WebCore::ChromiumBridge::mimeTypeFromFile):
            (WebCore::ChromiumBridge::preferredExtensionForMIMEType):
            (WebCore::ChromiumBridge::plugins):
            (WebCore::ChromiumBridge::pluginScriptableObject):
            (WebCore::ChromiumBridge::loadPlatformImageResource):
            (WebCore::ChromiumBridge::sandboxEnabled):
            (WebCore::ChromiumBridge::setSharedTimerFiredFunction):
            (WebCore::ChromiumBridge::setSharedTimerFireTime):
            (WebCore::ChromiumBridge::stopSharedTimer):
            (WebCore::ChromiumBridge::decrementStatsCounter):
            (WebCore::ChromiumBridge::incrementStatsCounter):
            (WebCore::ChromiumBridge::suddenTerminationChanged):
            (WebCore::ChromiumBridge::currentTime):
            (WebCore::ChromiumBridge::paintButton):
            (WebCore::ChromiumBridge::paintMenuList):
            (WebCore::ChromiumBridge::paintScrollbarArrow):
            (WebCore::ChromiumBridge::paintScrollbarThumb):
            (WebCore::ChromiumBridge::paintScrollbarTrack):
            (WebCore::ChromiumBridge::paintTextField):
            (WebCore::ChromiumBridge::paintTrackbar):
            (WebCore::ChromiumBridge::traceEventBegin):
            (WebCore::ChromiumBridge::traceEventEnd):
            (WebCore::ChromiumBridge::visitedLinkHash):
            (WebCore::ChromiumBridge::isLinkVisited):
            (WebCore::ChromiumBridge::notifyJSOutOfMemory):
            (WebCore::ChromiumBridge::memoryUsageMB):
            (WebCore::ChromiumBridge::screenDepth):
            (WebCore::ChromiumBridge::screenDepthPerComponent):
            (WebCore::ChromiumBridge::screenIsMonochrome):
            (WebCore::ChromiumBridge::screenRect):
            (WebCore::ChromiumBridge::screenAvailableRect):
            (WebCore::ChromiumBridge::popupsAllowed):
            (WebCore::ChromiumBridge::widgetSetCursor):
            (WebCore::ChromiumBridge::widgetSetFocus):
            (WebCore::WorkerContextProxy::create):
            * src/ChromiumCurrentTime.cpp: Added.
            (WTF::currentTime):
            * src/ChromiumThreading.cpp: Added.
            (WTF::ChromiumThreading::initializeMainThread):
            (WTF::ChromiumThreading::scheduleDispatchFunctionsOnMainThread):
            * src/ContextMenuClientImpl.cpp: Added.
            (WebKit::urlFromFrame):
            (WebKit::isASingleWord):
            (WebKit::selectMisspelledWord):
            (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems):
            * src/ContextMenuClientImpl.h: Added.
            (WebKit::ContextMenuClientImpl::ContextMenuClientImpl):
            (WebKit::ContextMenuClientImpl::~ContextMenuClientImpl):
            (WebKit::ContextMenuClientImpl::copyImageToClipboard):
            (WebKit::ContextMenuClientImpl::contextMenuDestroyed):
            (WebKit::ContextMenuClientImpl::contextMenuItemSelected):
            (WebKit::ContextMenuClientImpl::downloadURL):
            (WebKit::ContextMenuClientImpl::isSpeaking):
            (WebKit::ContextMenuClientImpl::lookUpInDictionary):
            (WebKit::ContextMenuClientImpl::searchWithGoogle):
            (WebKit::ContextMenuClientImpl::shouldIncludeInspectElementItem):
            (WebKit::ContextMenuClientImpl::speak):
            (WebKit::ContextMenuClientImpl::stopSpeaking):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50741 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index cff3cb5..bc44613 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -2,6 +2,175 @@
 
         Reviewed by Dimitri Glazkov.
 
+        Up-streaming Chromium API src files: ChromeClientImpl...ContextMenuClientImpl
+
+        https://bugs.webkit.org/show_bug.cgi?id=31276
+
+        * src/ChromeClientImpl.cpp: Added.
+        (WebKit::ChromeClientImpl::ChromeClientImpl):
+        (WebKit::ChromeClientImpl::~ChromeClientImpl):
+        (WebKit::ChromeClientImpl::chromeDestroyed):
+        (WebKit::ChromeClientImpl::setWindowRect):
+        (WebKit::ChromeClientImpl::windowRect):
+        (WebKit::ChromeClientImpl::pageRect):
+        (WebKit::ChromeClientImpl::scaleFactor):
+        (WebKit::ChromeClientImpl::focus):
+        (WebKit::ChromeClientImpl::unfocus):
+        (WebKit::ChromeClientImpl::canTakeFocus):
+        (WebKit::ChromeClientImpl::takeFocus):
+        (WebKit::ChromeClientImpl::focusedNodeChanged):
+        (WebKit::ChromeClientImpl::createWindow):
+        (WebKit::currentEventShouldCauseBackgroundTab):
+        (WebKit::ChromeClientImpl::show):
+        (WebKit::ChromeClientImpl::canRunModal):
+        (WebKit::ChromeClientImpl::runModal):
+        (WebKit::ChromeClientImpl::setToolbarsVisible):
+        (WebKit::ChromeClientImpl::toolbarsVisible):
+        (WebKit::ChromeClientImpl::setStatusbarVisible):
+        (WebKit::ChromeClientImpl::statusbarVisible):
+        (WebKit::ChromeClientImpl::setScrollbarsVisible):
+        (WebKit::ChromeClientImpl::scrollbarsVisible):
+        (WebKit::ChromeClientImpl::setMenubarVisible):
+        (WebKit::ChromeClientImpl::menubarVisible):
+        (WebKit::ChromeClientImpl::setResizable):
+        (WebKit::ChromeClientImpl::addMessageToConsole):
+        (WebKit::ChromeClientImpl::canRunBeforeUnloadConfirmPanel):
+        (WebKit::ChromeClientImpl::runBeforeUnloadConfirmPanel):
+        (WebKit::ChromeClientImpl::closeWindowSoon):
+        (WebKit::ChromeClientImpl::runJavaScriptAlert):
+        (WebKit::ChromeClientImpl::runJavaScriptConfirm):
+        (WebKit::ChromeClientImpl::runJavaScriptPrompt):
+        (WebKit::ChromeClientImpl::setStatusbarText):
+        (WebKit::ChromeClientImpl::shouldInterruptJavaScript):
+        (WebKit::ChromeClientImpl::tabsToLinks):
+        (WebKit::ChromeClientImpl::windowResizerRect):
+        (WebKit::ChromeClientImpl::repaint):
+        (WebKit::ChromeClientImpl::scroll):
+        (WebKit::ChromeClientImpl::screenToWindow):
+        (WebKit::ChromeClientImpl::windowToScreen):
+        (WebKit::ChromeClientImpl::contentsSizeChanged):
+        (WebKit::ChromeClientImpl::scrollbarsModeDidChange):
+        (WebKit::ChromeClientImpl::mouseDidMoveOverElement):
+        (WebKit::ChromeClientImpl::setToolTip):
+        (WebKit::ChromeClientImpl::print):
+        (WebKit::ChromeClientImpl::exceededDatabaseQuota):
+        (WebKit::ChromeClientImpl::reachedMaxAppCacheSize):
+        (WebKit::ChromeClientImpl::runOpenPanel):
+        (WebKit::ChromeClientImpl::popupOpened):
+        (WebKit::ChromeClientImpl::setCursor):
+        (WebKit::ChromeClientImpl::setCursorForPlugin):
+        (WebKit::ChromeClientImpl::formStateDidChange):
+        (WebKit::ChromeClientImpl::getPopupMenuInfo):
+        (WebKit::ChromeClientImpl::notificationPresenter):
+        * src/ChromeClientImpl.h: Added.
+        (WebKit::ChromeClientImpl::webView):
+        (WebKit::ChromeClientImpl::platformPageClient):
+        (WebKit::ChromeClientImpl::scrollRectIntoView):
+        (WebKit::ChromeClientImpl::requestGeolocationPermissionForFrame):
+        (WebKit::ChromeClientImpl::setCursor):
+        (WebKit::ChromeClientImpl::createHTMLParserQuirks):
+        * src/ChromiumBridge.cpp: Added.
+        (WebCore::toChromeClientImpl):
+        (WebCore::toWebWidgetClient):
+        (WebCore::ChromiumBridge::clipboardIsFormatAvailable):
+        (WebCore::ChromiumBridge::clipboardReadPlainText):
+        (WebCore::ChromiumBridge::clipboardReadHTML):
+        (WebCore::ChromiumBridge::clipboardWriteSelection):
+        (WebCore::ChromiumBridge::clipboardWritePlainText):
+        (WebCore::ChromiumBridge::clipboardWriteURL):
+        (WebCore::ChromiumBridge::clipboardWriteImage):
+        (WebCore::ChromiumBridge::setCookies):
+        (WebCore::ChromiumBridge::cookies):
+        (WebCore::ChromiumBridge::rawCookies):
+        (WebCore::ChromiumBridge::deleteCookie):
+        (WebCore::ChromiumBridge::prefetchDNS):
+        (WebCore::ChromiumBridge::fileExists):
+        (WebCore::ChromiumBridge::deleteFile):
+        (WebCore::ChromiumBridge::deleteEmptyDirectory):
+        (WebCore::ChromiumBridge::getFileSize):
+        (WebCore::ChromiumBridge::getFileModificationTime):
+        (WebCore::ChromiumBridge::directoryName):
+        (WebCore::ChromiumBridge::pathByAppendingComponent):
+        (WebCore::ChromiumBridge::makeAllDirectories):
+        (WebCore::ChromiumBridge::getAbsolutePath):
+        (WebCore::ChromiumBridge::isDirectory):
+        (WebCore::ChromiumBridge::filePathToURL):
+        (WebCore::ChromiumBridge::ensureFontLoaded):
+        (WebCore::ChromiumBridge::getFontFamilyForCharacters):
+        (WebCore::ChromiumBridge::databaseOpenFile):
+        (WebCore::ChromiumBridge::databaseDeleteFile):
+        (WebCore::ChromiumBridge::databaseGetFileAttributes):
+        (WebCore::ChromiumBridge::databaseGetFileSize):
+        (WebCore::ChromiumBridge::signedPublicKeyAndChallengeString):
+        (WebCore::ChromiumBridge::computedDefaultLanguage):
+        (WebCore::ChromiumBridge::layoutTestMode):
+        (WebCore::ChromiumBridge::isSupportedImageMIMEType):
+        (WebCore::ChromiumBridge::isSupportedJavaScriptMIMEType):
+        (WebCore::ChromiumBridge::isSupportedNonImageMIMEType):
+        (WebCore::ChromiumBridge::mimeTypeForExtension):
+        (WebCore::ChromiumBridge::mimeTypeFromFile):
+        (WebCore::ChromiumBridge::preferredExtensionForMIMEType):
+        (WebCore::ChromiumBridge::plugins):
+        (WebCore::ChromiumBridge::pluginScriptableObject):
+        (WebCore::ChromiumBridge::loadPlatformImageResource):
+        (WebCore::ChromiumBridge::sandboxEnabled):
+        (WebCore::ChromiumBridge::setSharedTimerFiredFunction):
+        (WebCore::ChromiumBridge::setSharedTimerFireTime):
+        (WebCore::ChromiumBridge::stopSharedTimer):
+        (WebCore::ChromiumBridge::decrementStatsCounter):
+        (WebCore::ChromiumBridge::incrementStatsCounter):
+        (WebCore::ChromiumBridge::suddenTerminationChanged):
+        (WebCore::ChromiumBridge::currentTime):
+        (WebCore::ChromiumBridge::paintButton):
+        (WebCore::ChromiumBridge::paintMenuList):
+        (WebCore::ChromiumBridge::paintScrollbarArrow):
+        (WebCore::ChromiumBridge::paintScrollbarThumb):
+        (WebCore::ChromiumBridge::paintScrollbarTrack):
+        (WebCore::ChromiumBridge::paintTextField):
+        (WebCore::ChromiumBridge::paintTrackbar):
+        (WebCore::ChromiumBridge::traceEventBegin):
+        (WebCore::ChromiumBridge::traceEventEnd):
+        (WebCore::ChromiumBridge::visitedLinkHash):
+        (WebCore::ChromiumBridge::isLinkVisited):
+        (WebCore::ChromiumBridge::notifyJSOutOfMemory):
+        (WebCore::ChromiumBridge::memoryUsageMB):
+        (WebCore::ChromiumBridge::screenDepth):
+        (WebCore::ChromiumBridge::screenDepthPerComponent):
+        (WebCore::ChromiumBridge::screenIsMonochrome):
+        (WebCore::ChromiumBridge::screenRect):
+        (WebCore::ChromiumBridge::screenAvailableRect):
+        (WebCore::ChromiumBridge::popupsAllowed):
+        (WebCore::ChromiumBridge::widgetSetCursor):
+        (WebCore::ChromiumBridge::widgetSetFocus):
+        (WebCore::WorkerContextProxy::create):
+        * src/ChromiumCurrentTime.cpp: Added.
+        (WTF::currentTime):
+        * src/ChromiumThreading.cpp: Added.
+        (WTF::ChromiumThreading::initializeMainThread):
+        (WTF::ChromiumThreading::scheduleDispatchFunctionsOnMainThread):
+        * src/ContextMenuClientImpl.cpp: Added.
+        (WebKit::urlFromFrame):
+        (WebKit::isASingleWord):
+        (WebKit::selectMisspelledWord):
+        (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems):
+        * src/ContextMenuClientImpl.h: Added.
+        (WebKit::ContextMenuClientImpl::ContextMenuClientImpl):
+        (WebKit::ContextMenuClientImpl::~ContextMenuClientImpl):
+        (WebKit::ContextMenuClientImpl::copyImageToClipboard):
+        (WebKit::ContextMenuClientImpl::contextMenuDestroyed):
+        (WebKit::ContextMenuClientImpl::contextMenuItemSelected):
+        (WebKit::ContextMenuClientImpl::downloadURL):
+        (WebKit::ContextMenuClientImpl::isSpeaking):
+        (WebKit::ContextMenuClientImpl::lookUpInDictionary):
+        (WebKit::ContextMenuClientImpl::searchWithGoogle):
+        (WebKit::ContextMenuClientImpl::shouldIncludeInspectElementItem):
+        (WebKit::ContextMenuClientImpl::speak):
+        (WebKit::ContextMenuClientImpl::stopSpeaking):
+
+2009-11-10  Yaar Schnitman  <yaar at chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
         Up-streaming Chromium API src files: AppCach...BackForwardListClientImpl
 
         https://bugs.webkit.org/show_bug.cgi?id=31276
diff --git a/WebKit/chromium/src/ChromeClientImpl.cpp b/WebKit/chromium/src/ChromeClientImpl.cpp
new file mode 100644
index 0000000..f816315
--- /dev/null
+++ b/WebKit/chromium/src/ChromeClientImpl.cpp
@@ -0,0 +1,674 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ChromeClientImpl.h"
+
+#include "AccessibilityObject.h"
+#include "AXObjectCache.h"
+#include "CharacterNames.h"
+#include "Console.h"
+#include "Cursor.h"
+#include "DatabaseTracker.h"
+#include "Document.h"
+#include "DocumentLoader.h"
+#include "FileChooser.h"
+#include "FloatRect.h"
+#include "FrameLoadRequest.h"
+#include "FrameView.h"
+#include "HitTestResult.h"
+#include "IntRect.h"
+#include "Node.h"
+#include "NotificationPresenterImpl.h"
+#include "Page.h"
+#include "PopupMenuChromium.h"
+#include "ScriptController.h"
+#if USE(V8)
+#include "V8Proxy.h"
+#endif
+#include "WebAccessibilityObject.h"
+#include "WebConsoleMessage.h"
+#include "WebCursorInfo.h"
+#include "WebFileChooserCompletionImpl.h"
+#include "WebFrameClient.h"
+#include "WebFrameImpl.h"
+#include "WebInputEvent.h"
+#include "WebKit.h"
+#include "WebPopupMenuImpl.h"
+#include "WebPopupMenuInfo.h"
+#include "WebRect.h"
+#include "WebTextDirection.h"
+#include "WebURLRequest.h"
+#include "WebViewClient.h"
+#include "WebViewImpl.h"
+#include "WindowFeatures.h"
+#include "WrappedResourceRequest.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+ChromeClientImpl::ChromeClientImpl(WebViewImpl* webView)
+    : m_webView(webView)
+    , m_toolbarsVisible(true)
+    , m_statusbarVisible(true)
+    , m_scrollbarsVisible(true)
+    , m_menubarVisible(true)
+    , m_resizable(true)
+    , m_ignoreNextSetCursor(false)
+{
+}
+
+ChromeClientImpl::~ChromeClientImpl()
+{
+}
+
+void ChromeClientImpl::chromeDestroyed()
+{
+    // Our lifetime is bound to the WebViewImpl.
+}
+
+void ChromeClientImpl::setWindowRect(const FloatRect& r)
+{
+    if (m_webView->client())
+        m_webView->client()->setWindowRect(IntRect(r));
+}
+
+FloatRect ChromeClientImpl::windowRect()
+{
+    WebRect rect;
+    if (m_webView->client())
+        rect = m_webView->client()->rootWindowRect();
+    else {
+        // These numbers will be fairly wrong. The window's x/y coordinates will
+        // be the top left corner of the screen and the size will be the content
+        // size instead of the window size.
+        rect.width = m_webView->size().width;
+        rect.height = m_webView->size().height;
+    }
+    return FloatRect(rect);
+}
+
+FloatRect ChromeClientImpl::pageRect()
+{
+    // We hide the details of the window's border thickness from the web page by
+    // simple re-using the window position here.  So, from the point-of-view of
+    // the web page, the window has no border.
+    return windowRect();
+}
+
+float ChromeClientImpl::scaleFactor()
+{
+    // This is supposed to return the scale factor of the web page. It looks like
+    // the implementor of the graphics layer is responsible for doing most of the
+    // operations associated with scaling. However, this value is used ins some
+    // cases by WebCore. For example, this is used as a scaling factor in canvas
+    // so that things drawn in it are scaled just like the web page is.
+    //
+    // We don't currently implement scaling, so just return 1.0 (no scaling).
+    return 1.0;
+}
+
+void ChromeClientImpl::focus()
+{
+    if (!m_webView->client())
+        return;
+
+    m_webView->client()->didFocus();
+
+    // If accessibility is enabled, we should notify assistive technology that
+    // the active AccessibilityObject changed.
+    const Frame* frame = m_webView->focusedWebCoreFrame();
+    if (!frame)
+        return;
+
+    Document* doc = frame->document();
+
+    if (doc && doc->axObjectCache()->accessibilityEnabled()) {
+        Node* focusedNode = m_webView->focusedWebCoreNode();
+
+        if (!focusedNode) {
+            // Could not retrieve focused Node.
+            return;
+        }
+
+        // Retrieve the focused AccessibilityObject.
+        AccessibilityObject* focusedAccObj =
+            doc->axObjectCache()->getOrCreate(focusedNode->renderer());
+
+        // Alert assistive technology that focus changed.
+        if (focusedAccObj)
+            m_webView->client()->focusAccessibilityObject(WebAccessibilityObject(focusedAccObj));
+    }
+}
+
+void ChromeClientImpl::unfocus()
+{
+    if (m_webView->client())
+        m_webView->client()->didBlur();
+}
+
+bool ChromeClientImpl::canTakeFocus(FocusDirection)
+{
+    // For now the browser can always take focus if we're not running layout
+    // tests.
+    return !layoutTestMode();
+}
+
+void ChromeClientImpl::takeFocus(FocusDirection direction)
+{
+    if (!m_webView->client())
+        return;
+    if (direction == FocusDirectionBackward)
+        m_webView->client()->focusPrevious();
+    else
+        m_webView->client()->focusNext();
+}
+
+void ChromeClientImpl::focusedNodeChanged(Node* node)
+{
+    WebURL focus_url;
+    if (node && node->isLink()) {
+        // This HitTestResult hack is the easiest way to get a link URL out of a
+        // WebCore::Node.
+        HitTestResult hit_test(IntPoint(0, 0));
+        // This cast must be valid because of the isLink() check.
+        hit_test.setURLElement(reinterpret_cast<Element*>(node));
+        if (hit_test.isLiveLink())
+            focus_url = hit_test.absoluteLinkURL();
+    }
+    m_webView->client()->setKeyboardFocusURL(focus_url);
+}
+
+Page* ChromeClientImpl::createWindow(
+    Frame* frame, const FrameLoadRequest& r, const WindowFeatures& features)
+{
+    if (!m_webView->client())
+        return 0;
+
+    WebViewImpl* newView = static_cast<WebViewImpl*>(
+        m_webView->client()->createView(WebFrameImpl::fromFrame(frame)));
+    if (!newView)
+        return 0;
+
+    // The request is empty when we are just being asked to open a blank window.
+    // This corresponds to window.open(""), for example.
+    if (!r.resourceRequest().isEmpty()) {
+        WrappedResourceRequest request(r.resourceRequest());
+        newView->mainFrame()->loadRequest(request);
+    }
+
+    return newView->page();
+}
+
+static inline bool currentEventShouldCauseBackgroundTab(const WebInputEvent* inputEvent)
+{
+    if (!inputEvent)
+        return false;
+
+    if (inputEvent->type != WebInputEvent::MouseUp)
+        return false;
+
+    const WebMouseEvent* mouseEvent = static_cast<const WebMouseEvent*>(inputEvent);
+
+    WebNavigationPolicy policy;
+    unsigned short buttonNumber;
+    switch (mouseEvent->button) {
+    case WebMouseEvent::ButtonLeft:
+        buttonNumber = 0;
+        break;
+    case WebMouseEvent::ButtonMiddle:
+        buttonNumber = 1;
+        break;
+    case WebMouseEvent::ButtonRight:
+        buttonNumber = 2;
+        break;
+    default:
+        return false;
+    }
+    bool ctrl = mouseEvent->modifiers & WebMouseEvent::ControlKey;
+    bool shift = mouseEvent->modifiers & WebMouseEvent::ShiftKey;
+    bool alt = mouseEvent->modifiers & WebMouseEvent::AltKey;
+    bool meta = mouseEvent->modifiers & WebMouseEvent::MetaKey;
+
+    if (!WebViewImpl::navigationPolicyFromMouseEvent(buttonNumber, ctrl, shift, alt, meta, &policy))
+        return false;
+
+    return policy == WebNavigationPolicyNewBackgroundTab;
+}
+
+void ChromeClientImpl::show()
+{
+    if (!m_webView->client())
+        return;
+
+    // If our default configuration was modified by a script or wasn't
+    // created by a user gesture, then show as a popup. Else, let this
+    // new window be opened as a toplevel window.
+    bool asPopup = !m_toolbarsVisible
+        || !m_statusbarVisible
+        || !m_scrollbarsVisible
+        || !m_menubarVisible
+        || !m_resizable;
+
+    WebNavigationPolicy policy = WebNavigationPolicyNewForegroundTab;
+    if (asPopup)
+        policy = WebNavigationPolicyNewPopup;
+    if (currentEventShouldCauseBackgroundTab(WebViewImpl::currentInputEvent()))
+        policy = WebNavigationPolicyNewBackgroundTab;
+
+    m_webView->client()->show(policy);
+}
+
+bool ChromeClientImpl::canRunModal()
+{
+    return !!m_webView->client();
+}
+
+void ChromeClientImpl::runModal()
+{
+    if (m_webView->client())
+        m_webView->client()->runModal();
+}
+
+void ChromeClientImpl::setToolbarsVisible(bool value)
+{
+    m_toolbarsVisible = value;
+}
+
+bool ChromeClientImpl::toolbarsVisible()
+{
+    return m_toolbarsVisible;
+}
+
+void ChromeClientImpl::setStatusbarVisible(bool value)
+{
+    m_statusbarVisible = value;
+}
+
+bool ChromeClientImpl::statusbarVisible()
+{
+    return m_statusbarVisible;
+}
+
+void ChromeClientImpl::setScrollbarsVisible(bool value)
+{
+    m_scrollbarsVisible = value;
+    WebFrameImpl* web_frame = static_cast<WebFrameImpl*>(m_webView->mainFrame());
+    if (web_frame)
+        web_frame->setAllowsScrolling(value);
+}
+
+bool ChromeClientImpl::scrollbarsVisible()
+{
+    return m_scrollbarsVisible;
+}
+
+void ChromeClientImpl::setMenubarVisible(bool value)
+{
+    m_menubarVisible = value;
+}
+
+bool ChromeClientImpl::menubarVisible()
+{
+    return m_menubarVisible;
+}
+
+void ChromeClientImpl::setResizable(bool value)
+{
+    m_resizable = value;
+}
+
+void ChromeClientImpl::addMessageToConsole(MessageSource source,
+                                           MessageType type,
+                                           MessageLevel level,
+                                           const String& message,
+                                           unsigned lineNumber,
+                                           const String& sourceID)
+{
+    if (m_webView->client()) {
+        m_webView->client()->didAddMessageToConsole(
+            WebConsoleMessage(static_cast<WebConsoleMessage::Level>(level), message),
+            sourceID,
+            lineNumber);
+    }
+}
+
+bool ChromeClientImpl::canRunBeforeUnloadConfirmPanel()
+{
+    return !!m_webView->client();
+}
+
+bool ChromeClientImpl::runBeforeUnloadConfirmPanel(const String& message, Frame* frame)
+{
+    if (m_webView->client()) {
+        return m_webView->client()->runModalBeforeUnloadDialog(
+            WebFrameImpl::fromFrame(frame), message);
+    }
+    return false;
+}
+
+void ChromeClientImpl::closeWindowSoon()
+{
+    // Make sure this Page can no longer be found by JS.
+    m_webView->page()->setGroupName(String());
+
+    // Make sure that all loading is stopped.  Ensures that JS stops executing!
+    m_webView->mainFrame()->stopLoading();
+
+    if (m_webView->client())
+        m_webView->client()->closeWidgetSoon();
+}
+
+// Although a Frame is passed in, we don't actually use it, since we
+// already know our own m_webView.
+void ChromeClientImpl::runJavaScriptAlert(Frame* frame, const String& message)
+{
+    if (m_webView->client()) {
+#if USE(V8)
+        // Before showing the JavaScript dialog, we give the proxy implementation
+        // a chance to process any pending console messages.
+        V8Proxy::processConsoleMessages();
+#endif
+        m_webView->client()->runModalAlertDialog(
+            WebFrameImpl::fromFrame(frame), message);
+    }
+}
+
+// See comments for runJavaScriptAlert().
+bool ChromeClientImpl::runJavaScriptConfirm(Frame* frame, const String& message)
+{
+    if (m_webView->client()) {
+        return m_webView->client()->runModalConfirmDialog(
+            WebFrameImpl::fromFrame(frame), message);
+    }
+    return false;
+}
+
+// See comments for runJavaScriptAlert().
+bool ChromeClientImpl::runJavaScriptPrompt(Frame* frame,
+                                           const String& message,
+                                           const String& defaultValue,
+                                           String& result)
+{
+    if (m_webView->client()) {
+        WebString actualValue;
+        bool ok = m_webView->client()->runModalPromptDialog(
+            WebFrameImpl::fromFrame(frame),
+            message,
+            defaultValue,
+            &actualValue);
+        if (ok)
+            result = actualValue;
+        return ok;
+    }
+    return false;
+}
+
+void ChromeClientImpl::setStatusbarText(const String& message)
+{
+    if (m_webView->client())
+        m_webView->client()->setStatusText(message);
+}
+
+bool ChromeClientImpl::shouldInterruptJavaScript()
+{
+    // FIXME: implement me
+    return false;
+}
+
+bool ChromeClientImpl::tabsToLinks() const
+{
+    // Returns true if anchors should accept keyboard focus with the tab key.
+    // This method is used in a convoluted fashion by EventHandler::tabsToLinks.
+    // It's a twisted path (self-evident, but more complicated than seems
+    // necessary), but the net result is that returning true from here, on a
+    // platform other than MAC or QT, lets anchors get keyboard focus.
+    return m_webView->tabsToLinks();
+}
+
+IntRect ChromeClientImpl::windowResizerRect() const
+{
+    IntRect result;
+    if (m_webView->client())
+        result = m_webView->client()->windowResizerRect();
+    return result;
+}
+
+void ChromeClientImpl::repaint(
+    const IntRect& paintRect, bool contentChanged, bool immediate,
+    bool repaintContentOnly)
+{
+    // Ignore spurious calls.
+    if (!contentChanged || paintRect.isEmpty())
+        return;
+    if (m_webView->client())
+        m_webView->client()->didInvalidateRect(paintRect);
+}
+
+void ChromeClientImpl::scroll(
+    const IntSize& scrollDelta, const IntRect& scrollRect,
+    const IntRect& clipRect)
+{
+    if (m_webView->client()) {
+        int dx = scrollDelta.width();
+        int dy = scrollDelta.height();
+        m_webView->client()->didScrollRect(dx, dy, clipRect);
+    }
+}
+
+IntPoint ChromeClientImpl::screenToWindow(const IntPoint&) const
+{
+    notImplemented();
+    return IntPoint();
+}
+
+IntRect ChromeClientImpl::windowToScreen(const IntRect& rect) const
+{
+    IntRect screenRect(rect);
+
+    if (m_webView->client()) {
+        WebRect windowRect = m_webView->client()->windowRect();
+        screenRect.move(windowRect.x, windowRect.y);
+    }
+
+    return screenRect;
+}
+
+void ChromeClientImpl::contentsSizeChanged(Frame* frame, const IntSize& size) const
+{
+    WebFrameImpl* webframe = WebFrameImpl::fromFrame(frame);
+    if (webframe->client())
+        webframe->client()->didChangeContentsSize(webframe, size);
+}
+
+void ChromeClientImpl::scrollbarsModeDidChange() const
+{
+}
+
+void ChromeClientImpl::mouseDidMoveOverElement(
+    const HitTestResult& result, unsigned modifierFlags)
+{
+    if (!m_webView->client())
+        return;
+    // Find out if the mouse is over a link, and if so, let our UI know...
+    if (result.isLiveLink() && !result.absoluteLinkURL().string().isEmpty())
+        m_webView->client()->setMouseOverURL(result.absoluteLinkURL());
+    else
+        m_webView->client()->setMouseOverURL(WebURL());
+}
+
+void ChromeClientImpl::setToolTip(const String& tooltipText, TextDirection dir)
+{
+    if (!m_webView->client())
+        return;
+    WebTextDirection textDirection = (dir == RTL) ?
+        WebTextDirectionRightToLeft :
+        WebTextDirectionLeftToRight;
+    m_webView->client()->setToolTipText(
+        tooltipText, textDirection);
+}
+
+void ChromeClientImpl::print(Frame* frame)
+{
+    if (m_webView->client())
+        m_webView->client()->printPage(WebFrameImpl::fromFrame(frame));
+}
+
+void ChromeClientImpl::exceededDatabaseQuota(Frame* frame, const String& databaseName)
+{
+    // set a reasonable quota for now -- 5Mb should be enough for anybody
+    // TODO(dglazkov): this should be configurable
+    SecurityOrigin* origin = frame->document()->securityOrigin();
+    DatabaseTracker::tracker().setQuota(origin, 1024 * 1024 * 5);
+}
+
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+void ChromeClientImpl::reachedMaxAppCacheSize(int64_t spaceNeeded)
+{
+    ASSERT_NOT_REACHED();
+}
+#endif
+
+void ChromeClientImpl::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> fileChooser)
+{
+    WebViewClient* client = m_webView->client();
+    if (!client)
+        return;
+
+    bool multipleFiles = fileChooser->allowsMultipleFiles();
+
+    WebString suggestion;
+    if (fileChooser->filenames().size() > 0)
+        suggestion = fileChooser->filenames()[0];
+
+    WebFileChooserCompletionImpl* chooserCompletion =
+        new WebFileChooserCompletionImpl(fileChooser);
+    bool ok = client->runFileChooser(multipleFiles,
+                                     WebString(),
+                                     suggestion,
+                                     chooserCompletion);
+    if (!ok) {
+        // Choosing failed, so do callback with an empty list.
+        chooserCompletion->didChooseFile(WebVector<WebString>());
+    }
+}
+
+void ChromeClientImpl::popupOpened(PopupContainer* popupContainer,
+                                   const IntRect& bounds,
+                                   bool activatable,
+                                   bool handleExternally)
+{
+    if (!m_webView->client())
+        return;
+
+    WebWidget* webwidget;
+    if (handleExternally) {
+        WebPopupMenuInfo popupInfo;
+        getPopupMenuInfo(popupContainer, &popupInfo);
+        webwidget = m_webView->client()->createPopupMenu(popupInfo);
+    } else
+        webwidget = m_webView->client()->createPopupMenu(activatable);
+
+    static_cast<WebPopupMenuImpl*>(webwidget)->Init(popupContainer, bounds);
+}
+
+void ChromeClientImpl::setCursor(const WebCursorInfo& cursor)
+{
+    if (m_ignoreNextSetCursor) {
+        m_ignoreNextSetCursor = false;
+        return;
+    }
+
+    if (m_webView->client())
+        m_webView->client()->didChangeCursor(cursor);
+}
+
+void ChromeClientImpl::setCursorForPlugin(const WebCursorInfo& cursor)
+{
+    setCursor(cursor);
+
+    // Currently, Widget::setCursor is always called after this function in
+    // EventHandler.cpp and since we don't want that we set a flag indicating
+    // that the next SetCursor call is to be ignored.
+    m_ignoreNextSetCursor = true;
+}
+
+void ChromeClientImpl::formStateDidChange(const Node* node)
+{
+    // The current history item is not updated yet.  That happens lazily when
+    // WebFrame::currentHistoryItem is requested.
+    WebFrameImpl* webframe = WebFrameImpl::fromFrame(node->document()->frame());
+    if (webframe->client())
+        webframe->client()->didUpdateCurrentHistoryItem(webframe);
+}
+
+void ChromeClientImpl::getPopupMenuInfo(PopupContainer* popupContainer,
+                                        WebPopupMenuInfo* info)
+{
+    const Vector<PopupItem*>& inputItems = popupContainer->popupData();
+
+    WebVector<WebPopupMenuInfo::Item> outputItems(inputItems.size());
+
+    for (size_t i = 0; i < inputItems.size(); ++i) {
+        const PopupItem& inputItem = *inputItems[i];
+        WebPopupMenuInfo::Item& outputItem = outputItems[i];
+
+        outputItem.label = inputItem.label;
+        outputItem.enabled = inputItem.enabled;
+
+        switch (inputItem.type) {
+        case PopupItem::TypeOption:
+            outputItem.type = WebPopupMenuInfo::Item::Option;
+            break;
+        case PopupItem::TypeGroup:
+            outputItem.type = WebPopupMenuInfo::Item::Group;
+            break;
+        case PopupItem::TypeSeparator:
+            outputItem.type = WebPopupMenuInfo::Item::Separator;
+            break;
+        default:
+            ASSERT_NOT_REACHED();
+        }
+    }
+
+    info->itemHeight = popupContainer->menuItemHeight();
+    info->selectedIndex = popupContainer->selectedIndex();
+    info->items.swap(outputItems);
+}
+
+#if ENABLE(NOTIFICATIONS)
+NotificationPresenter* ChromeClientImpl::notificationPresenter() const
+{
+    return m_webView->notificationPresenterImpl();
+}
+#endif
+
+} // namespace WebKit
diff --git a/WebKit/chromium/src/ChromeClientImpl.h b/WebKit/chromium/src/ChromeClientImpl.h
new file mode 100644
index 0000000..5a1e9cc
--- /dev/null
+++ b/WebKit/chromium/src/ChromeClientImpl.h
@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ChromeClientImpl_h
+#define ChromeClientImpl_h
+
+#include "ChromeClientChromium.h"
+
+namespace WebCore {
+class HTMLParserQuirks;
+class PopupContainer;
+class SecurityOrigin;
+struct WindowFeatures;
+}
+
+namespace WebKit {
+class WebViewImpl;
+struct WebCursorInfo;
+struct WebPopupMenuInfo;
+
+// Handles window-level notifications from WebCore on behalf of a WebView.
+class ChromeClientImpl : public WebCore::ChromeClientChromium {
+public:
+    explicit ChromeClientImpl(WebViewImpl* webView);
+    virtual ~ChromeClientImpl();
+
+    WebViewImpl* webView() const { return m_webView; }
+
+    // ChromeClient methods:
+    virtual void chromeDestroyed();
+    virtual void setWindowRect(const WebCore::FloatRect&);
+    virtual WebCore::FloatRect windowRect();
+    virtual WebCore::FloatRect pageRect();
+    virtual float scaleFactor();
+    virtual void focus();
+    virtual void unfocus();
+    virtual bool canTakeFocus(WebCore::FocusDirection);
+    virtual void takeFocus(WebCore::FocusDirection);
+    virtual void focusedNodeChanged(WebCore::Node*);
+    virtual WebCore::Page* createWindow(
+        WebCore::Frame*, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&);
+    virtual void show();
+    virtual bool canRunModal();
+    virtual void runModal();
+    virtual void setToolbarsVisible(bool);
+    virtual bool toolbarsVisible();
+    virtual void setStatusbarVisible(bool);
+    virtual bool statusbarVisible();
+    virtual void setScrollbarsVisible(bool);
+    virtual bool scrollbarsVisible();
+    virtual void setMenubarVisible(bool);
+    virtual bool menubarVisible();
+    virtual void setResizable(bool);
+    virtual void addMessageToConsole(
+        WebCore::MessageSource, WebCore::MessageType, WebCore::MessageLevel,
+        const WebCore::String& message, unsigned lineNumber,
+        const WebCore::String& sourceID);
+    virtual bool canRunBeforeUnloadConfirmPanel();
+    virtual bool runBeforeUnloadConfirmPanel(
+        const WebCore::String& message, WebCore::Frame*);
+    virtual void closeWindowSoon();
+    virtual void runJavaScriptAlert(WebCore::Frame*, const WebCore::String&);
+    virtual bool runJavaScriptConfirm(WebCore::Frame*, const WebCore::String&);
+    virtual bool runJavaScriptPrompt(
+        WebCore::Frame*, const WebCore::String& message,
+        const WebCore::String& defaultValue, WebCore::String& result);
+    virtual void setStatusbarText(const WebCore::String& message);
+    virtual bool shouldInterruptJavaScript();
+    virtual bool tabsToLinks() const;
+    virtual WebCore::IntRect windowResizerRect() const;
+    virtual void repaint(
+        const WebCore::IntRect&, bool contentChanged, bool immediate = false,
+        bool repaintContentOnly = false);
+    virtual void scroll(
+        const WebCore::IntSize& scrollDelta, const WebCore::IntRect& rectToScroll,
+        const WebCore::IntRect& clipRect);
+    virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) const;
+    virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) const;
+    virtual PlatformPageClient platformPageClient() const { return 0; }
+    virtual void contentsSizeChanged(WebCore::Frame*, const WebCore::IntSize&) const;
+    virtual void scrollRectIntoView(
+        const WebCore::IntRect&, const WebCore::ScrollView*) const { }
+    virtual void scrollbarsModeDidChange() const;
+    virtual void mouseDidMoveOverElement(
+        const WebCore::HitTestResult& result, unsigned modifierFlags);
+    virtual void setToolTip(const WebCore::String& tooltipText, WebCore::TextDirection);
+    virtual void print(WebCore::Frame*);
+    virtual void exceededDatabaseQuota(
+        WebCore::Frame*, const WebCore::String& databaseName);
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+    virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
+#endif
+#if ENABLE(NOTIFICATIONS)
+    virtual WebCore::NotificationPresenter* notificationPresenter() const;
+#endif
+    virtual void requestGeolocationPermissionForFrame(
+        WebCore::Frame*, WebCore::Geolocation*) { }
+    virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>);
+    virtual bool setCursor(WebCore::PlatformCursorHandle) { return false; }
+    virtual void formStateDidChange(const WebCore::Node*);
+    virtual PassOwnPtr<WebCore::HTMLParserQuirks> createHTMLParserQuirks() { return 0; }
+
+    // ChromeClientChromium methods:
+    virtual void popupOpened(WebCore::PopupContainer* popupContainer,
+                             const WebCore::IntRect& bounds,
+                             bool activatable,
+                             bool handleExternally);
+
+    // ChromeClientImpl:
+    void setCursor(const WebCursorInfo& cursor);
+    void setCursorForPlugin(const WebCursorInfo& cursor);
+
+private:
+    void getPopupMenuInfo(WebCore::PopupContainer*, WebPopupMenuInfo*);
+
+    WebViewImpl* m_webView;  // weak pointer
+    bool m_toolbarsVisible;
+    bool m_statusbarVisible;
+    bool m_scrollbarsVisible;
+    bool m_menubarVisible;
+    bool m_resizable;
+    // Set to true if the next SetCursor is to be ignored.
+    bool m_ignoreNextSetCursor;
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/WebKit/chromium/src/ChromiumBridge.cpp b/WebKit/chromium/src/ChromiumBridge.cpp
new file mode 100644
index 0000000..8d63c5f
--- /dev/null
+++ b/WebKit/chromium/src/ChromiumBridge.cpp
@@ -0,0 +1,689 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ChromiumBridge.h"
+
+#include <googleurl/src/url_util.h>
+
+#include "ChromeClientImpl.h"
+#include "WebClipboard.h"
+#include "WebCookie.h"
+#include "WebCursorInfo.h"
+#include "WebData.h"
+#include "WebFrameClient.h"
+#include "WebFrameImpl.h"
+#include "WebImage.h"
+#include "WebKit.h"
+#include "WebKitClient.h"
+#include "WebMimeRegistry.h"
+#include "WebPluginContainerImpl.h"
+#include "WebPluginListBuilderImpl.h"
+#include "WebScreenInfo.h"
+#include "WebString.h"
+#include "WebURL.h"
+#include "WebVector.h"
+#include "WebViewClient.h"
+#include "WebViewImpl.h"
+#include "WebWorkerClientImpl.h"
+
+#if PLATFORM(WIN_OS)
+#include "WebRect.h"
+#include "WebSandboxSupport.h"
+#include "WebThemeEngine.h"
+#endif
+
+#if PLATFORM(LINUX)
+#include "WebSandboxSupport.h"
+#include "WebFontInfo.h"
+#endif
+
+#if WEBKIT_USING_SKIA
+#include "NativeImageSkia.h"
+#endif
+
+#include "BitmapImage.h"
+#include "Cookie.h"
+#include "FrameView.h"
+#include "GraphicsContext.h"
+#include "KURL.h"
+#include "NotImplemented.h"
+#include "PlatformContextSkia.h"
+#include "PluginData.h"
+#include "Worker.h"
+#include "WorkerContextProxy.h"
+#include <wtf/Assertions.h>
+
+// We are part of the WebKit implementation.
+using namespace WebKit;
+
+namespace WebCore {
+
+static ChromeClientImpl* toChromeClientImpl(Widget* widget)
+{
+    FrameView* view;
+    if (widget->isFrameView())
+        view = static_cast<FrameView*>(widget);
+    else if (widget->parent() && widget->parent()->isFrameView())
+        view = static_cast<FrameView*>(widget->parent());
+    else
+        return 0;
+
+    Page* page = view->frame() ? view->frame()->page() : 0;
+    if (!page)
+        return 0;
+
+    return static_cast<ChromeClientImpl*>(page->chrome()->client());
+}
+
+static WebWidgetClient* toWebWidgetClient(Widget* widget)
+{
+    ChromeClientImpl* chromeClientImpl = toChromeClientImpl(widget);
+    if (!chromeClientImpl || !chromeClientImpl->webView())
+        return 0;
+    return chromeClientImpl->webView()->client();
+}
+
+// Clipboard ------------------------------------------------------------------
+
+bool ChromiumBridge::clipboardIsFormatAvailable(
+    PasteboardPrivate::ClipboardFormat format,
+    PasteboardPrivate::ClipboardBuffer buffer)
+{
+    return webKitClient()->clipboard()->isFormatAvailable(
+        static_cast<WebClipboard::Format>(format),
+        static_cast<WebClipboard::Buffer>(buffer));
+}
+
+String ChromiumBridge::clipboardReadPlainText(
+    PasteboardPrivate::ClipboardBuffer buffer)
+{
+    return webKitClient()->clipboard()->readPlainText(
+        static_cast<WebClipboard::Buffer>(buffer));
+}
+
+void ChromiumBridge::clipboardReadHTML(
+    PasteboardPrivate::ClipboardBuffer buffer,
+    String* htmlText, KURL* sourceURL)
+{
+    WebURL url;
+    *htmlText = webKitClient()->clipboard()->readHTML(
+        static_cast<WebClipboard::Buffer>(buffer), &url);
+    *sourceURL = url;
+}
+
+void ChromiumBridge::clipboardWriteSelection(const String& htmlText,
+                                             const KURL& sourceURL,
+                                             const String& plainText,
+                                             bool writeSmartPaste)
+{
+    webKitClient()->clipboard()->writeHTML(
+        htmlText, sourceURL, plainText, writeSmartPaste);
+}
+
+void ChromiumBridge::clipboardWritePlainText(const String& plainText)
+{
+    webKitClient()->clipboard()->writePlainText(plainText);
+}
+
+void ChromiumBridge::clipboardWriteURL(const KURL& url, const String& title)
+{
+    webKitClient()->clipboard()->writeURL(url, title);
+}
+
+void ChromiumBridge::clipboardWriteImage(NativeImagePtr image,
+                                         const KURL& sourceURL,
+                                         const String& title)
+{
+#if WEBKIT_USING_SKIA
+    WebImage webImage(*image);
+#else
+    WebImage webImage(image);
+#endif
+    webKitClient()->clipboard()->writeImage(webImage, sourceURL, title);
+}
+
+// Cookies --------------------------------------------------------------------
+
+void ChromiumBridge::setCookies(const KURL& url,
+                                const KURL& firstPartyForCookies,
+                                const String& cookie)
+{
+    webKitClient()->setCookies(url, firstPartyForCookies, cookie);
+}
+
+String ChromiumBridge::cookies(const KURL& url,
+                               const KURL& firstPartyForCookies)
+{
+    return webKitClient()->cookies(url, firstPartyForCookies);
+}
+
+bool ChromiumBridge::rawCookies(const KURL& url, const KURL& firstPartyForCookies, Vector<Cookie>* rawCookies)
+{
+    rawCookies->clear();
+    WebVector<WebCookie> webCookies;
+    if (!webKitClient()->rawCookies(url, firstPartyForCookies, &webCookies))
+        return false;
+
+    for (unsigned i = 0; i < webCookies.size(); ++i) {
+        const WebCookie& webCookie = webCookies[i];
+        Cookie cookie(webCookie.name,
+                      webCookie.value,
+                      webCookie.domain,
+                      webCookie.path,
+                      webCookie.expires,
+                      webCookie.httpOnly,
+                      webCookie.secure,
+                      webCookie.session);
+        rawCookies->append(cookie);
+    }
+    return true;
+}
+
+void ChromiumBridge::deleteCookie(const KURL& url, const String& cookieName)
+{
+    webKitClient()->deleteCookie(url, cookieName);
+}
+
+// DNS ------------------------------------------------------------------------
+
+void ChromiumBridge::prefetchDNS(const String& hostname)
+{
+    webKitClient()->prefetchHostName(hostname);
+}
+
+// File ------------------------------------------------------------------------
+
+bool ChromiumBridge::fileExists(const String& path)
+{
+    return webKitClient()->fileExists(path);
+}
+
+bool ChromiumBridge::deleteFile(const String& path)
+{
+    return webKitClient()->deleteFile(path);
+}
+
+bool ChromiumBridge::deleteEmptyDirectory(const String& path)
+{
+    return webKitClient()->deleteEmptyDirectory(path);
+}
+
+bool ChromiumBridge::getFileSize(const String& path, long long& result)
+{
+    return webKitClient()->getFileSize(path, result);
+}
+
+bool ChromiumBridge::getFileModificationTime(const String& path, time_t& result)
+{
+    return webKitClient()->getFileModificationTime(path, result);
+}
+
+String ChromiumBridge::directoryName(const String& path)
+{
+    return webKitClient()->directoryName(path);
+}
+
+String ChromiumBridge::pathByAppendingComponent(const String& path, const String& component)
+{
+    return webKitClient()->pathByAppendingComponent(path, component);
+}
+
+bool ChromiumBridge::makeAllDirectories(const String& path)
+{
+    return webKitClient()->makeAllDirectories(path);
+}
+
+String ChromiumBridge::getAbsolutePath(const String& path)
+{
+    return webKitClient()->getAbsolutePath(path);
+}
+
+bool ChromiumBridge::isDirectory(const String& path)
+{
+    return webKitClient()->isDirectory(path);
+}
+
+KURL ChromiumBridge::filePathToURL(const String& path)
+{
+    return webKitClient()->filePathToURL(path);
+}
+
+// Font -----------------------------------------------------------------------
+
+#if PLATFORM(WIN_OS)
+bool ChromiumBridge::ensureFontLoaded(HFONT font)
+{
+    WebSandboxSupport* ss = webKitClient()->sandboxSupport();
+
+    // if there is no sandbox, then we can assume the font
+    // was able to be loaded successfully already
+    return ss ? ss->ensureFontLoaded(font) : true;
+}
+#endif
+
+#if PLATFORM(LINUX)
+String ChromiumBridge::getFontFamilyForCharacters(const UChar* characters, size_t numCharacters)
+{
+    if (webKitClient()->sandboxSupport())
+        return webKitClient()->sandboxSupport()->getFontFamilyForCharacters(characters, numCharacters);
+
+    WebCString family = WebFontInfo::familyForChars(characters, numCharacters);
+    if (family.data())
+        return WebString::fromUTF8(family.data());
+
+    return WebString();
+}
+#endif
+
+// HTML5 DB -------------------------------------------------------------------
+
+#if ENABLE(DATABASE)
+PlatformFileHandle ChromiumBridge::databaseOpenFile(const String& fileName, int desiredFlags, PlatformFileHandle* dirHandle)
+{
+    return webKitClient()->databaseOpenFile(WebString(fileName), desiredFlags, dirHandle);
+}
+
+int ChromiumBridge::databaseDeleteFile(const String& fileName, bool syncDir)
+{
+    return webKitClient()->databaseDeleteFile(WebString(fileName), syncDir);
+}
+
+long ChromiumBridge::databaseGetFileAttributes(const String& fileName)
+{
+    return webKitClient()->databaseGetFileAttributes(WebString(fileName));
+}
+
+long long ChromiumBridge::databaseGetFileSize(const String& fileName)
+{
+    return webKitClient()->databaseGetFileSize(WebString(fileName));
+}
+#endif
+
+// Keygen ---------------------------------------------------------------------
+
+String ChromiumBridge::signedPublicKeyAndChallengeString(
+    unsigned keySizeIndex, const String& challenge, const KURL& url)
+{
+    return webKitClient()->signedPublicKeyAndChallengeString(keySizeIndex,
+                                                             WebString(challenge),
+                                                             WebURL(url));
+}
+
+// Language -------------------------------------------------------------------
+
+String ChromiumBridge::computedDefaultLanguage()
+{
+    return webKitClient()->defaultLocale();
+}
+
+// LayoutTestMode -------------------------------------------------------------
+
+bool ChromiumBridge::layoutTestMode()
+{
+    return WebKit::layoutTestMode();
+}
+
+// MimeType -------------------------------------------------------------------
+
+bool ChromiumBridge::isSupportedImageMIMEType(const String& mimeType)
+{
+    return webKitClient()->mimeRegistry()->supportsImageMIMEType(mimeType)
+        != WebMimeRegistry::IsNotSupported;
+}
+
+bool ChromiumBridge::isSupportedJavaScriptMIMEType(const String& mimeType)
+{
+    return webKitClient()->mimeRegistry()->supportsJavaScriptMIMEType(mimeType)
+        != WebMimeRegistry::IsNotSupported;
+}
+
+bool ChromiumBridge::isSupportedNonImageMIMEType(const String& mimeType)
+{
+    return webKitClient()->mimeRegistry()->supportsNonImageMIMEType(mimeType)
+        != WebMimeRegistry::IsNotSupported;
+}
+
+String ChromiumBridge::mimeTypeForExtension(const String& extension)
+{
+    return webKitClient()->mimeRegistry()->mimeTypeForExtension(extension);
+}
+
+String ChromiumBridge::mimeTypeFromFile(const String& path)
+{
+    return webKitClient()->mimeRegistry()->mimeTypeFromFile(path);
+}
+
+String ChromiumBridge::preferredExtensionForMIMEType(const String& mimeType)
+{
+    return webKitClient()->mimeRegistry()->preferredExtensionForMIMEType(mimeType);
+}
+
+// Plugin ---------------------------------------------------------------------
+
+bool ChromiumBridge::plugins(bool refresh, Vector<PluginInfo*>* results)
+{
+    WebPluginListBuilderImpl builder(results);
+    webKitClient()->getPluginList(refresh, &builder);
+    return true;  // FIXME: There is no need for this function to return a value.
+}
+
+NPObject* ChromiumBridge::pluginScriptableObject(Widget* widget)
+{
+    if (!widget)
+        return 0;
+
+    ASSERT(!widget->isFrameView());
+
+    // NOTE:  We have to trust that the widget passed to us here is a
+    // WebPluginContainerImpl.  There isn't a way to dynamically verify it,
+    // since the derived class (Widget) has no identifier.
+    return static_cast<WebPluginContainerImpl*>(widget)->scriptableObject();
+}
+
+// Resources ------------------------------------------------------------------
+
+PassRefPtr<Image> ChromiumBridge::loadPlatformImageResource(const char* name)
+{
+    const WebData& resource = webKitClient()->loadResource(name);
+    if (resource.isEmpty())
+        return Image::nullImage();
+
+    RefPtr<Image> image = BitmapImage::create();
+    image->setData(resource, true);
+    return image;
+}
+
+// Sandbox --------------------------------------------------------------------
+
+bool ChromiumBridge::sandboxEnabled()
+{
+    return webKitClient()->sandboxEnabled();
+}
+
+// SharedTimers ---------------------------------------------------------------
+
+void ChromiumBridge::setSharedTimerFiredFunction(void (*func)())
+{
+    webKitClient()->setSharedTimerFiredFunction(func);
+}
+
+void ChromiumBridge::setSharedTimerFireTime(double fireTime)
+{
+    webKitClient()->setSharedTimerFireTime(fireTime);
+}
+
+void ChromiumBridge::stopSharedTimer()
+{
+    webKitClient()->stopSharedTimer();
+}
+
+// StatsCounters --------------------------------------------------------------
+
+void ChromiumBridge::decrementStatsCounter(const char* name)
+{
+    webKitClient()->decrementStatsCounter(name);
+}
+
+void ChromiumBridge::incrementStatsCounter(const char* name)
+{
+    webKitClient()->incrementStatsCounter(name);
+}
+
+// Sudden Termination ---------------------------------------------------------
+
+void ChromiumBridge::suddenTerminationChanged(bool enabled)
+{
+    webKitClient()->suddenTerminationChanged(enabled);
+}
+
+// SystemTime -----------------------------------------------------------------
+
+double ChromiumBridge::currentTime()
+{
+    return webKitClient()->currentTime();
+}
+
+// Theming --------------------------------------------------------------------
+
+#if PLATFORM(WIN_OS)
+
+void ChromiumBridge::paintButton(
+    GraphicsContext* gc, int part, int state, int classicState,
+    const IntRect& rect)
+{
+    webKitClient()->themeEngine()->paintButton(
+        gc->platformContext()->canvas(), part, state, classicState, rect);
+}
+
+void ChromiumBridge::paintMenuList(
+    GraphicsContext* gc, int part, int state, int classicState,
+    const IntRect& rect)
+{
+    webKitClient()->themeEngine()->paintMenuList(
+        gc->platformContext()->canvas(), part, state, classicState, rect);
+}
+
+void ChromiumBridge::paintScrollbarArrow(
+    GraphicsContext* gc, int state, int classicState,
+    const IntRect& rect)
+{
+    webKitClient()->themeEngine()->paintScrollbarArrow(
+        gc->platformContext()->canvas(), state, classicState, rect);
+}
+
+void ChromiumBridge::paintScrollbarThumb(
+    GraphicsContext* gc, int part, int state, int classicState,
+    const IntRect& rect)
+{
+    webKitClient()->themeEngine()->paintScrollbarThumb(
+        gc->platformContext()->canvas(), part, state, classicState, rect);
+}
+
+void ChromiumBridge::paintScrollbarTrack(
+    GraphicsContext* gc, int part, int state, int classicState,
+    const IntRect& rect, const IntRect& alignRect)
+{
+    webKitClient()->themeEngine()->paintScrollbarTrack(
+        gc->platformContext()->canvas(), part, state, classicState, rect,
+        alignRect);
+}
+
+void ChromiumBridge::paintTextField(
+    GraphicsContext* gc, int part, int state, int classicState,
+    const IntRect& rect, const Color& color, bool fillContentArea,
+    bool drawEdges)
+{
+    // Fallback to white when |color| is invalid.
+    RGBA32 backgroundColor = color.isValid() ? color.rgb() : Color::white;
+
+    webKitClient()->themeEngine()->paintTextField(
+        gc->platformContext()->canvas(), part, state, classicState, rect,
+        backgroundColor, fillContentArea, drawEdges);
+}
+
+void ChromiumBridge::paintTrackbar(
+    GraphicsContext* gc, int part, int state, int classicState,
+    const IntRect& rect)
+{
+    webKitClient()->themeEngine()->paintTrackbar(
+        gc->platformContext()->canvas(), part, state, classicState, rect);
+}
+
+#endif
+
+// Trace Event ----------------------------------------------------------------
+
+void ChromiumBridge::traceEventBegin(const char* name, void* id, const char* extra)
+{
+    webKitClient()->traceEventBegin(name, id, extra);
+}
+
+void ChromiumBridge::traceEventEnd(const char* name, void* id, const char* extra)
+{
+    webKitClient()->traceEventEnd(name, id, extra);
+}
+
+// Visited Links --------------------------------------------------------------
+
+LinkHash ChromiumBridge::visitedLinkHash(const UChar* url, unsigned length)
+{
+    url_canon::RawCanonOutput<2048> buffer;
+    url_parse::Parsed parsed;
+    if (!url_util::Canonicalize(url, length, 0, &buffer, &parsed))
+        return 0;  // Invalid URLs are unvisited.
+    return webKitClient()->visitedLinkHash(buffer.data(), buffer.length());
+}
+
+LinkHash ChromiumBridge::visitedLinkHash(const KURL& base,
+                                         const AtomicString& attributeURL)
+{
+    // Resolve the relative URL using googleurl and pass the absolute URL up to
+    // the embedder. We could create a GURL object from the base and resolve
+    // the relative URL that way, but calling the lower-level functions
+    // directly saves us the string allocation in most cases.
+    url_canon::RawCanonOutput<2048> buffer;
+    url_parse::Parsed parsed;
+
+#if USE(GOOGLEURL)
+    const CString& cstr = base.utf8String();
+    const char* data = cstr.data();
+    int length = cstr.length();
+    const url_parse::Parsed& srcParsed = base.parsed();
+#else
+    // When we're not using GoogleURL, first canonicalize it so we can resolve it
+    // below.
+    url_canon::RawCanonOutput<2048> srcCanon;
+    url_parse::Parsed srcParsed;
+    String str = base.string();
+    if (!url_util::Canonicalize(str.characters(), str.length(), 0, &srcCanon, &srcParsed))
+        return 0;
+    const char* data = srcCanon.data();
+    int length = srcCanon.length();
+#endif
+
+    if (!url_util::ResolveRelative(data, length, srcParsed, attributeURL.characters(),
+                                   attributeURL.length(), 0, &buffer, &parsed))
+        return 0;  // Invalid resolved URL.
+
+    return webKitClient()->visitedLinkHash(buffer.data(), buffer.length());
+}
+
+bool ChromiumBridge::isLinkVisited(LinkHash visitedLinkHash)
+{
+    return webKitClient()->isLinkVisited(visitedLinkHash);
+}
+
+// These are temporary methods that the WebKit layer can use to call to the
+// Glue layer. Once the Glue layer moves entirely into the WebKit layer, these
+// methods will be deleted.
+
+void ChromiumBridge::notifyJSOutOfMemory(Frame* frame)
+{
+    if (!frame)
+        return;
+
+    WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame);
+    if (!webFrame->client())
+        return;
+    webFrame->client()->didExhaustMemoryAvailableForScript(webFrame);
+}
+
+int ChromiumBridge::memoryUsageMB()
+{
+    return static_cast<int>(webKitClient()->memoryUsageMB());
+}
+
+int ChromiumBridge::screenDepth(Widget* widget)
+{
+    WebWidgetClient* client = toWebWidgetClient(widget);
+    if (!client)
+        return 0;
+    return client->screenInfo().depth;
+}
+
+int ChromiumBridge::screenDepthPerComponent(Widget* widget)
+{
+    WebWidgetClient* client = toWebWidgetClient(widget);
+    if (!client)
+        return 0;
+    return client->screenInfo().depthPerComponent;
+}
+
+bool ChromiumBridge::screenIsMonochrome(Widget* widget)
+{
+    WebWidgetClient* client = toWebWidgetClient(widget);
+    if (!client)
+        return 0;
+    return client->screenInfo().isMonochrome;
+}
+
+IntRect ChromiumBridge::screenRect(Widget* widget)
+{
+    WebWidgetClient* client = toWebWidgetClient(widget);
+    if (!client)
+        return IntRect();
+    return client->screenInfo().rect;
+}
+
+IntRect ChromiumBridge::screenAvailableRect(Widget* widget)
+{
+    WebWidgetClient* client = toWebWidgetClient(widget);
+    if (!client)
+        return IntRect();
+    return client->screenInfo().availableRect;
+}
+
+bool ChromiumBridge::popupsAllowed(NPP npp)
+{
+    // FIXME: Give the embedder a way to control this.
+    return false;
+}
+
+void ChromiumBridge::widgetSetCursor(Widget* widget, const Cursor& cursor)
+{
+    ChromeClientImpl* client = toChromeClientImpl(widget);
+    if (client)
+        client->setCursor(WebCursorInfo(cursor));
+}
+
+void ChromiumBridge::widgetSetFocus(Widget* widget)
+{
+    ChromeClientImpl* client = toChromeClientImpl(widget);
+    if (client)
+        client->focus();
+}
+
+WorkerContextProxy* WorkerContextProxy::create(Worker* worker)
+{
+    return WebWorkerClientImpl::createWorkerContextProxy(worker);
+}
+
+} // namespace WebCore
diff --git a/WebKit/chromium/src/ChromiumCurrentTime.cpp b/WebKit/chromium/src/ChromiumCurrentTime.cpp
new file mode 100644
index 0000000..1eccc41
--- /dev/null
+++ b/WebKit/chromium/src/ChromiumCurrentTime.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include <wtf/CurrentTime.h>
+
+#include "WebKit.h"
+#include "WebKitClient.h"
+
+namespace WTF {
+
+double currentTime()
+{
+    return WebKit::webKitClient()->currentTime();
+}
+
+}  // namespace WTF
diff --git a/WebKit/chromium/src/ChromiumThreading.cpp b/WebKit/chromium/src/ChromiumThreading.cpp
new file mode 100644
index 0000000..902a433
--- /dev/null
+++ b/WebKit/chromium/src/ChromiumThreading.cpp
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include <wtf/chromium/ChromiumThreading.h>
+
+#include "WebKit.h"
+#include "WebKitClient.h"
+
+#include <wtf/MainThread.h>
+
+namespace WTF {
+
+void ChromiumThreading::initializeMainThread()
+{
+}
+
+void ChromiumThreading::scheduleDispatchFunctionsOnMainThread()
+{
+    WebKit::webKitClient()->callOnMainThread(&WTF::dispatchFunctionsFromMainThread);
+}
+
+}  // namespace WTF
diff --git a/WebKit/chromium/src/ContextMenuClientImpl.cpp b/WebKit/chromium/src/ContextMenuClientImpl.cpp
new file mode 100644
index 0000000..f32c72f
--- /dev/null
+++ b/WebKit/chromium/src/ContextMenuClientImpl.cpp
@@ -0,0 +1,238 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ContextMenuClientImpl.h"
+
+#include "ContextMenu.h"
+#include "Document.h"
+#include "DocumentLoader.h"
+#include "Editor.h"
+#include "EventHandler.h"
+#include "FrameLoader.h"
+#include "FrameView.h"
+#include "HitTestResult.h"
+#include "HTMLMediaElement.h"
+#include "HTMLNames.h"
+#include "KURL.h"
+#include "MediaError.h"
+#include "PlatformString.h"
+#include "TextBreakIterator.h"
+#include "Widget.h"
+
+#include "WebContextMenuData.h"
+#include "WebDataSourceImpl.h"
+#include "WebFrameImpl.h"
+#include "WebPoint.h"
+#include "WebString.h"
+#include "WebURL.h"
+#include "WebURLResponse.h"
+#include "WebViewClient.h"
+#include "WebViewImpl.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+// Figure out the URL of a page or subframe. Returns |page_type| as the type,
+// which indicates page or subframe, or ContextNodeType::NONE if the URL could not
+// be determined for some reason.
+static WebURL urlFromFrame(Frame* frame)
+{
+    if (frame) {
+        DocumentLoader* dl = frame->loader()->documentLoader();
+        if (dl) {
+            WebDataSource* ds = WebDataSourceImpl::fromDocumentLoader(dl);
+            if (ds)
+                return ds->hasUnreachableURL() ? ds->unreachableURL() : ds->request().url();
+        }
+    }
+    return WebURL();
+}
+
+// Helper function to determine whether text is a single word or a sentence.
+static bool isASingleWord(const String& text)
+{
+    TextBreakIterator* it = characterBreakIterator(text.characters(), text.length());
+    return it && textBreakNext(it) == TextBreakDone;
+}
+
+// Helper function to get misspelled word on which context menu
+// is to be evolked. This function also sets the word on which context menu
+// has been evoked to be the selected word, as required. This function changes
+// the selection only when there were no selected characters.
+static String selectMisspelledWord(const ContextMenu* defaultMenu, Frame* selectedFrame)
+{
+    // First select from selectedText to check for multiple word selection.
+    String misspelledWord = selectedFrame->selectedText().stripWhiteSpace();
+
+    // If some texts were already selected, we don't change the selection.
+    if (!misspelledWord.isEmpty()) {
+        // Don't provide suggestions for multiple words.
+        if (!isASingleWord(misspelledWord))
+            return String();
+        return misspelledWord;
+    }
+
+    // Selection is empty, so change the selection to the word under the cursor.
+    HitTestResult hitTestResult = selectedFrame->eventHandler()->
+        hitTestResultAtPoint(defaultMenu->hitTestResult().point(), true);
+    Node* innerNode = hitTestResult.innerNode();
+    VisiblePosition pos(innerNode->renderer()->positionForPoint(
+        hitTestResult.localPoint()));
+
+    VisibleSelection selection;
+    if (pos.isNotNull()) {
+        selection = VisibleSelection(pos);
+        selection.expandUsingGranularity(WordGranularity);
+    }
+
+    if (selection.isRange())
+        selectedFrame->setSelectionGranularity(WordGranularity);
+
+    if (selectedFrame->shouldChangeSelection(selection))
+        selectedFrame->selection()->setSelection(selection);
+
+    misspelledWord = selectedFrame->selectedText().stripWhiteSpace();
+
+    // If misspelled word is still empty, then that portion should not be
+    // selected. Set the selection to that position only, and do not expand.
+    if (misspelledWord.isEmpty()) {
+        selection = VisibleSelection(pos);
+        selectedFrame->selection()->setSelection(selection);
+    }
+
+    return misspelledWord;
+}
+
+PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems(
+    ContextMenu* defaultMenu)
+{
+    // Displaying the context menu in this function is a big hack as we don't
+    // have context, i.e. whether this is being invoked via a script or in
+    // response to user input (Mouse event WM_RBUTTONDOWN,
+    // Keyboard events KeyVK_APPS, Shift+F10). Check if this is being invoked
+    // in response to the above input events before popping up the context menu.
+    if (!m_webView->contextMenuAllowed())
+        return 0;
+
+    HitTestResult r = defaultMenu->hitTestResult();
+    Frame* selectedFrame = r.innerNonSharedNode()->document()->frame();
+
+    WebContextMenuData data;
+    data.mousePosition = selectedFrame->view()->contentsToWindow(r.point());
+
+    // Links, Images, Media tags, and Image/Media-Links take preference over
+    // all else.
+    data.linkURL = r.absoluteLinkURL();
+
+    data.mediaType = WebContextMenuData::MediaTypeNone;
+    data.mediaFlags = WebContextMenuData::MediaNone;
+
+    if (!r.absoluteImageURL().isEmpty()) {
+        data.srcURL = r.absoluteImageURL();
+        data.mediaType = WebContextMenuData::MediaTypeImage;
+    } else if (!r.absoluteMediaURL().isEmpty()) {
+        data.srcURL = r.absoluteMediaURL();
+
+        // We know that if absoluteMediaURL() is not empty, then this
+        // is a media element.
+        HTMLMediaElement* mediaElement =
+            static_cast<HTMLMediaElement*>(r.innerNonSharedNode());
+        if (mediaElement->hasTagName(HTMLNames::videoTag))
+            data.mediaType = WebContextMenuData::MediaTypeVideo;
+        else if (mediaElement->hasTagName(HTMLNames::audioTag))
+            data.mediaType = WebContextMenuData::MediaTypeAudio;
+
+        if (mediaElement->error())
+            data.mediaFlags |= WebContextMenuData::MediaInError;
+        if (mediaElement->paused())
+            data.mediaFlags |= WebContextMenuData::MediaPaused;
+        if (mediaElement->muted())
+            data.mediaFlags |= WebContextMenuData::MediaMuted;
+        if (mediaElement->loop())
+            data.mediaFlags |= WebContextMenuData::MediaLoop;
+        if (mediaElement->supportsSave())
+            data.mediaFlags |= WebContextMenuData::MediaCanSave;
+        if (mediaElement->hasAudio())
+            data.mediaFlags |= WebContextMenuData::MediaHasAudio;
+    }
+    // If it's not a link, an image, a media element, or an image/media link,
+    // show a selection menu or a more generic page menu.
+    data.frameEncoding = selectedFrame->loader()->encoding();
+
+    // Send the frame and page URLs in any case.
+    data.pageURL = urlFromFrame(m_webView->mainFrameImpl()->frame());
+    if (selectedFrame != m_webView->mainFrameImpl()->frame())
+        data.frameURL = urlFromFrame(selectedFrame);
+
+    if (r.isSelected())
+        data.selectedText = selectedFrame->selectedText().stripWhiteSpace();
+
+    data.isEditable = false;
+    if (r.isContentEditable()) {
+        data.isEditable = true;
+        if (m_webView->focusedWebCoreFrame()->editor()->isContinuousSpellCheckingEnabled()) {
+            data.isSpellCheckingEnabled = true;
+            data.misspelledWord = selectMisspelledWord(defaultMenu, selectedFrame);
+        }
+    }
+
+    // Now retrieve the security info.
+    DocumentLoader* dl = selectedFrame->loader()->documentLoader();
+    WebDataSource* ds = WebDataSourceImpl::fromDocumentLoader(dl);
+    if (ds)
+        data.securityInfo = ds->response().securityInfo();
+
+    // Compute edit flags.
+    data.editFlags = WebContextMenuData::CanDoNone;
+    if (m_webView->focusedWebCoreFrame()->editor()->canUndo())
+        data.editFlags |= WebContextMenuData::CanUndo;
+    if (m_webView->focusedWebCoreFrame()->editor()->canRedo())
+        data.editFlags |= WebContextMenuData::CanRedo;
+    if (m_webView->focusedWebCoreFrame()->editor()->canCut())
+        data.editFlags |= WebContextMenuData::CanCut;
+    if (m_webView->focusedWebCoreFrame()->editor()->canCopy())
+        data.editFlags |= WebContextMenuData::CanCopy;
+    if (m_webView->focusedWebCoreFrame()->editor()->canPaste())
+        data.editFlags |= WebContextMenuData::CanPaste;
+    if (m_webView->focusedWebCoreFrame()->editor()->canDelete())
+        data.editFlags |= WebContextMenuData::CanDelete;
+    // We can always select all...
+    data.editFlags |= WebContextMenuData::CanSelectAll;
+
+    WebFrame* selected_web_frame = WebFrameImpl::fromFrame(selectedFrame);
+    if (m_webView->client())
+        m_webView->client()->showContextMenu(selected_web_frame, data);
+
+    return 0;
+}
+
+} // namespace WebKit
diff --git a/WebKit/chromium/src/ContextMenuClientImpl.h b/WebKit/chromium/src/ContextMenuClientImpl.h
new file mode 100644
index 0000000..8b5bab6
--- /dev/null
+++ b/WebKit/chromium/src/ContextMenuClientImpl.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ContextMenuClientImpl_h
+#define ContextMenuClientImpl_h
+
+#include "ContextMenuClient.h"
+
+namespace WebKit {
+
+class WebViewImpl;
+
+class ContextMenuClientImpl : public  WebCore::ContextMenuClient {
+public:
+    ContextMenuClientImpl(WebViewImpl* webView) : m_webView(webView) {}
+    virtual ~ContextMenuClientImpl() {}
+    virtual void copyImageToClipboard(const WebCore::HitTestResult&) {}
+    virtual void contextMenuDestroyed() {}
+    virtual void contextMenuItemSelected(WebCore::ContextMenuItem*, const WebCore::ContextMenu*) {}
+    virtual void downloadURL(const WebCore::KURL&) {}
+    virtual WebCore::PlatformMenuDescription getCustomMenuFromDefaultItems(WebCore::ContextMenu*);
+    virtual bool isSpeaking() { return false; }
+    virtual void lookUpInDictionary(WebCore::Frame*) {}
+    virtual void searchWithGoogle(const WebCore::Frame*) {}
+    virtual bool shouldIncludeInspectElementItem() { return false; }
+    virtual void speak(const WebCore::String&) {}
+    virtual void stopSpeaking() {}
+private:
+    WebViewImpl* m_webView;
+};
+
+} // namespace WebKit
+
+#endif // ContextMenuClientImpl_h

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list