Upstream version 11.39.250.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / web / ChromeClientImpl.cpp
index 89b4c6d..e4caefd 100644 (file)
  */
 
 #include "config.h"
-#include "ChromeClientImpl.h"
-
-#include "ColorChooserPopupUIController.h"
-#include "ColorChooserUIController.h"
-#include "DateTimeChooserImpl.h"
-#include "ExternalDateTimeChooser.h"
-#include "ExternalPopupMenu.h"
-#include "HTMLNames.h"
-#include "PopupMenuChromium.h"
-#include "RuntimeEnabledFeatures.h"
-#include "WebAXObject.h"
-#include "WebAutofillClient.h"
-#include "WebColorChooser.h"
-#include "WebColorSuggestion.h"
-#include "WebConsoleMessage.h"
-#include "WebFileChooserCompletionImpl.h"
-#include "WebFrameClient.h"
-#include "WebFrameImpl.h"
-#include "WebInputElement.h"
-#include "WebInputEvent.h"
-#include "WebInputEventConversion.h"
-#include "WebKit.h"
-#include "WebNode.h"
-#include "WebPasswordGeneratorClient.h"
-#include "WebPlugin.h"
-#include "WebPluginContainerImpl.h"
-#include "WebPopupMenuImpl.h"
-#include "WebPopupMenuInfo.h"
-#include "WebSettings.h"
-#include "WebSettingsImpl.h"
-#include "WebTextDirection.h"
-#include "WebUserGestureIndicator.h"
-#include "WebUserGestureToken.h"
-#include "WebViewClient.h"
-#include "WebViewImpl.h"
-#include "WebWindowFeatures.h"
-#include "bindings/v8/ScriptController.h"
+#include "web/ChromeClientImpl.h"
+
+#include "bindings/core/v8/ScriptController.h"
+#include "core/HTMLNames.h"
 #include "core/accessibility/AXObject.h"
 #include "core/accessibility/AXObjectCache.h"
 #include "core/dom/Document.h"
-#include "core/dom/DocumentFullscreen.h"
+#include "core/dom/Fullscreen.h"
 #include "core/dom/Node.h"
 #include "core/events/KeyboardEvent.h"
 #include "core/events/MouseEvent.h"
 #include "core/events/WheelEvent.h"
+#include "core/frame/Console.h"
+#include "core/frame/FrameView.h"
+#include "core/frame/Settings.h"
 #include "core/html/HTMLInputElement.h"
+#include "core/html/forms/ColorChooser.h"
+#include "core/html/forms/ColorChooserClient.h"
+#include "core/html/forms/DateTimeChooser.h"
 #include "core/loader/DocumentLoader.h"
 #include "core/loader/FrameLoadRequest.h"
-#include "core/frame/Console.h"
-#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/page/PagePopupDriver.h"
-#include "core/frame/Settings.h"
 #include "core/page/WindowFeatures.h"
 #include "core/rendering/HitTestResult.h"
+#include "core/rendering/RenderPart.h"
 #include "core/rendering/RenderWidget.h"
-#include "platform/ColorChooser.h"
-#include "platform/ColorChooserClient.h"
+#include "core/rendering/compositing/CompositedSelectionBound.h"
 #include "platform/Cursor.h"
-#include "platform/DateTimeChooser.h"
 #include "platform/FileChooser.h"
 #include "platform/NotImplemented.h"
 #include "platform/PlatformScreen.h"
+#include "platform/RuntimeEnabledFeatures.h"
 #include "platform/exported/WrappedResourceRequest.h"
 #include "platform/geometry/FloatRect.h"
 #include "platform/geometry/IntRect.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebCursorInfo.h"
 #include "public/platform/WebRect.h"
+#include "public/platform/WebSelectionBound.h"
 #include "public/platform/WebURLRequest.h"
