summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-27 19:21:26 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-27 19:21:26 +0000
commitb909b540017ba1a4b4824967883ae13fff674597 (patch)
tree16cf8b29312154bd5ab6ba2b9c5e1a7e490fd2b9 /webkit
parent69d320ef1ff94adc9ebfcb1230371aa0ae50a3e3 (diff)
downloadchromium_src-b909b540017ba1a4b4824967883ae13fff674597.zip
chromium_src-b909b540017ba1a4b4824967883ae13fff674597.tar.gz
chromium_src-b909b540017ba1a4b4824967883ae13fff674597.tar.bz2
Move a bunch of files into webkit/api/src
R=yaar BUG=25898,25899,25900,25901, TEST=none Review URL: http://codereview.chromium.org/338041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30232 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/api/src/BackForwardListClientImpl.cpp138
-rw-r--r--webkit/api/src/BackForwardListClientImpl.h72
-rw-r--r--webkit/api/src/ChromeClientImpl.cpp662
-rw-r--r--webkit/api/src/ChromeClientImpl.h155
-rw-r--r--webkit/api/src/DragClientImpl.cpp103
-rw-r--r--webkit/api/src/DragClientImpl.h76
-rw-r--r--webkit/api/src/InspectorClientImpl.cpp262
-rw-r--r--webkit/api/src/InspectorClientImpl.h83
-rw-r--r--webkit/api/src/WebPopupMenuImpl.cpp311
-rw-r--r--webkit/api/src/WebPopupMenuImpl.h128
-rw-r--r--webkit/glue/back_forward_list_client_impl.cc101
-rw-r--r--webkit/glue/back_forward_list_client_impl.h46
-rw-r--r--webkit/glue/chrome_client_impl.cc632
-rw-r--r--webkit/glue/chrome_client_impl.h164
-rw-r--r--webkit/glue/dragclient_impl.cc83
-rw-r--r--webkit/glue/dragclient_impl.h49
-rw-r--r--webkit/glue/inspector_client_impl.cc231
-rw-r--r--webkit/glue/inspector_client_impl.h62
-rw-r--r--webkit/glue/webframeloaderclient_impl.cc4
-rw-r--r--webkit/glue/webkitclient_impl.cc7
-rw-r--r--webkit/glue/webpopupmenu_impl.cc284
-rw-r--r--webkit/glue/webpopupmenu_impl.h108
-rw-r--r--webkit/glue/webview_impl.cc4
-rw-r--r--webkit/glue/webview_impl.h16
-rw-r--r--webkit/webkit.gyp21
25 files changed, 2018 insertions, 1784 deletions
diff --git a/webkit/api/src/BackForwardListClientImpl.cpp b/webkit/api/src/BackForwardListClientImpl.cpp
new file mode 100644
index 0000000..fc6defd
--- /dev/null
+++ b/webkit/api/src/BackForwardListClientImpl.cpp
@@ -0,0 +1,138 @@
+/*
+ * 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 "BackForwardListClientImpl.h"
+
+#include "HistoryItem.h"
+#include "WebViewClient.h"
+
+// FIXME: Remove this once WebViewImpl moves out of glue/.
+#include "webkit/glue/webview_impl.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+const char backForwardNavigationScheme[] = "chrome-back-forward";
+
+BackForwardListClientImpl::BackForwardListClientImpl(WebViewImpl* webView)
+ : m_webView(webView)
+{
+}
+
+BackForwardListClientImpl::~BackForwardListClientImpl()
+{
+}
+
+void BackForwardListClientImpl::SetCurrentHistoryItem(HistoryItem* item)
+{
+ m_previousItem = m_currentItem;
+ m_currentItem = item;
+}
+
+HistoryItem* BackForwardListClientImpl::GetPreviousHistoryItem() const
+{
+ return m_previousItem.get();
+}
+
+void BackForwardListClientImpl::addItem(PassRefPtr<HistoryItem> item)
+{
+ m_previousItem = m_currentItem;
+ m_currentItem = item;
+
+ // If WebCore adds a new HistoryItem, it means this is a new navigation (ie,
+ // not a reload or back/forward).
+ m_webView->ObserveNewNavigation();
+
+ if (m_webView->client())
+ m_webView->client()->didAddHistoryItem();
+}
+
+void BackForwardListClientImpl::goToItem(HistoryItem* item)
+{
+ m_previousItem = m_currentItem;
+ m_currentItem = item;
+
+ if (m_pendingHistoryItem == item)
+ m_pendingHistoryItem = 0;
+}
+
+HistoryItem* BackForwardListClientImpl::currentItem()
+{
+ return m_currentItem.get();
+}
+
+HistoryItem* BackForwardListClientImpl::itemAtIndex(int index)
+{
+ if (!m_webView->client())
+ return 0;
+
+ // Since we don't keep the entire back/forward list, we have no way to
+ // properly implement this method. We return a dummy entry instead that we
+ // intercept in our FrameLoaderClient implementation in case WebCore asks
+ // to navigate to this HistoryItem.
+
+ // FIXME: We should change WebCore to handle history.{back,forward,go}
+ // differently. It should perhaps just ask the FrameLoaderClient to
+ // perform those navigations.
+
+ String url_string = String::format(
+ "%s://go/%d", backForwardNavigationScheme, index);
+
+ m_pendingHistoryItem =
+ HistoryItem::create(url_string, String(), 0.0);
+ return m_pendingHistoryItem.get();
+}
+
+int BackForwardListClientImpl::backListCount()
+{
+ if (!m_webView->client())
+ return 0;
+
+ return m_webView->client()->historyBackListCount();
+}
+
+int BackForwardListClientImpl::forwardListCount()
+{
+ if (!m_webView->client())
+ return 0;
+
+ return m_webView->client()->historyForwardListCount();
+}
+
+void BackForwardListClientImpl::close()
+{
+ m_currentItem = 0;
+ m_previousItem = 0;
+ m_pendingHistoryItem = 0;
+}
+
+} // namespace WebKit
diff --git a/webkit/api/src/BackForwardListClientImpl.h b/webkit/api/src/BackForwardListClientImpl.h
new file mode 100644
index 0000000..e498ea0
--- /dev/null
+++ b/webkit/api/src/BackForwardListClientImpl.h
@@ -0,0 +1,72 @@
+/*
+ * 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 BackForwardListClientImpl_h
+#define BackForwardListClientImpl_h
+
+#include "BackForwardList.h"
+
+class WebViewImpl;
+
+namespace WebKit {
+
+extern const char backForwardNavigationScheme[];
+
+class BackForwardListClientImpl : public WebCore::BackForwardListClient {
+public:
+ BackForwardListClientImpl(WebViewImpl* webview);
+ ~BackForwardListClientImpl();
+
+ void SetCurrentHistoryItem(WebCore::HistoryItem* item);
+ WebCore::HistoryItem* GetPreviousHistoryItem() const;
+
+private:
+ // WebCore::BackForwardListClient methods:
+ virtual void addItem(PassRefPtr<WebCore::HistoryItem>);
+ virtual void goToItem(WebCore::HistoryItem*);
+ virtual WebCore::HistoryItem* currentItem();
+ virtual WebCore::HistoryItem* itemAtIndex(int index);
+ virtual int backListCount();
+ virtual int forwardListCount();
+ virtual void close();
+
+ WebViewImpl* m_webView;
+
+ RefPtr<WebCore::HistoryItem> m_previousItem;
+ RefPtr<WebCore::HistoryItem> m_currentItem;
+
+ // The last history item that was accessed via itemAtIndex(). We keep track
+ // of this until goToItem() is called, so we can track the navigation.
+ RefPtr<WebCore::HistoryItem> m_pendingHistoryItem;
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/webkit/api/src/ChromeClientImpl.cpp b/webkit/api/src/ChromeClientImpl.cpp
new file mode 100644
index 0000000..a81c3aa
--- /dev/null
+++ b/webkit/api/src/ChromeClientImpl.cpp
@@ -0,0 +1,662 @@
+/*
+ * 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 "Document.h"
+#include "DocumentLoader.h"
+#include "DatabaseTracker.h"
+#include "FloatRect.h"
+#include "FileChooser.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 "WebFileChooserCompletion.h"
+#include "WebFrameClient.h"
+#include "WebInputEvent.h"
+#include "WebKit.h"
+#include "WebPopupMenuInfo.h"
+#include "WebRect.h"
+#include "WebTextDirection.h"
+#include "WebURLRequest.h"
+#include "WebViewClient.h"
+#include "WebFileChooserCompletionImpl.h"
+#include "WebPopupMenuImpl.h"
+#include "WindowFeatures.h"
+#include "WrappedResourceRequest.h"
+
+// FIXME: Remove these once they move out of glue/.
+#include "webkit/glue/webframe_impl.h"
+#include "webkit/glue/webview_impl.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->GetFocusedWebCoreFrame();
+ if (!frame)
+ return;
+
+ Document* doc = frame->document();
+
+ if (doc && doc->axObjectCache()->accessibilityEnabled()) {
+ Node* focusedNode = m_webView->GetFocusedNode();
+
+ 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();
+}
+
+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->main_frame()->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::current_input_event()))
+ policy = WebNavigationPolicyNewBackgroundTab;
+
+ m_webView->client()->show(policy);
+}
+
+bool ChromeClientImpl::canRunModal()
+{
+ return m_webView->client() != 0;
+}
+
+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() != 0;
+}
+
+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->GetNotificationPresenter();
+}
+#endif
+
+} // namespace WebKit
diff --git a/webkit/api/src/ChromeClientImpl.h b/webkit/api/src/ChromeClientImpl.h
new file mode 100644
index 0000000..427390a
--- /dev/null
+++ b/webkit/api/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"
+
+class WebViewImpl;
+
+namespace WebCore {
+class HTMLParserQuirks;
+class PopupContainer;
+class SecurityOrigin;
+struct WindowFeatures;
+}
+
+namespace WebKit {
+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 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/api/src/DragClientImpl.cpp b/webkit/api/src/DragClientImpl.cpp
new file mode 100644
index 0000000..77c5ad8
--- /dev/null
+++ b/webkit/api/src/DragClientImpl.cpp
@@ -0,0 +1,103 @@
+/*
+ * 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 "DragClientImpl.h"
+
+#include "ChromiumDataObject.h"
+#include "ClipboardChromium.h"
+#include "Frame.h"
+#include "WebDragData.h"
+#include "WebViewClient.h"
+
+// FIXME: Remove this once WebViewImpl moves out of glue/.
+#include "webkit/glue/webview_impl.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void DragClientImpl::willPerformDragDestinationAction(DragDestinationAction, DragData*)
+{
+ // FIXME
+}
+
+void DragClientImpl::willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard*)
+{
+ // FIXME
+}
+
+DragDestinationAction DragClientImpl::actionMaskForDrag(DragData*)
+{
+ if (m_webView->client() && m_webView->client()->acceptsLoadDrops())
+ return DragDestinationActionAny;
+
+ return static_cast<DragDestinationAction>(
+ DragDestinationActionDHTML | DragDestinationActionEdit);
+}
+
+DragSourceAction DragClientImpl::dragSourceActionMaskForPoint(const IntPoint& windowPoint)
+{
+ // We want to handle drag operations for all source types.
+ return DragSourceActionAny;
+}
+
+void DragClientImpl::startDrag(DragImageRef dragImage,
+ const IntPoint& dragImageOrigin,
+ const IntPoint& eventPos,
+ Clipboard* clipboard,
+ Frame* frame,
+ bool isLinkDrag)
+{
+ // Add a ref to the frame just in case a load occurs mid-drag.
+ RefPtr<Frame> frameProtector = frame;
+
+ WebDragData dragData = static_cast<ClipboardChromium*>(clipboard)->dataObject();
+
+ DragOperation dragOperationMask;
+ if (!clipboard->sourceOperation(dragOperationMask))
+ dragOperationMask = DragOperationEvery;
+
+ m_webView->StartDragging(
+ eventPos, dragData, static_cast<WebDragOperationsMask>(dragOperationMask));
+}
+
+DragImageRef DragClientImpl::createDragImageForLink(KURL&, const String& label, Frame*)
+{
+ // FIXME
+ return 0;
+}
+
+void DragClientImpl::dragControllerDestroyed()
+{
+ // Our lifetime is bound to the WebViewImpl.
+}
+
+} // namespace WebKit
diff --git a/webkit/api/src/DragClientImpl.h b/webkit/api/src/DragClientImpl.h
new file mode 100644
index 0000000..6eea773
--- /dev/null
+++ b/webkit/api/src/DragClientImpl.h
@@ -0,0 +1,76 @@
+/*
+ * 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 DragClientImpl_h
+#define DragClientImpl_h
+
+#include "DragClient.h"
+#include "DragActions.h"
+
+namespace WebCore {
+class ClipBoard;
+class DragData;
+class IntPoint;
+class KURL;
+}
+
+class WebViewImpl;
+
+namespace WebKit {
+
+class DragClientImpl : public WebCore::DragClient {
+public:
+ DragClientImpl(WebViewImpl* webView) : m_webView(webView) { }
+
+ virtual void willPerformDragDestinationAction(
+ WebCore::DragDestinationAction, WebCore::DragData*);
+ virtual void willPerformDragSourceAction(
+ WebCore::DragSourceAction, const WebCore::IntPoint&, WebCore::Clipboard*);
+ virtual WebCore::DragDestinationAction actionMaskForDrag(WebCore::DragData*);
+ virtual WebCore::DragSourceAction dragSourceActionMaskForPoint(
+ const WebCore::IntPoint& windowPoint);
+ virtual void startDrag(
+ WebCore::DragImageRef dragImage,
+ const WebCore::IntPoint& dragImageOrigin,
+ const WebCore::IntPoint& eventPos,
+ WebCore::Clipboard* clipboard,
+ WebCore::Frame* frame,
+ bool isLinkDrag = false);
+ virtual WebCore::DragImageRef createDragImageForLink(
+ WebCore::KURL&, const WebCore::String& label, WebCore::Frame*);
+ virtual void dragControllerDestroyed();
+
+private:
+ WebViewImpl* m_webView;
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/webkit/api/src/InspectorClientImpl.cpp b/webkit/api/src/InspectorClientImpl.cpp
new file mode 100644
index 0000000..2dd3b7c
--- /dev/null
+++ b/webkit/api/src/InspectorClientImpl.cpp
@@ -0,0 +1,262 @@
+/*
+ * 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 "InspectorClientImpl.h"
+
+#include "DOMWindow.h"
+#include "FloatRect.h"
+#include "InspectorController.h"
+#include "Page.h"
+#include "Settings.h"
+#include "WebRect.h"
+#include "WebURL.h"
+#include "WebURLRequest.h"
+#include "WebViewClient.h"
+#include <wtf/Vector.h>
+
+// FIXME: Remove this once WebDevToolsAgentImpl and WebViewImpl move out of glue/.
+#include "webkit/glue/webdevtoolsagent_impl.h"
+#include "webkit/glue/webview_impl.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+InspectorClientImpl::InspectorClientImpl(WebViewImpl* webView)
+ : m_inspectedWebView(webView)
+{
+ ASSERT(m_inspectedWebView);
+}
+
+InspectorClientImpl::~InspectorClientImpl()
+{
+}
+
+void InspectorClientImpl::inspectorDestroyed()
+{
+ // Our lifetime is bound to the WebViewImpl.
+}
+
+Page* InspectorClientImpl::createPage()
+{
+ // This method should never be called in Chrome as inspector front-end lives
+ // in a separate process.
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
+void InspectorClientImpl::showWindow()
+{
+ ASSERT(m_inspectedWebView->GetWebDevToolsAgentImpl());
+ m_inspectedWebView->page()->inspectorController()->setWindowVisible(true);
+}
+
+void InspectorClientImpl::closeWindow()
+{
+ if (m_inspectedWebView->page())
+ m_inspectedWebView->page()->inspectorController()->setWindowVisible(false);
+}
+
+bool InspectorClientImpl::windowVisible()
+{
+ ASSERT(m_inspectedWebView->GetWebDevToolsAgentImpl());
+ return false;
+}
+
+void InspectorClientImpl::attachWindow()
+{
+ // FIXME: Implement this
+}
+
+void InspectorClientImpl::detachWindow()
+{
+ // FIXME: Implement this
+}
+
+void InspectorClientImpl::setAttachedWindowHeight(unsigned int height)
+{
+ // FIXME: Implement this
+ notImplemented();
+}
+
+static void invalidateNodeBoundingRect(WebViewImpl* webView)
+{
+ // FIXME: Is it important to just invalidate the rect of the node region
+ // given that this is not on a critical codepath? In order to do so, we'd
+ // have to take scrolling into account.
+ const WebSize& size = webView->size();
+ WebRect damagedRect(0, 0, size.width, size.height);
+ if (webView->client())
+ webView->client()->didInvalidateRect(damagedRect);
+}
+
+void InspectorClientImpl::highlight(Node* node)
+{
+ // InspectorController does the actually tracking of the highlighted node
+ // and the drawing of the highlight. Here we just make sure to invalidate
+ // the rects of the old and new nodes.
+ hideHighlight();
+}
+
+void InspectorClientImpl::hideHighlight()
+{
+ // FIXME: able to invalidate a smaller rect.
+ invalidateNodeBoundingRect(m_inspectedWebView);
+}
+
+void InspectorClientImpl::inspectedURLChanged(const String& newURL)
+{
+ // FIXME: Implement this
+}
+
+String InspectorClientImpl::localizedStringsURL()
+{
+ notImplemented();
+ return String();
+}
+
+String InspectorClientImpl::hiddenPanels()
+{
+ // Enumerate tabs that are currently disabled.
+ return "scripts,profiles,databases";
+}
+
+void InspectorClientImpl::populateSetting(const String& key, InspectorController::Setting& setting)
+{
+ loadSettings();
+ if (m_settings->contains(key))
+ setting = m_settings->get(key);
+}
+
+void InspectorClientImpl::storeSetting(const String& key, const InspectorController::Setting& setting)
+{
+ loadSettings();
+ m_settings->set(key, setting);
+ saveSettings();
+}
+
+void InspectorClientImpl::removeSetting(const String& key)
+{
+ loadSettings();
+ m_settings->remove(key);
+ saveSettings();
+}
+
+void InspectorClientImpl::inspectorWindowObjectCleared()
+{
+ notImplemented();
+}
+
+void InspectorClientImpl::loadSettings()
+{
+ if (m_settings)
+ return;
+
+ m_settings.set(new SettingsMap);
+ String data = m_inspectedWebView->inspectorSettings();
+ if (data.isEmpty())
+ return;
+
+ Vector<String> entries;
+ data.split("\n", entries);
+ for (Vector<String>::iterator it = entries.begin(); it != entries.end(); ++it) {
+ Vector<String> tokens;
+ it->split(":", tokens);
+ if (tokens.size() != 3)
+ continue;
+
+ String name = decodeURLEscapeSequences(tokens[0]);
+ String type = tokens[1];
+ InspectorController::Setting setting;
+ bool ok = true;
+ if (type == "string")
+ setting.set(decodeURLEscapeSequences(tokens[2]));
+ else if (type == "double")
+ setting.set(tokens[2].toDouble(&ok));
+ else if (type == "integer")
+ setting.set(static_cast<long>(tokens[2].toInt(&ok)));
+ else if (type == "boolean")
+ setting.set(tokens[2] == "true");
+ else
+ continue;
+
+ if (ok)
+ m_settings->set(name, setting);
+ }
+}
+
+void InspectorClientImpl::saveSettings()
+{
+ String data;
+ for (SettingsMap::iterator it = m_settings->begin(); it != m_settings->end(); ++it) {
+ String entry;
+ InspectorController::Setting value = it->second;
+ String name = encodeWithURLEscapeSequences(it->first);
+ switch (value.type()) {
+ case InspectorController::Setting::StringType:
+ entry = String::format(
+ "%s:string:%s",
+ name.utf8().data(),
+ encodeWithURLEscapeSequences(value.string()).utf8().data());
+ break;
+ case InspectorController::Setting::DoubleType:
+ entry = String::format(
+ "%s:double:%f",
+ name.utf8().data(),
+ value.doubleValue());
+ break;
+ case InspectorController::Setting::IntegerType:
+ entry = String::format(
+ "%s:integer:%ld",
+ name.utf8().data(),
+ value.integerValue());
+ break;
+ case InspectorController::Setting::BooleanType:
+ entry = String::format("%s:boolean:%s",
+ name.utf8().data(),
+ value.booleanValue() ? "true" : "false");
+ break;
+ case InspectorController::Setting::StringVectorType:
+ notImplemented();
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+ data.append(entry);
+ data.append("\n");
+ }
+ m_inspectedWebView->setInspectorSettings(data);
+ if (m_inspectedWebView->client())
+ m_inspectedWebView->client()->didUpdateInspectorSettings();
+}
+
+} // namespace WebKit
diff --git a/webkit/api/src/InspectorClientImpl.h b/webkit/api/src/InspectorClientImpl.h
new file mode 100644
index 0000000..aaeff93
--- /dev/null
+++ b/webkit/api/src/InspectorClientImpl.h
@@ -0,0 +1,83 @@
+/*
+ * 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 InspectorClientImpl_h
+#define InspectorClientImpl_h
+
+#include "InspectorClient.h"
+#include "InspectorController.h"
+#include <wtf/OwnPtr.h>
+
+class WebViewImpl;
+
+namespace WebKit {
+
+class InspectorClientImpl : public WebCore::InspectorClient {
+public:
+ InspectorClientImpl(WebViewImpl*);
+ ~InspectorClientImpl();
+
+ // InspectorClient methods:
+ virtual void inspectorDestroyed();
+ virtual WebCore::Page* createPage();
+ virtual WebCore::String localizedStringsURL();
+ virtual WebCore::String hiddenPanels();
+ virtual void showWindow();
+ virtual void closeWindow();
+ virtual bool windowVisible();
+ virtual void attachWindow();
+ virtual void detachWindow();
+ virtual void setAttachedWindowHeight(unsigned height);
+ virtual void highlight(WebCore::Node*);
+ virtual void hideHighlight();
+ virtual void inspectedURLChanged(const WebCore::String& newURL);
+ virtual void populateSetting(
+ const WebCore::String& key,
+ WebCore::InspectorController::Setting&);
+ virtual void storeSetting(
+ const WebCore::String& key,
+ const WebCore::InspectorController::Setting&);
+ virtual void removeSetting(const WebCore::String& key);
+ virtual void inspectorWindowObjectCleared();
+
+private:
+ void loadSettings();
+ void saveSettings();
+
+ // The WebViewImpl of the page being inspected; gets passed to the constructor
+ WebViewImpl* m_inspectedWebView;
+
+ typedef HashMap<WebCore::String, WebCore::InspectorController::Setting> SettingsMap;
+ OwnPtr<SettingsMap> m_settings;
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/webkit/api/src/WebPopupMenuImpl.cpp b/webkit/api/src/WebPopupMenuImpl.cpp
new file mode 100644
index 0000000..299fbaf
--- /dev/null
+++ b/webkit/api/src/WebPopupMenuImpl.cpp
@@ -0,0 +1,311 @@
+/*
+ * 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 "WebPopupMenuImpl.h"
+
+#include <skia/ext/platform_canvas.h>
+
+#include "Cursor.h"
+#include "FramelessScrollView.h"
+#include "FrameView.h"
+#include "IntRect.h"
+#include "PlatformContextSkia.h"
+#include "PlatformKeyboardEvent.h"
+#include "PlatformMouseEvent.h"
+#include "PlatformWheelEvent.h"
+#include "SkiaUtils.h"
+#include "WebInputEvent.h"
+#include "WebRect.h"
+#include "WebWidgetClient.h"
+#include "WebInputEventConversion.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+// WebPopupMenu ---------------------------------------------------------------
+
+WebPopupMenu* WebPopupMenu::create(WebWidgetClient* client)
+{
+ return new WebPopupMenuImpl(client);
+}
+
+// WebWidget ------------------------------------------------------------------
+
+WebPopupMenuImpl::WebPopupMenuImpl(WebWidgetClient* client)
+ : m_client(client)
+ , m_widget(0)
+{
+ // set to impossible point so we always get the first mouse pos
+ m_lastMousePosition = WebPoint(-1, -1);
+}
+
+WebPopupMenuImpl::~WebPopupMenuImpl()
+{
+ if (m_widget)
+ m_widget->setClient(0);
+}
+
+void WebPopupMenuImpl::Init(FramelessScrollView* widget, const WebRect& bounds)
+{
+ m_widget = widget;
+ m_widget->setClient(this);
+
+ if (m_client) {
+ m_client->setWindowRect(bounds);
+ m_client->show(WebNavigationPolicy()); // Policy is ignored
+ }
+}
+
+void WebPopupMenuImpl::MouseMove(const WebMouseEvent& event)
+{
+ // don't send mouse move messages if the mouse hasn't moved.
+ if (event.x != m_lastMousePosition.x || event.y != m_lastMousePosition.y) {
+ m_lastMousePosition = WebPoint(event.x, event.y);
+ m_widget->handleMouseMoveEvent(PlatformMouseEventBuilder(m_widget, event));
+ }
+}
+
+void WebPopupMenuImpl::MouseLeave(const WebMouseEvent& event)
+{
+ m_widget->handleMouseMoveEvent(PlatformMouseEventBuilder(m_widget, event));
+}
+
+void WebPopupMenuImpl::MouseDown(const WebMouseEvent& event)
+{
+ m_widget->handleMouseDownEvent(PlatformMouseEventBuilder(m_widget, event));
+}
+
+void WebPopupMenuImpl::MouseUp(const WebMouseEvent& event)
+{
+ mouseCaptureLost();
+ m_widget->handleMouseReleaseEvent(PlatformMouseEventBuilder(m_widget, event));
+}
+
+void WebPopupMenuImpl::MouseWheel(const WebMouseWheelEvent& event)
+{
+ m_widget->handleWheelEvent(PlatformWheelEventBuilder(m_widget, event));
+}
+
+bool WebPopupMenuImpl::KeyEvent(const WebKeyboardEvent& event)
+{
+ return m_widget->handleKeyEvent(PlatformKeyboardEventBuilder(event));
+}
+
+// WebWidget -------------------------------------------------------------------
+
+void WebPopupMenuImpl::close()
+{
+ if (m_widget)
+ m_widget->hide();
+
+ m_client = 0;
+
+ deref(); // Balances ref() from WebWidget::Create
+}
+
+void WebPopupMenuImpl::resize(const WebSize& newSize)
+{
+ if (m_size == newSize)
+ return;
+ m_size = newSize;
+
+ if (m_widget) {
+ IntRect newGeometry(0, 0, m_size.width, m_size.height);
+ m_widget->setFrameRect(newGeometry);
+ }
+
+ if (m_client) {
+ WebRect damagedRect(0, 0, m_size.width, m_size.height);
+ m_client->didInvalidateRect(damagedRect);
+ }
+}
+
+void WebPopupMenuImpl::layout()
+{
+}
+
+void WebPopupMenuImpl::paint(WebCanvas* canvas, const WebRect& rect)
+{
+ if (!m_widget)
+ return;
+
+ if (!rect.isEmpty()) {
+#if WEBKIT_USING_CG
+ GraphicsContext gc(canvas);
+#elif WEBKIT_USING_SKIA
+ PlatformContextSkia context(canvas);
+ // PlatformGraphicsContext is actually a pointer to PlatformContextSkia.
+ GraphicsContext gc(reinterpret_cast<PlatformGraphicsContext*>(&context));
+#else
+ notImplemented();
+#endif
+ m_widget->paint(&gc, rect);
+ }
+}
+
+bool WebPopupMenuImpl::handleInputEvent(const WebInputEvent& inputEvent)
+{
+ if (!m_widget)
+ return false;
+
+ // TODO (jcampan): WebKit seems to always return false on mouse events
+ // methods. For now we'll assume it has processed them (as we are only
+ // interested in whether keyboard events are processed).
+ switch (inputEvent.type) {
+ case WebInputEvent::MouseMove:
+ MouseMove(*static_cast<const WebMouseEvent*>(&inputEvent));
+ return true;
+
+ case WebInputEvent::MouseLeave:
+ MouseLeave(*static_cast<const WebMouseEvent*>(&inputEvent));
+ return true;
+
+ case WebInputEvent::MouseWheel:
+ MouseWheel(*static_cast<const WebMouseWheelEvent*>(&inputEvent));
+ return true;
+
+ case WebInputEvent::MouseDown:
+ MouseDown(*static_cast<const WebMouseEvent*>(&inputEvent));
+ return true;
+
+ case WebInputEvent::MouseUp:
+ MouseUp(*static_cast<const WebMouseEvent*>(&inputEvent));
+ return true;
+
+ // In Windows, RawKeyDown only has information about the physical key, but
+ // for "selection", we need the information about the character the key
+ // translated into. For English, the physical key value and the character
+ // value are the same, hence, "selection" works for English. But for other
+ // languages, such as Hebrew, the character value is different from the
+ // physical key value. Thus, without accepting Char event type which
+ // contains the key's character value, the "selection" won't work for
+ // non-English languages, such as Hebrew.
+ case WebInputEvent::RawKeyDown:
+ case WebInputEvent::KeyDown:
+ case WebInputEvent::KeyUp:
+ case WebInputEvent::Char:
+ return KeyEvent(*static_cast<const WebKeyboardEvent*>(&inputEvent));
+
+ default:
+ break;
+ }
+ return false;
+}
+
+void WebPopupMenuImpl::mouseCaptureLost()
+{
+}
+
+void WebPopupMenuImpl::setFocus(bool enable)
+{
+}
+
+bool WebPopupMenuImpl::handleCompositionEvent(
+ WebCompositionCommand command, int cursorPosition, int targetStart,
+ int targetEnd, const WebString& imeString)
+{
+ return false;
+}
+
+bool WebPopupMenuImpl::queryCompositionStatus(bool* enabled, WebRect* caretRect)
+{
+ return false;
+}
+
+void WebPopupMenuImpl::setTextDirection(WebTextDirection direction)
+{
+}
+
+
+//-----------------------------------------------------------------------------
+// WebCore::HostWindow
+
+void WebPopupMenuImpl::repaint(const IntRect& paintRect,
+ bool contentChanged,
+ bool immediate,
+ bool repaintContentOnly)
+{
+ // Ignore spurious calls.
+ if (!contentChanged || paintRect.isEmpty())
+ return;
+ if (m_client)
+ m_client->didInvalidateRect(paintRect);
+}
+
+void WebPopupMenuImpl::scroll(const IntSize& scrollDelta,
+ const IntRect& scrollRect,
+ const IntRect& clipRect)
+{
+ if (m_client) {
+ int dx = scrollDelta.width();
+ int dy = scrollDelta.height();
+ m_client->didScrollRect(dx, dy, clipRect);
+ }
+}
+
+IntPoint WebPopupMenuImpl::screenToWindow(const IntPoint& point) const
+{
+ notImplemented();
+ return IntPoint();
+}
+
+IntRect WebPopupMenuImpl::windowToScreen(const IntRect& rect) const
+{
+ notImplemented();
+ return IntRect();
+}
+
+void WebPopupMenuImpl::scrollRectIntoView(const IntRect&, const ScrollView*) const
+{
+ // Nothing to be done here since we do not have the concept of a container
+ // that implements its own scrolling.
+}
+
+void WebPopupMenuImpl::scrollbarsModeDidChange() const
+{
+ // Nothing to be done since we have no concept of different scrollbar modes.
+}
+
+//-----------------------------------------------------------------------------
+// WebCore::FramelessScrollViewClient
+
+void WebPopupMenuImpl::popupClosed(FramelessScrollView* widget)
+{
+ ASSERT(widget == m_widget);
+ if (m_widget) {
+ m_widget->setClient(0);
+ m_widget = 0;
+ }
+ m_client->closeWidgetSoon();
+}
+
+} // namespace WebKit
diff --git a/webkit/api/src/WebPopupMenuImpl.h b/webkit/api/src/WebPopupMenuImpl.h
new file mode 100644
index 0000000..13eb674
--- /dev/null
+++ b/webkit/api/src/WebPopupMenuImpl.h
@@ -0,0 +1,128 @@
+/*
+ * 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 WebPopupMenuImpl_h
+#define WebPopupMenuImpl_h
+
+// FIXME: Add this to FramelessScrollViewClient.h
+namespace WebCore { class FramelessScrollView; }
+
+#include "FramelessScrollViewClient.h"
+// FIXME: remove the relative paths once glue/ consumers are removed.
+#include "../public/WebPoint.h"
+#include "../public/WebPopupMenu.h"
+#include "../public/WebSize.h"
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+class Frame;
+class FramelessScrollView;
+class KeyboardEvent;
+class Page;
+class PlatformKeyboardEvent;
+class Range;
+class Widget;
+}
+
+namespace WebKit {
+class WebKeyboardEvent;
+class WebMouseEvent;
+class WebMouseWheelEvent;
+struct WebRect;
+
+class WebPopupMenuImpl : public WebPopupMenu,
+ public WebCore::FramelessScrollViewClient,
+ public RefCounted<WebPopupMenuImpl> {
+public:
+ // WebWidget
+ virtual void close();
+ virtual WebSize size() { return m_size; }
+ virtual void resize(const WebSize&);
+ virtual void layout();
+ virtual void paint(WebCanvas* canvas, const WebRect& rect);
+ virtual bool handleInputEvent(const WebInputEvent&);
+ virtual void mouseCaptureLost();
+ virtual void setFocus(bool enable);
+ virtual bool handleCompositionEvent(
+ WebCompositionCommand command, int cursorPosition,
+ int targetStart, int targetEnd, const WebString& text);
+ virtual bool queryCompositionStatus(bool* enabled, WebRect* caretRect);
+ virtual void setTextDirection(WebTextDirection direction);
+
+ // WebPopupMenuImpl
+ void Init(WebCore::FramelessScrollView* widget,
+ const WebRect& bounds);
+
+ WebWidgetClient* client() { return m_client; }
+
+ void MouseMove(const WebMouseEvent&);
+ void MouseLeave(const WebMouseEvent&);
+ void MouseDown(const WebMouseEvent&);
+ void MouseUp(const WebMouseEvent&);
+ void MouseDoubleClick(const WebMouseEvent&);
+ void MouseWheel(const WebMouseWheelEvent&);
+ bool KeyEvent(const WebKeyboardEvent&);
+
+ protected:
+ friend class WebPopupMenu; // For WebPopupMenu::create
+ friend class WTF::RefCounted<WebPopupMenuImpl>;
+
+ WebPopupMenuImpl(WebWidgetClient* client);
+ ~WebPopupMenuImpl();
+
+ // WebCore::HostWindow methods:
+ virtual void repaint(
+ const WebCore::IntRect&, bool contentChanged, bool immediate = false,
+ bool repaintContentOnly = false);
+ virtual void scroll(
+ const WebCore::IntSize& scrollDelta, const WebCore::IntRect& scrollRect,
+ 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 scrollRectIntoView(const WebCore::IntRect&, const WebCore::ScrollView*) const;
+ virtual void scrollbarsModeDidChange() const;
+
+ // WebCore::FramelessScrollViewClient methods:
+ virtual void popupClosed(WebCore::FramelessScrollView*);
+
+ WebWidgetClient* m_client;
+ WebSize m_size;
+
+ WebPoint m_lastMousePosition;
+
+ // This is a non-owning ref. The popup will notify us via popupClosed()
+ // before it is destroyed.
+ WebCore::FramelessScrollView* m_widget;
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/webkit/glue/back_forward_list_client_impl.cc b/webkit/glue/back_forward_list_client_impl.cc
deleted file mode 100644
index c6a0661..0000000
--- a/webkit/glue/back_forward_list_client_impl.cc
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this
-// source code is governed by a BSD-style license that can be found in the
-// LICENSE file.
-
-#include "config.h"
-
-#include "HistoryItem.h"
-#undef LOG
-
-#include "webkit/api/public/WebViewClient.h"
-#include "webkit/glue/back_forward_list_client_impl.h"
-#include "webkit/glue/webview_impl.h"
-
-namespace webkit_glue {
-
-const char kBackForwardNavigationScheme[] = "chrome-back-forward";
-
-BackForwardListClientImpl::BackForwardListClientImpl(WebViewImpl* webview)
- : webview_(webview) {
-}
-
-BackForwardListClientImpl::~BackForwardListClientImpl() {
-}
-
-void BackForwardListClientImpl::SetCurrentHistoryItem(
- WebCore::HistoryItem* item) {
- previous_item_ = current_item_;
- current_item_ = item;
-}
-
-WebCore::HistoryItem* BackForwardListClientImpl::GetPreviousHistoryItem()
- const {
- return previous_item_.get();
-}
-
-void BackForwardListClientImpl::addItem(PassRefPtr<WebCore::HistoryItem> item) {
- previous_item_ = current_item_;
- current_item_ = item;
-
- // If WebCore adds a new HistoryItem, it means this is a new navigation (ie,
- // not a reload or back/forward).
- webview_->ObserveNewNavigation();
-
- if (webview_->client())
- webview_->client()->didAddHistoryItem();
-}
-
-void BackForwardListClientImpl::goToItem(WebCore::HistoryItem* item) {
- previous_item_ = current_item_;
- current_item_ = item;
-
- if (pending_history_item_ == item)
- pending_history_item_ = NULL;
-}
-
-WebCore::HistoryItem* BackForwardListClientImpl::currentItem() {
- return current_item_.get();
-}
-
-WebCore::HistoryItem* BackForwardListClientImpl::itemAtIndex(int index) {
- if (!webview_->client())
- return NULL;
-
- // Since we don't keep the entire back/forward list, we have no way to
- // properly implement this method. We return a dummy entry instead that we
- // intercept in our FrameLoaderClient implementation in case WebCore asks
- // to navigate to this HistoryItem.
-
- // TODO(darin): We should change WebCore to handle history.{back,forward,go}
- // differently. It should perhaps just ask the FrameLoaderClient to perform
- // those navigations.
-
- WebCore::String url_string = WebCore::String::format(
- "%s://go/%d", kBackForwardNavigationScheme, index);
-
- pending_history_item_ =
- WebCore::HistoryItem::create(url_string, WebCore::String(), 0.0);
- return pending_history_item_.get();
-}
-
-int BackForwardListClientImpl::backListCount() {
- if (!webview_->client())
- return 0;
-
- return webview_->client()->historyBackListCount();
-}
-
-int BackForwardListClientImpl::forwardListCount() {
- if (!webview_->client())
- return 0;
-
- return webview_->client()->historyForwardListCount();
-}
-
-void BackForwardListClientImpl::close() {
- current_item_ = NULL;
- previous_item_ = NULL;
- pending_history_item_ = NULL;
-}
-
-} // namespace webkit_glue
diff --git a/webkit/glue/back_forward_list_client_impl.h b/webkit/glue/back_forward_list_client_impl.h
deleted file mode 100644
index 85f08fc..0000000
--- a/webkit/glue/back_forward_list_client_impl.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this
-// source code is governed by a BSD-style license that can be found in the
-// LICENSE file.
-
-#ifndef WEBKIT_GLUE_BACK_FORWARD_LIST_CLIENT_IMPL_H_
-#define WEBKIT_GLUE_BACK_FORWARD_LIST_CLIENT_IMPL_H_
-
-#include "BackForwardList.h"
-
-class WebViewImpl;
-
-namespace webkit_glue {
-
-extern const char kBackForwardNavigationScheme[];
-
-class BackForwardListClientImpl : public WebCore::BackForwardListClient {
- public:
- BackForwardListClientImpl(WebViewImpl* webview);
- ~BackForwardListClientImpl();
-
- void SetCurrentHistoryItem(WebCore::HistoryItem* item);
- WebCore::HistoryItem* GetPreviousHistoryItem() const;
-
- private:
- // WebCore::BackForwardListClient methods:
- virtual void addItem(PassRefPtr<WebCore::HistoryItem> item);
- virtual void goToItem(WebCore::HistoryItem* item);
- virtual WebCore::HistoryItem* currentItem();
- virtual WebCore::HistoryItem* itemAtIndex(int index);
- virtual int backListCount();
- virtual int forwardListCount();
- virtual void close();
-
- WebViewImpl* webview_;
-
- RefPtr<WebCore::HistoryItem> previous_item_;
- RefPtr<WebCore::HistoryItem> current_item_;
-
- // The last history item that was accessed via itemAtIndex(). We keep track
- // of this until goToItem() is called, so we can track the navigation.
- RefPtr<WebCore::HistoryItem> pending_history_item_;
-};
-
-} // namespace webkit_glue
-
-#endif // WEBKIT_GLUE_BACK_FORWARD_LIST_CLIENT_IMPL_H_
diff --git a/webkit/glue/chrome_client_impl.cc b/webkit/glue/chrome_client_impl.cc
deleted file mode 100644
index 135cda2..0000000
--- a/webkit/glue/chrome_client_impl.cc
+++ /dev/null
@@ -1,632 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "config.h"
-
-#include "AccessibilityObject.h"
-#include "AXObjectCache.h"
-#include "CharacterNames.h"
-#include "Console.h"
-#include "Cursor.h"
-#include "Document.h"
-#include "DocumentLoader.h"
-#include "DatabaseTracker.h"
-#include "FloatRect.h"
-#include "FileChooser.h"
-#include "FrameLoadRequest.h"
-#include "FrameView.h"
-#include "HitTestResult.h"
-#include "IntRect.h"
-#include "Node.h"
-#include "Page.h"
-#include "PopupMenuChromium.h"
-#include "ScriptController.h"
-#include "WindowFeatures.h"
-#if USE(V8)
-#include "V8Proxy.h"
-#endif
-#undef LOG
-
-#include "webkit/api/public/WebAccessibilityObject.h"
-#include "webkit/api/public/WebConsoleMessage.h"
-#include "webkit/api/public/WebCursorInfo.h"
-#include "webkit/api/public/WebFileChooserCompletion.h"
-#include "webkit/api/public/WebFrameClient.h"
-#include "webkit/api/public/WebInputEvent.h"
-#include "webkit/api/public/WebKit.h"
-#include "webkit/api/public/WebPopupMenuInfo.h"
-#include "webkit/api/public/WebRect.h"
-#include "webkit/api/public/WebTextDirection.h"
-#include "webkit/api/public/WebURLRequest.h"
-#include "webkit/api/public/WebViewClient.h"
-#include "webkit/api/src/NotificationPresenterImpl.h"
-#include "webkit/api/src/WebFileChooserCompletionImpl.h"
-#include "webkit/api/src/WrappedResourceRequest.h"
-#include "webkit/glue/chrome_client_impl.h"
-#include "webkit/glue/glue_util.h"
-#include "webkit/glue/webframe_impl.h"
-#include "webkit/glue/webpopupmenu_impl.h"
-#include "webkit/glue/webview_impl.h"
-
-using WebCore::PopupContainer;
-using WebCore::PopupItem;
-
-using WebKit::WebAccessibilityObject;
-using WebKit::WebConsoleMessage;
-using WebKit::WebCursorInfo;
-using WebKit::WebFileChooserCompletionImpl;
-using WebKit::WebInputEvent;
-using WebKit::WebMouseEvent;
-using WebKit::WebNavigationPolicy;
-using WebKit::WebPopupMenuInfo;
-using WebKit::WebRect;
-using WebKit::WebString;
-using WebKit::WebTextDirection;
-using WebKit::WebURL;
-using WebKit::WebURLRequest;
-using WebKit::WebVector;
-using WebKit::WebViewClient;
-using WebKit::WebWidget;
-using WebKit::WrappedResourceRequest;
-
-using webkit_glue::AccessibilityObjectToWebAccessibilityObject;
-
-ChromeClientImpl::ChromeClientImpl(WebViewImpl* webview)
- : webview_(webview),
- toolbars_visible_(true),
- statusbar_visible_(true),
- scrollbars_visible_(true),
- menubar_visible_(true),
- resizable_(true),
- ignore_next_set_cursor_(false) {
-}
-
-ChromeClientImpl::~ChromeClientImpl() {
-}
-
-void ChromeClientImpl::chromeDestroyed() {
- // Our lifetime is bound to the WebViewImpl.
-}
-
-void ChromeClientImpl::setWindowRect(const WebCore::FloatRect& r) {
- if (webview_->client()) {
- webview_->client()->setWindowRect(
- webkit_glue::IntRectToWebRect(WebCore::IntRect(r)));
- }
-}
-
-WebCore::FloatRect ChromeClientImpl::windowRect() {
- WebRect rect;
- if (webview_->client()) {
- rect = 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 = webview_->size().width;
- rect.height = webview_->size().height;
- }
- return WebCore::FloatRect(webkit_glue::WebRectToIntRect(rect));
-}
-
-WebCore::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 (!webview_->client())
- return;
-
- webview_->client()->didFocus();
-
- // If accessibility is enabled, we should notify assistive technology that
- // the active AccessibilityObject changed.
- const WebCore::Frame* frame = webview_->GetFocusedWebCoreFrame();
- if (!frame)
- return;
-
- WebCore::Document* doc = frame->document();
-
- if (doc && doc->axObjectCache()->accessibilityEnabled()) {
- WebCore::Node* focused_node = webview_->GetFocusedNode();
-
- if (!focused_node) {
- // Could not retrieve focused Node.
- return;
- }
-
- // Retrieve the focused AccessibilityObject.
- WebCore::AccessibilityObject* focused_acc_obj =
- doc->axObjectCache()->getOrCreate(focused_node->renderer());
-
- // Alert assistive technology that focus changed.
- if (focused_acc_obj) {
- webview_->client()->focusAccessibilityObject(
- AccessibilityObjectToWebAccessibilityObject(focused_acc_obj));
- }
- }
-}
-
-void ChromeClientImpl::unfocus() {
- if (webview_->client())
- webview_->client()->didBlur();
-}
-
-bool ChromeClientImpl::canTakeFocus(WebCore::FocusDirection) {
- // For now the browser can always take focus if we're not running layout
- // tests.
- return !WebKit::layoutTestMode();
-}
-
-void ChromeClientImpl::takeFocus(WebCore::FocusDirection direction) {
- if (!webview_->client())
- return;
- if (direction == WebCore::FocusDirectionBackward) {
- webview_->client()->focusPrevious();
- } else {
- webview_->client()->focusNext();
- }
-}
-
-WebCore::Page* ChromeClientImpl::createWindow(
- WebCore::Frame* frame, const WebCore::FrameLoadRequest& r,
- const WebCore::WindowFeatures& features) {
- if (!webview_->client())
- return NULL;
-
- WebViewImpl* new_view = static_cast<WebViewImpl*>(
- webview_->client()->createView(WebFrameImpl::FromFrame(frame)));
- if (!new_view)
- return NULL;
-
- // 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());
- new_view->main_frame()->loadRequest(request);
- }
-
- return new_view->page();
-}
-
-static inline bool CurrentEventShouldCauseBackgroundTab(
- const WebInputEvent* input_event) {
- if (!input_event)
- return false;
-
- if (input_event->type != WebInputEvent::MouseUp)
- return false;
-
- const WebMouseEvent* mouse_event =
- static_cast<const WebMouseEvent*>(input_event);
-
- WebNavigationPolicy policy;
- unsigned short button_number;
- switch (mouse_event->button) {
- case WebMouseEvent::ButtonLeft:
- button_number = 0;
- break;
- case WebMouseEvent::ButtonMiddle:
- button_number = 1;
- break;
- case WebMouseEvent::ButtonRight:
- button_number = 2;
- break;
- default:
- return false;
- }
- bool ctrl = mouse_event->modifiers & WebMouseEvent::ControlKey;
- bool shift = mouse_event->modifiers & WebMouseEvent::ShiftKey;
- bool alt = mouse_event->modifiers & WebMouseEvent::AltKey;
- bool meta = mouse_event->modifiers & WebMouseEvent::MetaKey;
-
- if (!WebViewImpl::NavigationPolicyFromMouseEvent(button_number, ctrl,
- shift, alt, meta, &policy))
- return false;
-
- return policy == WebKit::WebNavigationPolicyNewBackgroundTab;
-}
-
-void ChromeClientImpl::show() {
- if (!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 as_popup =
- !toolbars_visible_ ||
- !statusbar_visible_ ||
- !scrollbars_visible_ ||
- !menubar_visible_ ||
- !resizable_;
-
- WebNavigationPolicy policy = WebKit::WebNavigationPolicyNewForegroundTab;
- if (as_popup)
- policy = WebKit::WebNavigationPolicyNewPopup;
- if (CurrentEventShouldCauseBackgroundTab(
- WebViewImpl::current_input_event()))
- policy = WebKit::WebNavigationPolicyNewBackgroundTab;
-
- webview_->client()->show(policy);
-}
-
-bool ChromeClientImpl::canRunModal() {
- return webview_->client() != NULL;
-}
-
-void ChromeClientImpl::runModal() {
- if (webview_->client())
- webview_->client()->runModal();
-}
-
-void ChromeClientImpl::setToolbarsVisible(bool value) {
- toolbars_visible_ = value;
-}
-
-bool ChromeClientImpl::toolbarsVisible() {
- return toolbars_visible_;
-}
-
-void ChromeClientImpl::setStatusbarVisible(bool value) {
- statusbar_visible_ = value;
-}
-
-bool ChromeClientImpl::statusbarVisible() {
- return statusbar_visible_;
-}
-
-void ChromeClientImpl::setScrollbarsVisible(bool value) {
- scrollbars_visible_ = value;
- WebFrameImpl* web_frame = static_cast<WebFrameImpl*>(webview_->mainFrame());
- if (web_frame)
- web_frame->SetAllowsScrolling(value);
-}
-
-bool ChromeClientImpl::scrollbarsVisible() {
- return scrollbars_visible_;
-}
-
-void ChromeClientImpl::setMenubarVisible(bool value) {
- menubar_visible_ = value;
-}
-
-bool ChromeClientImpl::menubarVisible() {
- return menubar_visible_;
-}
-
-void ChromeClientImpl::setResizable(bool value) {
- resizable_ = value;
-}
-
-void ChromeClientImpl::addMessageToConsole(WebCore::MessageSource source,
- WebCore::MessageType type,
- WebCore::MessageLevel level,
- const WebCore::String& message,
- unsigned int line_no,
- const WebCore::String& source_id) {
- if (webview_->client()) {
- webview_->client()->didAddMessageToConsole(
- WebConsoleMessage(static_cast<WebConsoleMessage::Level>(level),
- webkit_glue::StringToWebString(message)),
- webkit_glue::StringToWebString(source_id),
- line_no);
- }
-}
-
-bool ChromeClientImpl::canRunBeforeUnloadConfirmPanel() {
- return webview_->client() != NULL;
-}
-
-bool ChromeClientImpl::runBeforeUnloadConfirmPanel(
- const WebCore::String& message,
- WebCore::Frame* frame) {
- if (webview_->client()) {
- return webview_->client()->runModalBeforeUnloadDialog(
- WebFrameImpl::FromFrame(frame),
- webkit_glue::StringToWebString(message));
- }
- return false;
-}
-
-void ChromeClientImpl::closeWindowSoon() {
- // Make sure this Page can no longer be found by JS.
- webview_->page()->setGroupName(WebCore::String());
-
- // Make sure that all loading is stopped. Ensures that JS stops executing!
- webview_->mainFrame()->stopLoading();
-
- if (webview_->client())
- webview_->client()->closeWidgetSoon();
-}
-
-// Although a WebCore::Frame is passed in, we don't actually use it, since we
-// already know our own webview_.
-void ChromeClientImpl::runJavaScriptAlert(WebCore::Frame* frame,
- const WebCore::String& message) {
- if (webview_->client()) {
-#if USE(V8)
- // Before showing the JavaScript dialog, we give the proxy implementation
- // a chance to process any pending console messages.
- WebCore::V8Proxy::processConsoleMessages();
-#endif
- webview_->client()->runModalAlertDialog(
- WebFrameImpl::FromFrame(frame),
- webkit_glue::StringToWebString(message));
- }
-}
-
-// See comments for runJavaScriptAlert().
-bool ChromeClientImpl::runJavaScriptConfirm(WebCore::Frame* frame,
- const WebCore::String& message) {
- if (webview_->client()) {
- return webview_->client()->runModalConfirmDialog(
- WebFrameImpl::FromFrame(frame),
- webkit_glue::StringToWebString(message));
- }
- return false;
-}
-
-// See comments for runJavaScriptAlert().
-bool ChromeClientImpl::runJavaScriptPrompt(WebCore::Frame* frame,
- const WebCore::String& message,
- const WebCore::String& default_value,
- WebCore::String& result) {
- if (webview_->client()) {
- WebString actual_value;
- bool ok = webview_->client()->runModalPromptDialog(
- WebFrameImpl::FromFrame(frame),
- webkit_glue::StringToWebString(message),
- webkit_glue::StringToWebString(default_value),
- &actual_value);
- if (ok)
- result = webkit_glue::WebStringToString(actual_value);
- return ok;
- }
- return false;
-}
-
-void ChromeClientImpl::setStatusbarText(const WebCore::String& message) {
- if (webview_->client()) {
- webview_->client()->setStatusText(
- webkit_glue::StringToWebString(message));
- }
-}
-
-bool ChromeClientImpl::shouldInterruptJavaScript() {
- // TODO(mbelshe): implement me
- return false;
-}
-
-bool ChromeClientImpl::tabsToLinks() const {
- return webview_->tabsToLinks();
-}
-
-WebCore::IntRect ChromeClientImpl::windowResizerRect() const {
- WebCore::IntRect result;
- if (webview_->client()) {
- result = webkit_glue::WebRectToIntRect(
- webview_->client()->windowResizerRect());
- }
- return result;
-}
-
-void ChromeClientImpl::repaint(
- const WebCore::IntRect& paint_rect, bool content_changed, bool immediate,
- bool repaint_content_only) {
- // Ignore spurious calls.
- if (!content_changed || paint_rect.isEmpty())
- return;
- if (webview_->client()) {
- webview_->client()->didInvalidateRect(
- webkit_glue::IntRectToWebRect(paint_rect));
- }
-}
-
-void ChromeClientImpl::scroll(
- const WebCore::IntSize& scroll_delta, const WebCore::IntRect& scroll_rect,
- const WebCore::IntRect& clip_rect) {
- if (webview_->client()) {
- int dx = scroll_delta.width();
- int dy = scroll_delta.height();
- webview_->client()->didScrollRect(
- dx, dy, webkit_glue::IntRectToWebRect(clip_rect));
- }
-}
-
-WebCore::IntPoint ChromeClientImpl::screenToWindow(
- const WebCore::IntPoint&) const {
- notImplemented();
- return WebCore::IntPoint();
-}
-
-WebCore::IntRect ChromeClientImpl::windowToScreen(
- const WebCore::IntRect& rect) const {
- WebCore::IntRect screen_rect(rect);
-
- if (webview_->client()) {
- WebRect window_rect = webview_->client()->windowRect();
- screen_rect.move(window_rect.x, window_rect.y);
- }
-
- return screen_rect;
-}
-
-void ChromeClientImpl::contentsSizeChanged(WebCore::Frame* frame, const
- WebCore::IntSize& size) const {
- WebFrameImpl* webframe = WebFrameImpl::FromFrame(frame);
- if (webframe->client()) {
- webframe->client()->didChangeContentsSize(
- webframe, webkit_glue::IntSizeToWebSize(size));
- }
-}
-
-void ChromeClientImpl::scrollbarsModeDidChange() const {
-}
-
-void ChromeClientImpl::mouseDidMoveOverElement(
- const WebCore::HitTestResult& result, unsigned modifier_flags) {
- if (!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()) {
- webview_->client()->setMouseOverURL(
- webkit_glue::KURLToWebURL(result.absoluteLinkURL()));
- } else {
- webview_->client()->setMouseOverURL(WebURL());
- }
-}
-
-void ChromeClientImpl::setToolTip(const WebCore::String& tooltip_text,
- WebCore::TextDirection dir) {
- if (!webview_->client())
- return;
- WebTextDirection text_direction = (dir == WebCore::RTL) ?
- WebKit::WebTextDirectionRightToLeft :
- WebKit::WebTextDirectionLeftToRight;
- webview_->client()->setToolTipText(
- webkit_glue::StringToWebString(tooltip_text), text_direction);
-}
-
-void ChromeClientImpl::print(WebCore::Frame* frame) {
- if (webview_->client())
- webview_->client()->printPage(WebFrameImpl::FromFrame(frame));
-}
-
-void ChromeClientImpl::exceededDatabaseQuota(WebCore::Frame* frame,
- const WebCore::String& databaseName) {
- // set a reasonable quota for now -- 5Mb should be enough for anybody
- // TODO(dglazkov): this should be configurable
- WebCore::SecurityOrigin* origin = frame->document()->securityOrigin();
- WebCore::DatabaseTracker::tracker().setQuota(origin, 1024 * 1024 * 5);
-}
-
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-void ChromeClientImpl::reachedMaxAppCacheSize(int64_t space_needed) {
- ASSERT_NOT_REACHED();
-}
-#endif
-
-void ChromeClientImpl::runOpenPanel(WebCore::Frame* frame,
- PassRefPtr<WebCore::FileChooser> file_chooser) {
- WebViewClient* client = webview_->client();
- if (!client)
- return;
-
- bool multiple_files = file_chooser->allowsMultipleFiles();
-
- WebString suggestion;
- if (file_chooser->filenames().size() > 0)
- suggestion = webkit_glue::StringToWebString(file_chooser->filenames()[0]);
-
- WebFileChooserCompletionImpl* chooser_completion =
- new WebFileChooserCompletionImpl(file_chooser);
- bool ok = client->runFileChooser(multiple_files,
- WebString(),
- suggestion,
- chooser_completion);
- if (!ok) {
- // Choosing failed, so do callback with an empty list.
- chooser_completion->didChooseFile(WebVector<WebString>());
- }
-}
-
-void ChromeClientImpl::popupOpened(PopupContainer* popup_container,
- const WebCore::IntRect& bounds,
- bool activatable,
- bool handle_externally) {
- if (!webview_->client())
- return;
-
- WebWidget* webwidget;
- if (handle_externally) {
- WebPopupMenuInfo popup_info;
- GetPopupMenuInfo(popup_container, &popup_info);
- webwidget = webview_->client()->createPopupMenu(popup_info);
- } else {
- webwidget = webview_->client()->createPopupMenu(activatable);
- }
-
- static_cast<WebPopupMenuImpl*>(webwidget)->Init(
- popup_container, webkit_glue::IntRectToWebRect(bounds));
-}
-
-void ChromeClientImpl::SetCursor(const WebCursorInfo& cursor) {
- if (ignore_next_set_cursor_) {
- ignore_next_set_cursor_ = false;
- return;
- }
-
- if (webview_->client())
- 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.
- ignore_next_set_cursor_ = true;
-}
-
-void ChromeClientImpl::formStateDidChange(const WebCore::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* popup_container,
- WebPopupMenuInfo* info) {
- const Vector<PopupItem*>& input_items = popup_container->popupData();
-
- WebVector<WebPopupMenuInfo::Item> output_items(input_items.size());
-
- for (size_t i = 0; i < input_items.size(); ++i) {
- const PopupItem& input_item = *input_items[i];
- WebPopupMenuInfo::Item& output_item = output_items[i];
-
- output_item.label = webkit_glue::StringToWebString(input_item.label);
- output_item.enabled = input_item.enabled;
-
- switch (input_item.type) {
- case PopupItem::TypeOption:
- output_item.type = WebPopupMenuInfo::Item::Option;
- break;
- case PopupItem::TypeGroup:
- output_item.type = WebPopupMenuInfo::Item::Group;
- break;
- case PopupItem::TypeSeparator:
- output_item.type = WebPopupMenuInfo::Item::Separator;
- break;
- default:
- ASSERT_NOT_REACHED();
- }
- }
-
- info->itemHeight = popup_container->menuItemHeight();
- info->selectedIndex = popup_container->selectedIndex();
- info->items.swap(output_items);
-}
-
-#if ENABLE(NOTIFICATIONS)
-WebCore::NotificationPresenter* ChromeClientImpl::notificationPresenter() const {
- return webview_->GetNotificationPresenter();
-}
-#endif
diff --git a/webkit/glue/chrome_client_impl.h b/webkit/glue/chrome_client_impl.h
deleted file mode 100644
index 4591fae..0000000
--- a/webkit/glue/chrome_client_impl.h
+++ /dev/null
@@ -1,164 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef WEBKIT_GLUE_CHROME_CLIENT_IMPL_H_
-#define WEBKIT_GLUE_CHROME_CLIENT_IMPL_H_
-
-#include "ChromeClientChromium.h"
-
-class WebViewImpl;
-
-namespace WebCore {
-class HTMLParserQuirks;
-class PopupContainer;
-class SecurityOrigin;
-struct WindowFeatures;
-}
-
-namespace WebKit {
-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 webview_; }
-
- 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 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 source,
- WebCore::MessageType type,
- WebCore::MessageLevel level,
- const WebCore::String& message,
- unsigned int lineNumber,
- const WebCore::String& sourceID);
-
- virtual bool canRunBeforeUnloadConfirmPanel();
- virtual bool runBeforeUnloadConfirmPanel(const WebCore::String& message,
- WebCore::Frame* 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();
-
- // 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.
- 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 NULL; }
- 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& tooltip_text,
- WebCore::TextDirection dir);
-
- virtual void print(WebCore::Frame*);
-
- virtual void exceededDatabaseQuota(WebCore::Frame*,
- const WebCore::String& databaseName);
-
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
- virtual void reachedMaxAppCacheSize(int64_t space_needed);
-#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 popupOpened(WebCore::PopupContainer* popup_container,
- const WebCore::IntRect& bounds,
- bool activatable,
- bool handle_externally);
-
- void SetCursor(const WebKit::WebCursorInfo& cursor);
- void SetCursorForPlugin(const WebKit::WebCursorInfo& cursor);
-
- virtual void formStateDidChange(const WebCore::Node*);
-
- virtual PassOwnPtr<WebCore::HTMLParserQuirks> createHTMLParserQuirks() { return 0; }
-
-#if ENABLE(NOTIFICATIONS)
- virtual WebCore::NotificationPresenter* notificationPresenter() const;
-#endif
-
- private:
- void GetPopupMenuInfo(WebCore::PopupContainer* popup_container,
- WebKit::WebPopupMenuInfo* info);
-
- WebViewImpl* webview_; // weak pointer
- bool toolbars_visible_;
- bool statusbar_visible_;
- bool scrollbars_visible_;
- bool menubar_visible_;
- bool resizable_;
- // Set to true if the next SetCursor is to be ignored.
- bool ignore_next_set_cursor_;
-};
-
-#endif // WEBKIT_GLUE_CHROME_CLIENT_IMPL_H_
diff --git a/webkit/glue/dragclient_impl.cc b/webkit/glue/dragclient_impl.cc
deleted file mode 100644
index 0f8ae18..0000000
--- a/webkit/glue/dragclient_impl.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "config.h"
-
-#include "ChromiumDataObject.h"
-#include "ClipboardChromium.h"
-#include "Frame.h"
-#undef LOG
-
-#include "webkit/api/public/WebDragData.h"
-#include "webkit/api/public/WebViewClient.h"
-#include "webkit/glue/dragclient_impl.h"
-#include "webkit/glue/glue_util.h"
-#include "webkit/glue/webview_impl.h"
-
-using WebKit::WebDragData;
-using WebKit::WebPoint;
-
-void DragClientImpl::willPerformDragDestinationAction(
- WebCore::DragDestinationAction,
- WebCore::DragData*) {
- // FIXME
-}
-
-void DragClientImpl::willPerformDragSourceAction(
- WebCore::DragSourceAction,
- const WebCore::IntPoint&,
- WebCore::Clipboard*) {
- // FIXME
-}
-
-WebCore::DragDestinationAction DragClientImpl::actionMaskForDrag(
- WebCore::DragData*) {
- if (webview_->client() && webview_->client()->acceptsLoadDrops()) {
- return WebCore::DragDestinationActionAny;
- } else {
- return static_cast<WebCore::DragDestinationAction>
- (WebCore::DragDestinationActionDHTML |
- WebCore::DragDestinationActionEdit);
- }
-}
-
-WebCore::DragSourceAction DragClientImpl::dragSourceActionMaskForPoint(
- const WebCore::IntPoint& window_point) {
- // We want to handle drag operations for all source types.
- return WebCore::DragSourceActionAny;
-}
-
-void DragClientImpl::startDrag(WebCore::DragImageRef drag_image,
- const WebCore::IntPoint& drag_image_origin,
- const WebCore::IntPoint& event_pos,
- WebCore::Clipboard* clipboard,
- WebCore::Frame* frame,
- bool is_link_drag) {
- // Add a ref to the frame just in case a load occurs mid-drag.
- RefPtr<WebCore::Frame> frame_protector = frame;
-
- WebDragData drag_data = webkit_glue::ChromiumDataObjectToWebDragData(
- static_cast<WebCore::ClipboardChromium*>(clipboard)->dataObject());
-
- WebCore::DragOperation drag_operation_mask;
- if (!clipboard->sourceOperation(drag_operation_mask))
- drag_operation_mask = WebCore::DragOperationEvery;
-
- webview_->StartDragging(
- webkit_glue::IntPointToWebPoint(event_pos),
- drag_data,
- static_cast<WebKit::WebDragOperationsMask>(drag_operation_mask));
-}
-
-WebCore::DragImageRef DragClientImpl::createDragImageForLink(
- WebCore::KURL&,
- const WebCore::String& label,
- WebCore::Frame*) {
- // FIXME
- return 0;
-}
-
-void DragClientImpl::dragControllerDestroyed() {
- // Our lifetime is bound to the WebViewImpl.
-}
diff --git a/webkit/glue/dragclient_impl.h b/webkit/glue/dragclient_impl.h
deleted file mode 100644
index dd4b898..0000000
--- a/webkit/glue/dragclient_impl.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef WEBKIT_GLUE_DRAGCLIENT_IMPL_H__
-#define WEBKIT_GLUE_DRAGCLIENT_IMPL_H__
-
-#include "DragClient.h"
-#include "DragActions.h"
-
-namespace WebCore {
-class ClipBoard;
-class DragData;
-class IntPoint;
-class KURL;
-}
-
-class WebViewImpl;
-
-class DragClientImpl : public WebCore::DragClient {
- public:
- DragClientImpl(WebViewImpl* webview) : webview_(webview) {}
- virtual ~DragClientImpl() {}
-
- virtual void willPerformDragDestinationAction(WebCore::DragDestinationAction,
- WebCore::DragData*);
- virtual void willPerformDragSourceAction(WebCore::DragSourceAction,
- const WebCore::IntPoint&,
- WebCore::Clipboard*);
- virtual WebCore::DragDestinationAction actionMaskForDrag(WebCore::DragData*);
- virtual WebCore::DragSourceAction dragSourceActionMaskForPoint(
- const WebCore::IntPoint& window_point);
-
- virtual void startDrag(WebCore::DragImageRef drag_image,
- const WebCore::IntPoint& drag_image_origin,
- const WebCore::IntPoint& event_pos,
- WebCore::Clipboard* clipboard,
- WebCore::Frame* frame,
- bool is_link_drag = false);
- virtual WebCore::DragImageRef createDragImageForLink(
- WebCore::KURL&, const WebCore::String& label, WebCore::Frame*);
-
- virtual void dragControllerDestroyed();
-
- private:
- WebViewImpl* webview_;
-};
-
-#endif // #ifndef WEBKIT_GLUE_DRAGCLIENT_IMPL_H__
diff --git a/webkit/glue/inspector_client_impl.cc b/webkit/glue/inspector_client_impl.cc
deleted file mode 100644
index d54d891..0000000
--- a/webkit/glue/inspector_client_impl.cc
+++ /dev/null
@@ -1,231 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "config.h"
-
-#include "DOMWindow.h"
-#include "FloatRect.h"
-#include "InspectorController.h"
-#include "Page.h"
-#include "Settings.h"
-#include <wtf/Vector.h>
-#undef LOG
-
-#include "webkit/api/public/WebRect.h"
-#include "webkit/api/public/WebURL.h"
-#include "webkit/api/public/WebURLRequest.h"
-#include "webkit/api/public/WebViewClient.h"
-#include "webkit/glue/glue_util.h"
-#include "webkit/glue/inspector_client_impl.h"
-#include "webkit/glue/webdevtoolsagent_impl.h"
-#include "webkit/glue/webkit_glue.h"
-#include "webkit/glue/webview_impl.h"
-
-using namespace WebCore;
-
-using WebKit::WebRect;
-using WebKit::WebSize;
-using WebKit::WebURLRequest;
-
-static const float kDefaultInspectorXPos = 10;
-static const float kDefaultInspectorYPos = 50;
-static const float kDefaultInspectorHeight = 640;
-static const float kDefaultInspectorWidth = 480;
-
-InspectorClientImpl::InspectorClientImpl(WebViewImpl* webView)
- : inspected_web_view_(webView) {
- ASSERT(inspected_web_view_);
-}
-
-InspectorClientImpl::~InspectorClientImpl() {
-}
-
-void InspectorClientImpl::inspectorDestroyed() {
- // Our lifetime is bound to the WebViewImpl.
-}
-
-Page* InspectorClientImpl::createPage() {
- // This method should never be called in Chrome as inspector front-end lives
- // in a separate process.
- ASSERT_NOT_REACHED();
- return NULL;
-}
-
-void InspectorClientImpl::showWindow() {
- ASSERT(inspected_web_view_->GetWebDevToolsAgentImpl());
- InspectorController* inspector =
- inspected_web_view_->page()->inspectorController();
- inspector->setWindowVisible(true);
-}
-
-void InspectorClientImpl::closeWindow() {
- if (inspected_web_view_->page())
- inspected_web_view_->page()->inspectorController()->setWindowVisible(false);
-}
-
-bool InspectorClientImpl::windowVisible() {
- ASSERT(inspected_web_view_->GetWebDevToolsAgentImpl());
- return false;
-}
-
-void InspectorClientImpl::attachWindow() {
- // TODO(jackson): Implement this
-}
-
-void InspectorClientImpl::detachWindow() {
- // TODO(jackson): Implement this
-}
-
-void InspectorClientImpl::setAttachedWindowHeight(unsigned int height) {
- // TODO(dglazkov): Implement this
- notImplemented();
-}
-
-static void invalidateNodeBoundingRect(WebViewImpl* web_view) {
- // TODO(ojan): http://b/1143996 Is it important to just invalidate the rect
- // of the node region given that this is not on a critical codepath?
- // In order to do so, we'd have to take scrolling into account.
- const WebSize& size = web_view->size();
- WebRect damaged_rect(0, 0, size.width, size.height);
- if (web_view->client())
- web_view->client()->didInvalidateRect(damaged_rect);
-}
-
-void InspectorClientImpl::highlight(Node* node) {
- // InspectorController does the actually tracking of the highlighted node
- // and the drawing of the highlight. Here we just make sure to invalidate
- // the rects of the old and new nodes.
- hideHighlight();
-}
-
-void InspectorClientImpl::hideHighlight() {
- // TODO: Should be able to invalidate a smaller rect.
- invalidateNodeBoundingRect(inspected_web_view_);
-}
-
-void InspectorClientImpl::inspectedURLChanged(const String& newURL) {
- // TODO(jackson): Implement this
-}
-
-String InspectorClientImpl::localizedStringsURL() {
- notImplemented();
- return String();
-}
-
-String InspectorClientImpl::hiddenPanels() {
- // Enumerate tabs that are currently disabled.
- return "scripts,profiles,databases";
-}
-
-void InspectorClientImpl::populateSetting(
- const String& key,
- InspectorController::Setting& setting) {
- LoadSettings();
- if (settings_->contains(key))
- setting = settings_->get(key);
-}
-
-void InspectorClientImpl::storeSetting(
- const String& key,
- const InspectorController::Setting& setting) {
- LoadSettings();
- settings_->set(key, setting);
- SaveSettings();
-}
-
-void InspectorClientImpl::removeSetting(const String& key) {
- LoadSettings();
- settings_->remove(key);
- SaveSettings();
-}
-
-void InspectorClientImpl::inspectorWindowObjectCleared() {
- notImplemented();
-}
-
-void InspectorClientImpl::LoadSettings() {
- if (settings_)
- return;
-
- settings_.set(new SettingsMap);
- String data = webkit_glue::WebStringToString(
- inspected_web_view_->inspectorSettings());
- if (data.isEmpty())
- return;
-
- Vector<String> entries;
- data.split("\n", entries);
- for (Vector<String>::iterator it = entries.begin();
- it != entries.end(); ++it) {
- Vector<String> tokens;
- it->split(":", tokens);
- if (tokens.size() != 3)
- continue;
-
- String name = decodeURLEscapeSequences(tokens[0]);
- String type = tokens[1];
- InspectorController::Setting setting;
- bool ok = true;
- if (type == "string")
- setting.set(decodeURLEscapeSequences(tokens[2]));
- else if (type == "double")
- setting.set(tokens[2].toDouble(&ok));
- else if (type == "integer")
- setting.set(static_cast<long>(tokens[2].toInt(&ok)));
- else if (type == "boolean")
- setting.set(tokens[2] == "true");
- else
- continue;
-
- if (ok)
- settings_->set(name, setting);
- }
-}
-
-void InspectorClientImpl::SaveSettings() {
- String data;
- for (SettingsMap::iterator it = settings_->begin(); it != settings_->end();
- ++it) {
- String entry;
- InspectorController::Setting value = it->second;
- String name = encodeWithURLEscapeSequences(it->first);
- switch (value.type()) {
- case InspectorController::Setting::StringType:
- entry = String::format(
- "%s:string:%s",
- name.utf8().data(),
- encodeWithURLEscapeSequences(value.string()).utf8().data());
- break;
- case InspectorController::Setting::DoubleType:
- entry = String::format(
- "%s:double:%f",
- name.utf8().data(),
- value.doubleValue());
- break;
- case InspectorController::Setting::IntegerType:
- entry = String::format(
- "%s:integer:%ld",
- name.utf8().data(),
- value.integerValue());
- break;
- case InspectorController::Setting::BooleanType:
- entry = String::format("%s:boolean:%s",
- name.utf8().data(),
- value.booleanValue() ? "true" : "false");
- break;
- case InspectorController::Setting::StringVectorType:
- notImplemented();
- break;
- default:
- ASSERT_NOT_REACHED();
- break;
- }
- data.append(entry);
- data.append("\n");
- }
- inspected_web_view_->setInspectorSettings(
- webkit_glue::StringToWebString(data));
- if (inspected_web_view_->client())
- inspected_web_view_->client()->didUpdateInspectorSettings();
-}
diff --git a/webkit/glue/inspector_client_impl.h b/webkit/glue/inspector_client_impl.h
deleted file mode 100644
index ac336ca..0000000
--- a/webkit/glue/inspector_client_impl.h
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef WEBKIT_GLUE_INSPECTOR_CLIENT_IMPL_H_
-#define WEBKIT_GLUE_INSPECTOR_CLIENT_IMPL_H_
-
-#include "InspectorClient.h"
-#include "InspectorController.h"
-#include <wtf/OwnPtr.h>
-
-class WebNodeHighlight;
-class WebViewImpl;
-
-class InspectorClientImpl : public WebCore::InspectorClient {
- public:
- InspectorClientImpl(WebViewImpl*);
- ~InspectorClientImpl();
-
- // InspectorClient
- virtual void inspectorDestroyed();
-
- virtual WebCore::Page* createPage();
- virtual WebCore::String localizedStringsURL();
- virtual WebCore::String hiddenPanels();
- virtual void showWindow();
- virtual void closeWindow();
- virtual bool windowVisible();
-
- virtual void attachWindow();
- virtual void detachWindow();
-
- virtual void setAttachedWindowHeight(unsigned height);
-
- virtual void highlight(WebCore::Node*);
- virtual void hideHighlight();
-
- virtual void inspectedURLChanged(const WebCore::String& newURL);
-
- virtual void populateSetting(
- const WebCore::String& key,
- WebCore::InspectorController::Setting&);
- virtual void storeSetting(
- const WebCore::String& key,
- const WebCore::InspectorController::Setting&);
- virtual void removeSetting(const WebCore::String& key);
-
- virtual void inspectorWindowObjectCleared();
-
- private:
- void LoadSettings();
- void SaveSettings();
-
- // The WebViewImpl of the page being inspected; gets passed to the constructor
- WebViewImpl* inspected_web_view_;
-
- typedef HashMap<WebCore::String, WebCore::InspectorController::Setting>
- SettingsMap;
- OwnPtr<SettingsMap> settings_;
-};
-
-#endif // WEBKIT_GLUE_INSPECTOR_CLIENT_IMPL_H_
diff --git a/webkit/glue/webframeloaderclient_impl.cc b/webkit/glue/webframeloaderclient_impl.cc
index 9fd66cb..bd6ecdc 100644
--- a/webkit/glue/webframeloaderclient_impl.cc
+++ b/webkit/glue/webframeloaderclient_impl.cc
@@ -800,7 +800,7 @@ void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(
const WebDataSourceImpl* ds = webframe_->GetProvisionalDataSourceImpl();
if (ds) {
KURL url = webkit_glue::WebURLToKURL(ds->request().url());
- if (url.protocolIs(webkit_glue::kBackForwardNavigationScheme)) {
+ if (url.protocolIs(WebKit::backForwardNavigationScheme)) {
HandleBackForwardNavigation(url);
navigation_policy = WebKit::WebNavigationPolicyIgnore;
} else {
@@ -1317,7 +1317,7 @@ bool WebFrameLoaderClient::ActionSpecifiesNavigationPolicy(
}
void WebFrameLoaderClient::HandleBackForwardNavigation(const KURL& url) {
- ASSERT(url.protocolIs(webkit_glue::kBackForwardNavigationScheme));
+ ASSERT(url.protocolIs(WebKit::backForwardNavigationScheme));
bool ok;
int offset = url.lastPathComponent().toIntStrict(&ok);
diff --git a/webkit/glue/webkitclient_impl.cc b/webkit/glue/webkitclient_impl.cc
index b45c37a..2d2e27f 100644
--- a/webkit/glue/webkitclient_impl.cc
+++ b/webkit/glue/webkitclient_impl.cc
@@ -29,7 +29,7 @@
#include "webkit/api/public/WebScreenInfo.h"
#include "webkit/api/public/WebString.h"
#include "webkit/api/public/WebViewClient.h"
-#include "webkit/glue/chrome_client_impl.h"
+#include "webkit/api/src/ChromeClientImpl.h"
#include "webkit/glue/glue_util.h"
#include "webkit/glue/plugins/plugin_instance.h"
#include "webkit/glue/webkit_glue.h"
@@ -39,6 +39,7 @@
#include "webkit/glue/webview_impl.h"
#include "webkit/glue/webworkerclient_impl.h"
+using WebKit::ChromeClientImpl;
using WebKit::WebApplicationCacheHost;
using WebKit::WebApplicationCacheHostClient;
using WebKit::WebCursorInfo;
@@ -416,7 +417,7 @@ void WebKitClientImpl::setCursorForPlugin(
// A windowless plugin can change the cursor in response to the WM_MOUSEMOVE
// event. We need to reflect the changed cursor in the frame view as the
// mouse is moved in the boundaries of the windowless plugin.
- chrome_client->SetCursorForPlugin(cursor_info);
+ chrome_client->setCursorForPlugin(cursor_info);
}
void WebKitClientImpl::notifyJSOutOfMemory(WebCore::Frame* frame) {
@@ -484,7 +485,7 @@ void WebKitClientImpl::widgetSetCursor(WebCore::Widget* widget,
const WebCore::Cursor& cursor) {
ChromeClientImpl* chrome_client = ToChromeClient(widget);
if (chrome_client)
- chrome_client->SetCursor(CursorToWebCursorInfo(cursor));
+ chrome_client->setCursor(CursorToWebCursorInfo(cursor));
}
void WebKitClientImpl::widgetSetFocus(WebCore::Widget* widget) {
diff --git a/webkit/glue/webpopupmenu_impl.cc b/webkit/glue/webpopupmenu_impl.cc
deleted file mode 100644
index 895ff7c..0000000
--- a/webkit/glue/webpopupmenu_impl.cc
+++ /dev/null
@@ -1,284 +0,0 @@
-// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "config.h"
-
-#include "Cursor.h"
-#include "FramelessScrollView.h"
-#include "FrameView.h"
-#include "IntRect.h"
-#include "PlatformContextSkia.h"
-#include "PlatformKeyboardEvent.h"
-#include "PlatformMouseEvent.h"
-#include "PlatformWheelEvent.h"
-#include "SkiaUtils.h"
-#undef LOG
-
-#include "skia/ext/platform_canvas.h"
-#include "webkit/api/public/WebInputEvent.h"
-#include "webkit/api/public/WebRect.h"
-#include "webkit/api/public/WebWidgetClient.h"
-#include "webkit/api/src/WebInputEventConversion.h"
-#include "webkit/glue/glue_util.h"
-#include "webkit/glue/webpopupmenu_impl.h"
-
-using namespace WebCore;
-
-using WebKit::PlatformKeyboardEventBuilder;
-using WebKit::PlatformMouseEventBuilder;
-using WebKit::PlatformWheelEventBuilder;
-using WebKit::WebCanvas;
-using WebKit::WebCompositionCommand;
-using WebKit::WebInputEvent;
-using WebKit::WebKeyboardEvent;
-using WebKit::WebMouseEvent;
-using WebKit::WebMouseWheelEvent;
-using WebKit::WebNavigationPolicy;
-using WebKit::WebPoint;
-using WebKit::WebPopupMenu;
-using WebKit::WebRect;
-using WebKit::WebSize;
-using WebKit::WebString;
-using WebKit::WebTextDirection;
-using WebKit::WebWidget;
-using WebKit::WebWidgetClient;
-
-// WebPopupMenu ---------------------------------------------------------------
-
-// static
-WebPopupMenu* WebPopupMenu::create(WebWidgetClient* client) {
- return new WebPopupMenuImpl(client);
-}
-
-// WebWidget ------------------------------------------------------------------
-
-WebPopupMenuImpl::WebPopupMenuImpl(WebWidgetClient* client)
- : client_(client),
- widget_(NULL) {
- // set to impossible point so we always get the first mouse pos
- last_mouse_position_ = WebPoint(-1, -1);
-}
-
-WebPopupMenuImpl::~WebPopupMenuImpl() {
- if (widget_)
- widget_->setClient(NULL);
-}
-
-void WebPopupMenuImpl::Init(WebCore::FramelessScrollView* widget,
- const WebRect& bounds) {
- widget_ = widget;
- widget_->setClient(this);
-
- if (client_) {
- client_->setWindowRect(bounds);
- client_->show(WebNavigationPolicy()); // Policy is ignored
- }
-}
-
-void WebPopupMenuImpl::MouseMove(const WebMouseEvent& event) {
- // don't send mouse move messages if the mouse hasn't moved.
- if (event.x != last_mouse_position_.x ||
- event.y != last_mouse_position_.y) {
- last_mouse_position_ = WebPoint(event.x, event.y);
- widget_->handleMouseMoveEvent(PlatformMouseEventBuilder(widget_, event));
- }
-}
-
-void WebPopupMenuImpl::MouseLeave(const WebMouseEvent& event) {
- widget_->handleMouseMoveEvent(PlatformMouseEventBuilder(widget_, event));
-}
-
-void WebPopupMenuImpl::MouseDown(const WebMouseEvent& event) {
- widget_->handleMouseDownEvent(PlatformMouseEventBuilder(widget_, event));
-}
-
-void WebPopupMenuImpl::MouseUp(const WebMouseEvent& event) {
- mouseCaptureLost();
- widget_->handleMouseReleaseEvent(PlatformMouseEventBuilder(widget_, event));
-}
-
-void WebPopupMenuImpl::MouseWheel(const WebMouseWheelEvent& event) {
- widget_->handleWheelEvent(PlatformWheelEventBuilder(widget_, event));
-}
-
-bool WebPopupMenuImpl::KeyEvent(const WebKeyboardEvent& event) {
- return widget_->handleKeyEvent(PlatformKeyboardEventBuilder(event));
-}
-
-// WebWidget -------------------------------------------------------------------
-
-void WebPopupMenuImpl::close() {
- if (widget_)
- widget_->hide();
-
- client_ = NULL;
-
- deref(); // Balances ref() from WebWidget::Create
-}
-
-void WebPopupMenuImpl::resize(const WebSize& new_size) {
- if (size_ == new_size)
- return;
- size_ = new_size;
-
- if (widget_) {
- IntRect new_geometry(0, 0, size_.width, size_.height);
- widget_->setFrameRect(new_geometry);
- }
-
- if (client_) {
- WebRect damaged_rect(0, 0, size_.width, size_.height);
- client_->didInvalidateRect(damaged_rect);
- }
-}
-
-void WebPopupMenuImpl::layout() {
-}
-
-void WebPopupMenuImpl::paint(WebCanvas* canvas, const WebRect& rect) {
- if (!widget_)
- return;
-
- if (!rect.isEmpty()) {
-#if WEBKIT_USING_CG
- GraphicsContext gc(canvas);
-#elif WEBKIT_USING_SKIA
- PlatformContextSkia context(canvas);
- // PlatformGraphicsContext is actually a pointer to PlatformContextSkia.
- GraphicsContext gc(reinterpret_cast<PlatformGraphicsContext*>(&context));
-#else
- notImplemented();
-#endif
- widget_->paint(&gc, webkit_glue::WebRectToIntRect(rect));
- }
-}
-
-bool WebPopupMenuImpl::handleInputEvent(const WebInputEvent& input_event) {
- if (!widget_)
- return false;
-
- // TODO (jcampan): WebKit seems to always return false on mouse events
- // methods. For now we'll assume it has processed them (as we are only
- // interested in whether keyboard events are processed).
- switch (input_event.type) {
- case WebInputEvent::MouseMove:
- MouseMove(*static_cast<const WebMouseEvent*>(&input_event));
- return true;
-
- case WebInputEvent::MouseLeave:
- MouseLeave(*static_cast<const WebMouseEvent*>(&input_event));
- return true;
-
- case WebInputEvent::MouseWheel:
- MouseWheel(*static_cast<const WebMouseWheelEvent*>(&input_event));
- return true;
-
- case WebInputEvent::MouseDown:
- MouseDown(*static_cast<const WebMouseEvent*>(&input_event));
- return true;
-
- case WebInputEvent::MouseUp:
- MouseUp(*static_cast<const WebMouseEvent*>(&input_event));
- return true;
-
- // In Windows, RawKeyDown only has information about the physical key, but
- // for "selection", we need the information about the character the key
- // translated into. For English, the physical key value and the character
- // value are the same, hence, "selection" works for English. But for other
- // languages, such as Hebrew, the character value is different from the
- // physical key value. Thus, without accepting Char event type which
- // contains the key's character value, the "selection" won't work for
- // non-English languages, such as Hebrew.
- case WebInputEvent::RawKeyDown:
- case WebInputEvent::KeyDown:
- case WebInputEvent::KeyUp:
- case WebInputEvent::Char:
- return KeyEvent(*static_cast<const WebKeyboardEvent*>(&input_event));
-
- default:
- break;
- }
- return false;
-}
-
-void WebPopupMenuImpl::mouseCaptureLost() {
-}
-
-void WebPopupMenuImpl::setFocus(bool enable) {
-}
-
-bool WebPopupMenuImpl::handleCompositionEvent(
- WebCompositionCommand command,
- int cursor_position,
- int target_start,
- int target_end,
- const WebString& ime_string) {
- return false;
-}
-
-bool WebPopupMenuImpl::queryCompositionStatus(bool* enabled,
- WebRect* caret_rect) {
- return false;
-}
-
-void WebPopupMenuImpl::setTextDirection(WebTextDirection direction) {
-}
-
-//-----------------------------------------------------------------------------
-// WebCore::HostWindow
-
-void WebPopupMenuImpl::repaint(const WebCore::IntRect& paint_rect,
- bool content_changed,
- bool immediate,
- bool repaint_content_only) {
- // Ignore spurious calls.
- if (!content_changed || paint_rect.isEmpty())
- return;
- if (client_)
- client_->didInvalidateRect(webkit_glue::IntRectToWebRect(paint_rect));
-}
-
-void WebPopupMenuImpl::scroll(const WebCore::IntSize& scroll_delta,
- const WebCore::IntRect& scroll_rect,
- const WebCore::IntRect& clip_rect) {
- if (client_) {
- int dx = scroll_delta.width();
- int dy = scroll_delta.height();
- client_->didScrollRect(dx, dy, webkit_glue::IntRectToWebRect(clip_rect));
- }
-}
-
-WebCore::IntPoint WebPopupMenuImpl::screenToWindow(
- const WebCore::IntPoint& point) const {
- notImplemented();
- return WebCore::IntPoint();
-}
-
-WebCore::IntRect WebPopupMenuImpl::windowToScreen(
- const WebCore::IntRect& rect) const {
- notImplemented();
- return WebCore::IntRect();
-}
-
-void WebPopupMenuImpl::scrollRectIntoView(
- const WebCore::IntRect&, const WebCore::ScrollView*) const {
- // Nothing to be done here since we do not have the concept of a container
- // that implements its own scrolling.
-}
-
-void WebPopupMenuImpl::scrollbarsModeDidChange() const {
- // Nothing to be done since we have no concept of different scrollbar modes.
-}
-
-//-----------------------------------------------------------------------------
-// WebCore::FramelessScrollViewClient
-
-void WebPopupMenuImpl::popupClosed(WebCore::FramelessScrollView* widget) {
- ASSERT(widget == widget_);
- if (widget_) {
- widget_->setClient(NULL);
- widget_ = NULL;
- }
- client_->closeWidgetSoon();
-}
diff --git a/webkit/glue/webpopupmenu_impl.h b/webkit/glue/webpopupmenu_impl.h
deleted file mode 100644
index dea81a3..0000000
--- a/webkit/glue/webpopupmenu_impl.h
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef WEBKIT_GLUE_WEBPOPUPMENU_IMPL_H_
-#define WEBKIT_GLUE_WEBPOPUPMENU_IMPL_H_
-
-#include "webkit/api/public/WebPoint.h"
-#include "webkit/api/public/WebPopupMenu.h"
-#include "webkit/api/public/WebSize.h"
-
-#include "FramelessScrollViewClient.h"
-#include <wtf/RefCounted.h>
-
-namespace WebCore {
-class Frame;
-class FramelessScrollView;
-class KeyboardEvent;
-class Page;
-class PlatformKeyboardEvent;
-class Range;
-class Widget;
-}
-
-namespace WebKit {
-class WebKeyboardEvent;
-class WebMouseEvent;
-class WebMouseWheelEvent;
-struct WebRect;
-}
-
-struct MenuItem;
-
-class WebPopupMenuImpl : public WebKit::WebPopupMenu,
- public WebCore::FramelessScrollViewClient,
- public RefCounted<WebPopupMenuImpl> {
- public:
- // WebWidget
- virtual void close();
- virtual WebKit::WebSize size() { return size_; }
- virtual void resize(const WebKit::WebSize& new_size);
- virtual void layout();
- virtual void paint(WebKit::WebCanvas* canvas,
- const WebKit::WebRect& rect);
- virtual bool handleInputEvent(const WebKit::WebInputEvent& input_event);
- virtual void mouseCaptureLost();
- virtual void setFocus(bool enable);
- virtual bool handleCompositionEvent(WebKit::WebCompositionCommand command,
- int cursor_position,
- int target_start,
- int target_end,
- const WebKit::WebString& text);
- virtual bool queryCompositionStatus(bool* enabled,
- WebKit::WebRect* caret_rect);
- virtual void setTextDirection(WebKit::WebTextDirection direction);
-
- // WebPopupMenuImpl
- void Init(WebCore::FramelessScrollView* widget,
- const WebKit::WebRect& bounds);
-
- WebKit::WebWidgetClient* client() {
- return client_;
- }
-
- void MouseMove(const WebKit::WebMouseEvent& mouse_event);
- void MouseLeave(const WebKit::WebMouseEvent& mouse_event);
- void MouseDown(const WebKit::WebMouseEvent& mouse_event);
- void MouseUp(const WebKit::WebMouseEvent& mouse_event);
- void MouseDoubleClick(const WebKit::WebMouseEvent& mouse_event);
- void MouseWheel(const WebKit::WebMouseWheelEvent& wheel_event);
- bool KeyEvent(const WebKit::WebKeyboardEvent& key_event);
-
- protected:
- friend class WebKit::WebPopupMenu; // For WebPopupMenu::create
- friend class WTF::RefCounted<WebPopupMenuImpl>;
-
- WebPopupMenuImpl(WebKit::WebWidgetClient* client);
- ~WebPopupMenuImpl();
-
- // WebCore::HostWindow methods:
- virtual void repaint(const WebCore::IntRect&,
- bool content_changed,
- bool immediate = false,
- bool repaint_content_only = false);
- virtual void scroll(const WebCore::IntSize& scroll_delta,
- const WebCore::IntRect& scroll_rect,
- const WebCore::IntRect& clip_rect);
- virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) const;
- virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) const;
- virtual PlatformPageClient platformPageClient() const { return NULL; }
- virtual void scrollRectIntoView(const WebCore::IntRect&,
- const WebCore::ScrollView*) const;
- virtual void scrollbarsModeDidChange() const;
-
- // WebCore::FramelessScrollViewClient methods:
- virtual void popupClosed(WebCore::FramelessScrollView* popup_view);
-
- WebKit::WebWidgetClient* client_;
- WebKit::WebSize size_;
-
- WebKit::WebPoint last_mouse_position_;
-
- // This is a non-owning ref. The popup will notify us via popupClosed()
- // before it is destroyed.
- WebCore::FramelessScrollView* widget_;
-};
-
-#endif // WEBKIT_GLUE_WEBPOPUPMENU_IMPL_H_
diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc
index 3d34955..43c44a9d 100644
--- a/webkit/glue/webview_impl.cc
+++ b/webkit/glue/webview_impl.cc
@@ -67,11 +67,11 @@
#include "webkit/api/public/WebViewClient.h"
#include "webkit/api/src/DOMUtilitiesPrivate.h"
#include "webkit/api/src/WebInputEventConversion.h"
+#include "webkit/api/src/WebPopupMenuImpl.h"
#include "webkit/api/src/WebSettingsImpl.h"
#include "webkit/glue/glue_util.h"
#include "webkit/glue/webdevtoolsagent_impl.h"
#include "webkit/glue/webkit_glue.h"
-#include "webkit/glue/webpopupmenu_impl.h"
#include "webkit/glue/webview_impl.h"
// Get rid of WTF's pow define so we can use std::pow.
@@ -80,6 +80,7 @@
using namespace WebCore;
+using WebKit::ChromeClientImpl;
using WebKit::PlatformKeyboardEventBuilder;
using WebKit::PlatformMouseEventBuilder;
using WebKit::PlatformWheelEventBuilder;
@@ -105,6 +106,7 @@ using WebKit::WebMouseWheelEvent;
using WebKit::WebNavigationPolicy;
using WebKit::WebNode;
using WebKit::WebPoint;
+using WebKit::WebPopupMenuImpl;
using WebKit::WebRect;
using WebKit::WebSettings;
using WebKit::WebSettingsImpl;
diff --git a/webkit/glue/webview_impl.h b/webkit/glue/webview_impl.h
index 8dbed33..de94d05 100644
--- a/webkit/glue/webview_impl.h
+++ b/webkit/glue/webview_impl.h
@@ -12,13 +12,13 @@
#include "webkit/api/public/WebSize.h"
#include "webkit/api/public/WebString.h"
#include "webkit/api/public/WebView.h"
+#include "webkit/api/src/BackForwardListClientImpl.h"
+#include "webkit/api/src/ChromeClientImpl.h"
#include "webkit/api/src/ContextMenuClientImpl.h"
+#include "webkit/api/src/DragClientImpl.h"
+#include "webkit/api/src/InspectorClientImpl.h"
#include "webkit/api/src/NotificationPresenterImpl.h"
-#include "webkit/glue/back_forward_list_client_impl.h"
-#include "webkit/glue/chrome_client_impl.h"
-#include "webkit/glue/dragclient_impl.h"
#include "webkit/glue/editor_client_impl.h"
-#include "webkit/glue/inspector_client_impl.h"
#include "webkit/glue/webframe_impl.h"
namespace WebCore {
@@ -255,12 +255,12 @@ class WebViewImpl : public WebKit::WebView, public RefCounted<WebViewImpl> {
WebKit::WebViewClient* client_;
- webkit_glue::BackForwardListClientImpl back_forward_list_client_impl_;
- ChromeClientImpl chrome_client_impl_;
+ WebKit::BackForwardListClientImpl back_forward_list_client_impl_;
+ WebKit::ChromeClientImpl chrome_client_impl_;
WebKit::ContextMenuClientImpl context_menu_client_impl_;
- DragClientImpl drag_client_impl_;
+ WebKit::DragClientImpl drag_client_impl_;
EditorClientImpl editor_client_impl_;
- InspectorClientImpl inspector_client_impl_;
+ WebKit::InspectorClientImpl inspector_client_impl_;
WebKit::WebSize size_;
diff --git a/webkit/webkit.gyp b/webkit/webkit.gyp
index 403b282..1ed3ef22 100644
--- a/webkit/webkit.gyp
+++ b/webkit/webkit.gyp
@@ -169,6 +169,10 @@
'api/public/win/WebScreenInfoFactory.h',
'api/src/ApplicationCacheHost.cpp',
'api/src/AssertMatchingEnums.cpp',
+ 'api/src/BackForwardListClientImpl.cpp',
+ 'api/src/BackForwardListClientImpl.h',
+ 'api/src/ChromeClientImpl.cpp',
+ 'api/src/ChromeClientImpl.h',
'api/src/ChromiumBridge.cpp',
'api/src/ChromiumCurrentTime.cpp',
'api/src/ChromiumThreading.cpp',
@@ -176,9 +180,13 @@
'api/src/ContextMenuClientImpl.h',
'api/src/DOMUtilitiesPrivate.cpp',
'api/src/DOMUtilitiesPrivate.h',
+ 'api/src/DragClientImpl.cpp',
+ 'api/src/DragClientImpl.h',
'api/src/gtk/WebFontInfo.cpp',
'api/src/gtk/WebFontInfo.h',
'api/src/gtk/WebInputEventFactory.cpp',
+ 'api/src/InspectorClientImpl.cpp',
+ 'api/src/InspectorClientImpl.h',
'api/src/linux/WebFontRendering.cpp',
'api/src/x11/WebScreenInfoFactory.cpp',
'api/src/mac/WebInputEventFactory.mm',
@@ -213,6 +221,7 @@
'api/src/WebDataSourceImpl.cpp',
'api/src/WebDataSourceImpl.h',
'api/src/WebDragData.cpp',
+ 'api/src/WebKit.cpp',
'api/src/WebFileChooserCompletionImpl.cpp',
'api/src/WebFileChooserCompletionImpl.h',
'api/src/WebFontCache.cpp',
@@ -235,6 +244,8 @@
'api/src/WebPluginListBuilderImpl.h',
'api/src/WebPluginLoadObserver.cpp',
'api/src/WebPluginLoadObserver.h',
+ 'api/src/WebPopupMenuImpl.cpp',
+ 'api/src/WebPopupMenuImpl.h',
'api/src/WebRange.cpp',
'api/src/WebScriptController.cpp',
'api/src/WebSearchableFormData.cpp',
@@ -556,10 +567,6 @@
'glue/plugins/webplugin_delegate_impl_win.cc',
'glue/alt_error_page_resource_fetcher.cc',
'glue/alt_error_page_resource_fetcher.h',
- 'glue/back_forward_list_client_impl.cc',
- 'glue/back_forward_list_client_impl.h',
- 'glue/chrome_client_impl.cc',
- 'glue/chrome_client_impl.h',
'glue/context_menu.h',
'glue/cpp_binding_example.cc',
'glue/cpp_binding_example.h',
@@ -573,8 +580,6 @@
'glue/dom_serializer.cc',
'glue/dom_serializer.h',
'glue/dom_serializer_delegate.h',
- 'glue/dragclient_impl.cc',
- 'glue/dragclient_impl.h',
'glue/editor_client_impl.cc',
'glue/editor_client_impl.h',
'glue/entity_map.cc',
@@ -596,8 +601,6 @@
'glue/image_decoder.h',
'glue/image_resource_fetcher.cc',
'glue/image_resource_fetcher.h',
- 'glue/inspector_client_impl.cc',
- 'glue/inspector_client_impl.h',
'glue/multipart_response_delegate.cc',
'glue/multipart_response_delegate.h',
'glue/npruntime_util.cc',
@@ -654,8 +657,6 @@
'glue/webplugin_impl.cc',
'glue/webplugin_impl.h',
'glue/webplugininfo.h',
- 'glue/webpopupmenu_impl.cc',
- 'glue/webpopupmenu_impl.h',
'glue/webpreferences.cc',
'glue/webpreferences.h',
'glue/websocketstreamhandle_bridge.h',