+#include "public/web/WebAXObject.h"
+#include "public/web/WebAutofillClient.h"
+#include "public/web/WebColorChooser.h"
+#include "public/web/WebColorSuggestion.h"
+#include "public/web/WebConsoleMessage.h"
+#include "public/web/WebFrameClient.h"
+#include "public/web/WebInputElement.h"
+#include "public/web/WebInputEvent.h"
+#include "public/web/WebKit.h"
+#include "public/web/WebNode.h"
+#include "public/web/WebPlugin.h"
+#include "public/web/WebPopupMenuInfo.h"
+#include "public/web/WebSettings.h"
+#include "public/web/WebTextDirection.h"
 #include "public/web/WebTouchAction.h"
+#include "public/web/WebUserGestureIndicator.h"
+#include "public/web/WebUserGestureToken.h"
+#include "public/web/WebViewClient.h"
+#include "public/web/WebWindowFeatures.h"
+#include "web/ColorChooserPopupUIController.h"
+#include "web/ColorChooserUIController.h"
+#include "web/DateTimeChooserImpl.h"
+#include "web/ExternalDateTimeChooser.h"
+#include "web/ExternalPopupMenu.h"
+#include "web/PopupMenuChromium.h"
+#include "web/WebFileChooserCompletionImpl.h"
+#include "web/WebInputEventConversion.h"
+#include "web/WebLocalFrameImpl.h"
+#include "web/WebPluginContainerImpl.h"
+#include "web/WebPopupMenuImpl.h"
+#include "web/WebSettingsImpl.h"
+#include "web/WebViewImpl.h"
 #include "wtf/text/CString.h"
 #include "wtf/text/StringBuilder.h"
 #include "wtf/text/StringConcatenate.h"
 #include "wtf/unicode/CharacterNames.h"
 
-using namespace WebCore;
-
 namespace blink {
 
-// Converts a WebCore::AXObjectCache::AXNotification to a blink::WebAXEvent
+// Converts a AXObjectCache::AXNotification to a WebAXEvent
 static WebAXEvent toWebAXEvent(AXObjectCache::AXNotification notification)
 {
     // These enums have the same values; enforced in AssertMatchingEnums.cpp.
     return static_cast<WebAXEvent>(notification);
 }
 
+static WebSelectionBound toWebSelectionBound(const CompositedSelectionBound& bound)
+{
+    ASSERT(bound.layer);
+
+    // These enums have the same values; enforced in AssertMatchingEnums.cpp.
+    WebSelectionBound result(static_cast<WebSelectionBound::Type>(bound.type));
+    result.layerId = bound.layer->platformLayer()->id();
+    result.edgeTopInLayer = roundedIntPoint(bound.edgeTopInLayer);
+    result.edgeBottomInLayer = roundedIntPoint(bound.edgeBottomInLayer);
+    return result;
+}
+
 ChromeClientImpl::ChromeClientImpl(WebViewImpl* webView)
     : m_webView(webView)
     , m_toolbarsVisible(true)
@@ -201,21 +213,14 @@ void ChromeClientImpl::focusedNodeChanged(Node* node)
     m_webView->client()->focusedNodeChanged(WebNode(node));
 
     WebURL focusURL;
-    if (node && node->isLink()) {
-        // This HitTestResult hack is the easiest way to get a link URL out of a
-        // WebCore::Node.
-        HitTestResult hitTest(IntPoint(0, 0));
-        // This cast must be valid because of the isLink() check.
-        hitTest.setURLElement(toElement(node));
-        if (hitTest.isLiveLink())
-            focusURL = hitTest.absoluteLinkURL();
-    }
+    if (node && node->isElementNode() && toElement(node)->isLiveLink())
+        focusURL = toElement(node)->hrefURL();
     m_webView->client()->setKeyboardFocusURL(focusURL);
 }
 
-void ChromeClientImpl::focusedFrameChanged(WebCore::LocalFrame* frame)
+void ChromeClientImpl::focusedFrameChanged(LocalFrame* frame)
 {
-    WebFrameImpl* webframe = WebFrameImpl::fromFrame(frame);
+    WebLocalFrameImpl* webframe = WebLocalFrameImpl::fromFrame(frame);
     if (webframe && webframe->client())
         webframe->client()->frameFocused();
 }
@@ -231,10 +236,10 @@ Page* ChromeClientImpl::createWindow(LocalFrame* frame, const FrameLoadRequest&
         policy = getNavigationPolicy();
 
     ASSERT(frame->document());
-    DocumentFullscreen::webkitCancelFullScreen(*frame->document());
+    Fullscreen::fullyExitFullscreen(*frame->document());
 
     WebViewImpl* newView = toWebViewImpl(
-        m_webView->client()->createView(WebFrameImpl::fromFrame(frame), WrappedResourceRequest(r.resourceRequest()), features, r.frameName(), policy, shouldSendReferrer == NeverSendReferrer));
+        m_webView->client()->createView(WebLocalFrameImpl::fromFrame(frame), WrappedResourceRequest(r.resourceRequest()), features, r.frameName(), policy, shouldSendReferrer == NeverSendReferrer));
     if (!newView)
         return 0;
     return newView->page();
@@ -338,7 +343,7 @@ bool ChromeClientImpl::statusbarVisible()
 void ChromeClientImpl::setScrollbarsVisible(bool value)
 {
     m_scrollbarsVisible = value;
-    WebFrameImpl* webFrame = toWebFrameImpl(m_webView->mainFrame());
+    WebLocalFrameImpl* webFrame = toWebLocalFrameImpl(m_webView->mainFrame());
     if (webFrame)
         webFrame->setCanHaveScrollbars(value);
 }
@@ -365,13 +370,15 @@ void ChromeClientImpl::setResizable(bool value)
 
 bool ChromeClientImpl::shouldReportDetailedMessageForSource(const String& url)
 {
-    return m_webView->client() && m_webView->client()->shouldReportDetailedMessageForSource(url);
+    WebLocalFrameImpl* webframe = m_webView->localFrameRootTemporary();
+    return webframe->client() && webframe->client()->shouldReportDetailedMessageForSource(url);
 }
 
-void ChromeClientImpl::addMessageToConsole(MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceID, const String& stackTrace)
+void ChromeClientImpl::addMessageToConsole(LocalFrame* localFrame, MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceID, const String& stackTrace)
 {
-    if (m_webView->client()) {
-        m_webView->client()->didAddMessageToConsole(
+    WebLocalFrameImpl* frame = WebLocalFrameImpl::fromFrame(localFrame);
+    if (frame && frame->client()) {
+        frame->client()->didAddMessageToConsole(
             WebConsoleMessage(static_cast<WebConsoleMessage::Level>(level), message),
             sourceID,
             lineNumber,
@@ -386,10 +393,15 @@ bool ChromeClientImpl::canRunBeforeUnloadConfirmPanel()
 
 bool ChromeClientImpl::runBeforeUnloadConfirmPanel(const String& message, LocalFrame* frame)
 {
-    if (m_webView->client()) {
-        return m_webView->client()->runModalBeforeUnloadDialog(
-            WebFrameImpl::fromFrame(frame), message);
-    }
+    WebLocalFrameImpl* webframe = WebLocalFrameImpl::fromFrame(frame);
+
+    bool isReload = false;
+    WebDataSource* ds = webframe->provisionalDataSource();
+    if (ds)
+        isReload = (ds->navigationType() == WebNavigationTypeReload);
+
+    if (webframe->client())
+        return webframe->client()->runModalBeforeUnloadDialog(isReload, message);
     return false;
 }
 
@@ -409,22 +421,22 @@ void ChromeClientImpl::closeWindowSoon()
 // already know our own m_webView.
 void ChromeClientImpl::runJavaScriptAlert(LocalFrame* frame, const String& message)
 {
-    if (m_webView->client()) {
+    WebLocalFrameImpl* webframe = WebLocalFrameImpl::fromFrame(frame);
+    if (webframe->client()) {
         if (WebUserGestureIndicator::isProcessingUserGesture())
             WebUserGestureIndicator::currentUserGestureToken().setJavascriptPrompt();
-        m_webView->client()->runModalAlertDialog(
-            WebFrameImpl::fromFrame(frame), message);
+        webframe->client()->runModalAlertDialog(message);
     }
 }
 
 // See comments for runJavaScriptAlert().
 bool ChromeClientImpl::runJavaScriptConfirm(LocalFrame* frame, const String& message)
 {
-    if (m_webView->client()) {
+    WebLocalFrameImpl* webframe = WebLocalFrameImpl::fromFrame(frame);
+    if (webframe->client()) {
         if (WebUserGestureIndicator::isProcessingUserGesture())
             WebUserGestureIndicator::currentUserGestureToken().setJavascriptPrompt();
-        return m_webView->client()->runModalConfirmDialog(
-            WebFrameImpl::fromFrame(frame), message);
+        return webframe->client()->runModalConfirmDialog(message);
     }
     return false;
 }
@@ -435,12 +447,12 @@ bool ChromeClientImpl::runJavaScriptPrompt(LocalFrame* frame,
                                            const String& defaultValue,
                                            String& result)
 {
-    if (m_webView->client()) {
+    WebLocalFrameImpl* webframe = WebLocalFrameImpl::fromFrame(frame);
+    if (webframe->client()) {
         if (WebUserGestureIndicator::isProcessingUserGesture())
             WebUserGestureIndicator::currentUserGestureToken().setJavascriptPrompt();
         WebString actualValue;
-        bool ok = m_webView->client()->runModalPromptDialog(
-            WebFrameImpl::fromFrame(frame),
+        bool ok = webframe->client()->runModalPromptDialog(
             message,
             defaultValue,
             &actualValue);
@@ -487,26 +499,6 @@ void ChromeClientImpl::scheduleAnimation()
     m_webView->scheduleAnimation();
 }
 
-bool ChromeClientImpl::isCompositorFramePending() const
-{
-    return m_webView->client()->isCompositorFramePending();
-}
-
-void ChromeClientImpl::scroll(
-    const IntSize& scrollDelta, const IntRect& scrollRect,
-    const IntRect& clipRect)
-{
-    if (!m_webView->isAcceleratedCompositingActive()) {
-        if (m_webView->client()) {
-            int dx = scrollDelta.width();
-            int dy = scrollDelta.height();
-            m_webView->client()->didScrollRect(dx, dy, intersection(scrollRect, clipRect));
-        }
-    } else {
-        m_webView->scrollRootLayer();
-    }
-}
-
 IntRect ChromeClientImpl::rootViewToScreen(const IntRect& rect) const
 {
     IntRect screenRect(rect);
@@ -528,10 +520,8 @@ void ChromeClientImpl::contentsSizeChanged(LocalFrame* frame, const IntSize& siz
 {
     m_webView->didChangeContentsSize();
 
-    WebFrameImpl* webframe = WebFrameImpl::fromFrame(frame);
+    WebLocalFrameImpl* webframe = WebLocalFrameImpl::fromFrame(frame);
     webframe->didChangeContentsSize(size);
-    if (webframe->client())
-        webframe->client()->didChangeContentsSize(webframe, size);
 
     frame->loader().restoreScrollPositionAndViewState();
 }
@@ -543,7 +533,7 @@ void ChromeClientImpl::deviceOrPageScaleFactorChanged() const
 
 void ChromeClientImpl::layoutUpdated(LocalFrame* frame) const
 {
-    m_webView->layoutUpdated(WebFrameImpl::fromFrame(frame));
+    m_webView->layoutUpdated(WebLocalFrameImpl::fromFrame(frame));
 }
 
 void ChromeClientImpl::mouseDidMoveOverElement(
@@ -574,13 +564,8 @@ void ChromeClientImpl::mouseDidMoveOverElement(
 
 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);
+    if (m_webView->client())
+        m_webView->client()->setToolTipText(tooltipText, toWebTextDirection(dir));
 }
 
 void ChromeClientImpl::dispatchViewportPropertiesDidChange(const ViewportDescription& description) const
@@ -591,16 +576,16 @@ void ChromeClientImpl::dispatchViewportPropertiesDidChange(const ViewportDescrip
 void ChromeClientImpl::print(LocalFrame* frame)
 {
     if (m_webView->client())
-        m_webView->client()->printPage(WebFrameImpl::fromFrame(frame));
+        m_webView->client()->printPage(WebLocalFrameImpl::fromFrame(frame));
 }
 
-PassOwnPtr<ColorChooser> ChromeClientImpl::createColorChooser(ColorChooserClient* chooserClient, const Color&)
+PassOwnPtr<ColorChooser> ChromeClientImpl::createColorChooser(LocalFrame* frame, ColorChooserClient* chooserClient, const Color&)
 {
     OwnPtr<ColorChooserUIController> controller;
     if (RuntimeEnabledFeatures::pagePopupEnabled())
-        controller = adoptPtr(new ColorChooserPopupUIController(this, chooserClient));
+        controller = adoptPtr(new ColorChooserPopupUIController(frame, this, chooserClient));
     else
-        controller = adoptPtr(new ColorChooserUIController(this, chooserClient));
+        controller = adoptPtr(new ColorChooserUIController(frame, chooserClient));
     controller->openUI();
     return controller.release();
 }
@@ -627,9 +612,8 @@ void ChromeClientImpl::runOpenPanel(LocalFrame* frame, PassRefPtr<FileChooser> f
     params.selectedFiles = fileChooser->settings().selectedFiles;
     if (params.selectedFiles.size() > 0)
         params.initialValue = params.selectedFiles[0];
-#if ENABLE(MEDIA_CAPTURE)
     params.useMediaCapture = fileChooser->settings().useMediaCapture;
-#endif
+
     WebFileChooserCompletionImpl* chooserCompletion =
         new WebFileChooserCompletionImpl(fileChooser);
 
@@ -656,7 +640,7 @@ void ChromeClientImpl::enumerateChosenDirectory(FileChooser* fileChooser)
         chooserCompletion->didChooseFile(WebVector<WebString>());
 }
 
-void ChromeClientImpl::setCursor(const WebCore::Cursor& cursor)
+void ChromeClientImpl::setCursor(const Cursor& cursor)
 {
     setCursor(WebCursorInfo(cursor));
 }
@@ -681,8 +665,14 @@ void ChromeClientImpl::setCursorForPlugin(const WebCursorInfo& cursor)
 void ChromeClientImpl::postAccessibilityNotification(AXObject* obj, AXObjectCache::AXNotification notification)
 {
     // Alert assistive technology about the accessibility object notification.
-    if (!obj)
+    if (!obj || !obj->document())
         return;
+
+    WebLocalFrameImpl* webframe = WebLocalFrameImpl::fromFrame(obj->document()->axObjectCacheOwner().frame());
+    if (webframe && webframe->client())
+        webframe->client()->postAccessibilityEvent(WebAXObject(obj), toWebAXEvent(notification));
+
+    // FIXME: delete these lines once Chrome only uses the frame client interface, above.
     if (m_webView->client())
         m_webView->client()->postAccessibilityEvent(WebAXObject(obj), toWebAXEvent(notification));
 }
@@ -695,7 +685,7 @@ String ChromeClientImpl::acceptLanguages()
 bool ChromeClientImpl::paintCustomOverhangArea(GraphicsContext* context, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect)
 {
     LocalFrame* frame = m_webView->mainFrameImpl()->frame();
-    WebPluginContainerImpl* pluginContainer = WebFrameImpl::pluginContainerFromFrame(frame);
+    WebPluginContainerImpl* pluginContainer = WebLocalFrameImpl::pluginContainerFromFrame(frame);
     if (pluginContainer)
         return pluginContainer->paintCustomOverhangArea(context, horizontalOverhangArea, verticalOverhangArea, dirtyRect);
     return false;
@@ -711,33 +701,6 @@ void ChromeClientImpl::attachRootGraphicsLayer(GraphicsLayer* rootLayer)
     m_webView->setRootGraphicsLayer(rootLayer);
 }
 
-WebCore::CompositingTriggerFlags ChromeClientImpl::allowedCompositingTriggers() const
-{
-    if (!m_webView->allowsAcceleratedCompositing())
-        return 0;
-
-    WebCore::CompositingTriggerFlags flags = 0;
-    Settings& settings = m_webView->page()->settings();
-    if (settings.acceleratedCompositingFor3DTransformsEnabled())
-        flags |= WebCore::ThreeDTransformTrigger;
-    if (settings.acceleratedCompositingForVideoEnabled())
-        flags |= WebCore::VideoTrigger;
-    if (settings.acceleratedCompositingForPluginsEnabled())
-        flags |= WebCore::PluginTrigger;
-    if (settings.acceleratedCompositingForAnimationEnabled())
-        flags |= WebCore::AnimationTrigger;
-    if (settings.acceleratedCompositingForCanvasEnabled())
-        flags |= WebCore::CanvasTrigger;
-    if (settings.acceleratedCompositingForScrollableFramesEnabled())
-        flags |= WebCore::ScrollableInnerFrameTrigger;
-    if (settings.acceleratedCompositingForFiltersEnabled())
-        flags |= WebCore::FilterTrigger;
-    if (settings.acceleratedCompositingForGpuRasterizationHintEnabled())
-        flags |= WebCore::GPURasterizationTrigger;
-
-    return flags;
-}
-
 void ChromeClientImpl::enterFullScreenForElement(Element* element)
 {
     m_webView->enterFullScreenForElement(element);
@@ -748,17 +711,27 @@ void ChromeClientImpl::exitFullScreenForElement(Element* element)
     m_webView->exitFullScreenForElement(element);
 }
 
+void ChromeClientImpl::clearCompositedSelectionBounds()
+{
+    m_webView->clearCompositedSelectionBounds();
+}
+
+void ChromeClientImpl::updateCompositedSelectionBounds(const CompositedSelectionBound& anchor, const CompositedSelectionBound& focus)
+{
+    m_webView->updateCompositedSelectionBounds(toWebSelectionBound(anchor), toWebSelectionBound(focus));
+}
+
 bool ChromeClientImpl::hasOpenedPopup() const
 {
     return m_webView->hasOpenedPopup();
 }
 
-PassRefPtr<PopupMenu> ChromeClientImpl::createPopupMenu(LocalFrame& frame, PopupMenuClient* client) const
+PassRefPtrWillBeRawPtr<PopupMenu> ChromeClientImpl::createPopupMenu(LocalFrame& frame, PopupMenuClient* client) const
 {
     if (WebViewImpl::useExternalPopupMenus())
-        return adoptRef(new ExternalPopupMenu(frame, client, *m_webView));
+        return adoptRefWillBeNoop(new ExternalPopupMenu(frame, client, *m_webView));
 
-    return adoptRef(new PopupMenuChromium(frame, client));
+    return adoptRefWillBeNoop(new PopupMenuChromium(frame, client));
 }
 
 PagePopup* ChromeClientImpl::openPagePopup(PagePopupClient* client, const IntRect& originBoundsInRootView)
@@ -784,18 +757,6 @@ void ChromeClientImpl::resetPagePopupDriver()
     m_pagePopupDriver = m_webView;
 }
 
-bool ChromeClientImpl::isPasswordGenerationEnabled() const
-{
-    return m_webView->passwordGeneratorClient();
-}
-
-void ChromeClientImpl::openPasswordGenerator(HTMLInputElement* input)
-{
-    ASSERT(isPasswordGenerationEnabled());
-    WebInputElement webInput(input);
-    m_webView->passwordGeneratorClient()->openPasswordGenerator(webInput);
-}
-
 bool ChromeClientImpl::shouldRunModalDialogDuringPageDismissal(const DialogType& dialogType, const String& dialogMessage, Document::PageDismissalType dismissalType) const
 {
     const char* kDialogs[] = {"alert", "confirm", "prompt", "showModalDialog"};
@@ -806,7 +767,7 @@ bool ChromeClientImpl::shouldRunModalDialogDuringPageDismissal(const DialogType&
     int dismissal = static_cast<int>(dismissalType) - 1; // Exclude NoDismissal.
     ASSERT_WITH_SECURITY_IMPLICATION(0 <= dismissal && dismissal < static_cast<int>(arraysize(kDismissals)));
 
-    blink::Platform::current()->histogramEnumeration("Renderer.ModalDialogsDuringPageDismissal", dismissal * arraysize(kDialogs) + dialog, arraysize(kDialogs) * arraysize(kDismissals));
+    Platform::current()->histogramEnumeration("Renderer.ModalDialogsDuringPageDismissal", dismissal * arraysize(kDialogs) + dialog, arraysize(kDialogs) * arraysize(kDismissals));
 
     String message = String("Blocked ") + kDialogs[dialog] + "('" + dialogMessage + "') during " + kDismissals[dismissal] + ".";
     m_webView->mainFrame()->addMessageToConsole(WebConsoleMessage(WebConsoleMessage::LevelError, message));
@@ -814,27 +775,6 @@ bool ChromeClientImpl::shouldRunModalDialogDuringPageDismissal(const DialogType&
     return false;
 }
 
-bool ChromeClientImpl::shouldRubberBandInDirection(WebCore::ScrollDirection direction) const
-{
-    ASSERT(direction != WebCore::ScrollUp && direction != WebCore::ScrollDown);
-
-    if (!m_webView->client())
-        return false;
-
-    if (direction == WebCore::ScrollLeft)
-        return !m_webView->client()->historyBackListCount();
-    if (direction == WebCore::ScrollRight)
-        return !m_webView->client()->historyForwardListCount();
-
-    ASSERT_NOT_REACHED();
-    return true;
-}
-
-void ChromeClientImpl::numWheelEventHandlersChanged(unsigned numberOfWheelHandlers)
-{
-    m_webView->numberOfWheelEventHandlersChanged(numberOfWheelHandlers);
-}
-
 void ChromeClientImpl::needTouchEvents(bool needsTouchEvents)
 {
     m_webView->hasTouchEventHandlers(needsTouchEvents);
@@ -865,15 +805,10 @@ void ChromeClientImpl::annotatedRegionsChanged()
         client->draggableRegionsChanged();
 }
 
-void ChromeClientImpl::didAssociateFormControls(const Vector<RefPtr<Element> >& elements)
+void ChromeClientImpl::didAssociateFormControls(const WillBeHeapVector<RefPtrWillBeMember<Element> >& elements)
 {
-    if (!m_webView->autofillClient())
-        return;
-    WebVector<WebNode> elementVector(static_cast<size_t>(elements.size()));
-    size_t elementsCount = elements.size();
-    for (size_t i = 0; i < elementsCount; ++i)
-        elementVector[i] = elements[i];
-    m_webView->autofillClient()->didAssociateFormControls(elementVector);
+    if (m_webView->autofillClient())
+        m_webView->autofillClient()->didAssociateFormControls(elements);
 }
 
 void ChromeClientImpl::didCancelCompositionOnSelectionChange()
@@ -888,6 +823,18 @@ void ChromeClientImpl::willSetInputMethodState()
         m_webView->client()->resetInputMethod();
 }
 
+void ChromeClientImpl::didUpdateTextOfFocusedElementByNonUserInput()
+{
+    if (m_webView->client())
+        m_webView->client()->didUpdateTextOfFocusedElementByNonUserInput();
+}
+
+void ChromeClientImpl::showImeIfNeeded()
+{
+    if (m_webView->client())
+        m_webView->client()->showImeIfNeeded();
+}
+
 void ChromeClientImpl::handleKeyboardEventOnTextField(HTMLInputElement& inputElement, KeyboardEvent& event)
 {
     if (!m_webView->autofillClient())
@@ -898,25 +845,30 @@ void ChromeClientImpl::handleKeyboardEventOnTextField(HTMLInputElement& inputEle
 // FIXME: Remove this code once we have input routing in the browser
 // process. See http://crbug.com/339659.
 void ChromeClientImpl::forwardInputEvent(
-    WebCore::Document* document, WebCore::Event* event)
+    Frame* frame, Event* event)
 {
-    WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame());
+    // FIXME: Input event forwarding to out-of-process frames is broken until
+    // WebRemoteFrameImpl has a WebFrameClient.
+    if (frame->isRemoteFrame())
+        return;
+
+    WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(toLocalFrame(frame));
 
     // This is only called when we have out-of-process iframes, which
     // need to forward input events across processes.
     // FIXME: Add a check for out-of-process iframes enabled.
     if (event->isKeyboardEvent()) {
-        WebKeyboardEventBuilder webEvent(*static_cast<WebCore::KeyboardEvent*>(event));
+        WebKeyboardEventBuilder webEvent(*static_cast<KeyboardEvent*>(event));
         webFrame->client()->forwardInputEvent(&webEvent);
     } else if (event->isMouseEvent()) {
-        WebMouseEventBuilder webEvent(webFrame->frameView(), document->renderer(), *static_cast<WebCore::MouseEvent*>(event));
+        WebMouseEventBuilder webEvent(webFrame->frameView(), frame->ownerRenderer(), *static_cast<MouseEvent*>(event));
         // Internal Blink events should not be forwarded.
         if (webEvent.type == WebInputEvent::Undefined)
             return;
 
         webFrame->client()->forwardInputEvent(&webEvent);
     } else if (event->isWheelEvent()) {
-        WebMouseWheelEventBuilder webEvent(webFrame->frameView(), document->renderer(), *static_cast<WebCore::WheelEvent*>(event));
+        WebMouseWheelEventBuilder webEvent(webFrame->frameView(), frame->ownerRenderer(), *static_cast<WheelEvent*>(event));
         if (webEvent.type == WebInputEvent::Undefined)
             return;
         webFrame->client()->forwardInputEvent(&webEvent);
@@ -942,29 +894,4 @@ void ChromeClientImpl::openTextDataListChooser(HTMLInputElement& input)
         m_webView->autofillClient()->openTextDataListChooser(WebInputElement(&input));
 }
 
-PassOwnPtr<NavigatorContentUtilsClientImpl> NavigatorContentUtilsClientImpl::create(WebViewImpl* webView)
-{
-    return adoptPtr(new NavigatorContentUtilsClientImpl(webView));
-}
-
-NavigatorContentUtilsClientImpl::NavigatorContentUtilsClientImpl(WebViewImpl* webView)
-    : m_webView(webView)
-{
-}
-
-void NavigatorContentUtilsClientImpl::registerProtocolHandler(const String& scheme, const WebCore::KURL& baseURL, const WebCore::KURL& url, const String& title)
-{
-    m_webView->client()->registerProtocolHandler(scheme, baseURL, url, title);
-}
-
-NavigatorContentUtilsClient::CustomHandlersState NavigatorContentUtilsClientImpl::isProtocolHandlerRegistered(const String& scheme, const WebCore::KURL& baseURL, const WebCore::KURL& url)
-{
-    return static_cast<NavigatorContentUtilsClient::CustomHandlersState>(m_webView->client()->isProtocolHandlerRegistered(scheme, baseURL, url));
-}
-
-void NavigatorContentUtilsClientImpl::unregisterProtocolHandler(const String& scheme, const WebCore::KURL& baseURL, const WebCore::KURL& url)
-{
-    m_webView->client()->unregisterProtocolHandler(scheme, baseURL, url);
-}
-
 } // namespace blink