summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-16 16:47:52 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-16 16:47:52 +0000
commit48c9cf2d85fa8a6a2de61946d377d561b9bb5c6e (patch)
treeedf21dfb828b0b18ed2db136424f0a12e5cb9655 /webkit/glue
parent2dd011df2acf628a0d23346a8a518000d18dd683 (diff)
downloadchromium_src-48c9cf2d85fa8a6a2de61946d377d561b9bb5c6e.zip
chromium_src-48c9cf2d85fa8a6a2de61946d377d561b9bb5c6e.tar.gz
chromium_src-48c9cf2d85fa8a6a2de61946d377d561b9bb5c6e.tar.bz2
Hook up WebViewClient, part 1.
This change makes WebViewDelegate extend from WebViewClient as a temporary means to start having consumers implement and use WebViewClient. R=dglazkov BUG=10033 TEST=none Review URL: http://codereview.chromium.org/196128 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26355 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r--webkit/glue/back_forward_list_client_impl.cc12
-rw-r--r--webkit/glue/chrome_client_impl.cc148
-rw-r--r--webkit/glue/dragclient_impl.cc6
-rw-r--r--webkit/glue/webframeloaderclient_impl.cc35
-rw-r--r--webkit/glue/webview_delegate.h152
-rw-r--r--webkit/glue/webview_impl.cc15
-rw-r--r--webkit/glue/webview_impl.h8
7 files changed, 107 insertions, 269 deletions
diff --git a/webkit/glue/back_forward_list_client_impl.cc b/webkit/glue/back_forward_list_client_impl.cc
index ec24804..65f2472 100644
--- a/webkit/glue/back_forward_list_client_impl.cc
+++ b/webkit/glue/back_forward_list_client_impl.cc
@@ -40,8 +40,8 @@ void BackForwardListClientImpl::addItem(PassRefPtr<WebCore::HistoryItem> item) {
// not a reload or back/forward).
webview_->ObserveNewNavigation();
- if (webview_->delegate())
- webview_->delegate()->DidAddHistoryItem();
+ if (webview_->client())
+ webview_->client()->didAddHistoryItem();
}
void BackForwardListClientImpl::goToItem(WebCore::HistoryItem* item) {
@@ -78,17 +78,17 @@ WebCore::HistoryItem* BackForwardListClientImpl::itemAtIndex(int index) {
}
int BackForwardListClientImpl::backListCount() {
- if (!webview_->delegate())
+ if (!webview_->client())
return 0;
- return webview_->delegate()->GetHistoryBackListCount();
+ return webview_->client()->historyBackListCount();
}
int BackForwardListClientImpl::forwardListCount() {
- if (!webview_->delegate())
+ if (!webview_->client())
return 0;
- return webview_->delegate()->GetHistoryForwardListCount();
+ return webview_->client()->historyForwardListCount();
}
void BackForwardListClientImpl::close() {
diff --git a/webkit/glue/chrome_client_impl.cc b/webkit/glue/chrome_client_impl.cc
index 818f0e11..6aa4478 100644
--- a/webkit/glue/chrome_client_impl.cc
+++ b/webkit/glue/chrome_client_impl.cc
@@ -29,6 +29,7 @@
#undef LOG
#include "googleurl/src/gurl.h"
+#include "webkit/api/public/WebConsoleMessage.h"
#include "webkit/api/public/WebCursorInfo.h"
#include "webkit/api/public/WebFrameClient.h"
#include "webkit/api/public/WebInputEvent.h"
@@ -50,13 +51,16 @@
using WebCore::PopupContainer;
using WebCore::PopupItem;
+using WebKit::WebConsoleMessage;
using WebKit::WebCursorInfo;
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::WebWidget;
@@ -192,29 +196,23 @@ bool ChromeClientImpl::canTakeFocus(WebCore::FocusDirection) {
}
void ChromeClientImpl::takeFocus(WebCore::FocusDirection direction) {
- WebViewDelegate* delegate = webview_->delegate();
- if (delegate) {
- delegate->TakeFocus(webview_,
- direction == WebCore::FocusDirectionBackward);
+ 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) {
- WebViewDelegate* delegate = webview_->delegate();
- if (!delegate)
+ if (!webview_->client())
return NULL;
- bool user_gesture = frame->script()->processingUserGesture();
-
- const std::string security_origin(webkit_glue::StringToStdString(
- frame->document()->securityOrigin()->toString()));
- GURL creator_url(security_origin);
WebViewImpl* new_view = static_cast<WebViewImpl*>(
- delegate->CreateWebView(webview_, user_gesture,
- (creator_url.is_valid() && creator_url.IsStandard()) ?
- creator_url : GURL()));
+ webview_->client()->createView(WebFrameImpl::FromFrame(frame)));
if (!new_view)
return NULL;
@@ -225,8 +223,7 @@ WebCore::Page* ChromeClientImpl::createWindow(
new_view->main_frame()->loadRequest(request);
}
- WebViewImpl* new_view_impl = static_cast<WebViewImpl*>(new_view);
- return new_view_impl->page();
+ return new_view->page();
}
static inline bool CurrentEventShouldCauseBackgroundTab(
@@ -323,12 +320,12 @@ void ChromeClientImpl::addMessageToConsole(WebCore::MessageSource source,
const WebCore::String& message,
unsigned int line_no,
const WebCore::String& source_id) {
- WebViewDelegate* delegate = webview_->delegate();
- if (delegate) {
- std::wstring wstr_message = webkit_glue::StringToStdWString(message);
- std::wstring wstr_source_id = webkit_glue::StringToStdWString(source_id);
- delegate->AddMessageToConsole(webview_, wstr_message,
- line_no, wstr_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);
}
}
@@ -339,11 +336,10 @@ bool ChromeClientImpl::canRunBeforeUnloadConfirmPanel() {
bool ChromeClientImpl::runBeforeUnloadConfirmPanel(
const WebCore::String& message,
WebCore::Frame* frame) {
- WebViewDelegate* delegate = webview_->delegate();
- if (delegate) {
- std::wstring wstr = webkit_glue::StringToStdWString(message);
- return delegate->RunBeforeUnloadConfirm(WebFrameImpl::FromFrame(frame),
- wstr);
+ if (webview_->client()) {
+ return webview_->client()->runModalBeforeUnloadDialog(
+ WebFrameImpl::FromFrame(frame),
+ webkit_glue::StringToWebString(message));
}
return false;
}
@@ -355,36 +351,33 @@ void ChromeClientImpl::closeWindowSoon() {
// Make sure that all loading is stopped. Ensures that JS stops executing!
webview_->StopLoading();
- WebViewDelegate* delegate = webview_->delegate();
- if (delegate)
- delegate->closeWidgetSoon();
+ 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) {
- // Pass the request on to the WebView delegate, for more control.
- WebViewDelegate* delegate = webview_->delegate();
- if (delegate) {
+ 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
-
- std::wstring wstr = webkit_glue::StringToStdWString(message);
- delegate->RunJavaScriptAlert(WebFrameImpl::FromFrame(frame), wstr);
+ webview_->client()->runModalAlertDialog(
+ WebFrameImpl::FromFrame(frame),
+ webkit_glue::StringToWebString(message));
}
}
// See comments for runJavaScriptAlert().
bool ChromeClientImpl::runJavaScriptConfirm(WebCore::Frame* frame,
const WebCore::String& message) {
- WebViewDelegate* delegate = webview_->delegate();
- if (delegate) {
- std::wstring wstr = webkit_glue::StringToStdWString(message);
- return delegate->RunJavaScriptConfirm(WebFrameImpl::FromFrame(frame), wstr);
+ if (webview_->client()) {
+ return webview_->client()->runModalConfirmDialog(
+ WebFrameImpl::FromFrame(frame),
+ webkit_glue::StringToWebString(message));
}
return false;
}
@@ -392,29 +385,26 @@ bool ChromeClientImpl::runJavaScriptConfirm(WebCore::Frame* frame,
// See comments for runJavaScriptAlert().
bool ChromeClientImpl::runJavaScriptPrompt(WebCore::Frame* frame,
const WebCore::String& message,
- const WebCore::String& defaultValue,
+ const WebCore::String& default_value,
WebCore::String& result) {
- WebViewDelegate* delegate = webview_->delegate();
- if (delegate) {
- std::wstring wstr_message = webkit_glue::StringToStdWString(message);
- std::wstring wstr_default = webkit_glue::StringToStdWString(defaultValue);
- std::wstring wstr_result;
- bool ok = delegate->RunJavaScriptPrompt(WebFrameImpl::FromFrame(frame),
- wstr_message,
- wstr_default,
- &wstr_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::StdWStringToString(wstr_result);
+ result = webkit_glue::WebStringToString(actual_value);
return ok;
}
return false;
}
void ChromeClientImpl::setStatusbarText(const WebCore::String& message) {
- WebViewDelegate* delegate = webview_->delegate();
- if (delegate) {
- std::wstring wstr = webkit_glue::StringToStdWString(message);
- delegate->SetStatusbarText(webview_, wstr);
+ if (webview_->client()) {
+ webview_->client()->setStatusText(
+ webkit_glue::StringToWebString(message));
}
}
@@ -499,37 +489,32 @@ void ChromeClientImpl::scrollbarsModeDidChange() const {
}
void ChromeClientImpl::mouseDidMoveOverElement(
- const WebCore::HitTestResult& result, unsigned modifierFlags) {
- // Find out if the mouse is over a link, and if so, let our UI know... somehow
- WebViewDelegate* delegate = webview_->delegate();
- if (delegate) {
- if (result.isLiveLink() && !result.absoluteLinkURL().string().isEmpty()) {
- delegate->UpdateTargetURL(
- webview_, webkit_glue::KURLToGURL(result.absoluteLinkURL()));
- } else {
- delegate->UpdateTargetURL(webview_, GURL());
- }
+ 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_->delegate()) {
- std::wstring tooltip_text_as_wstring =
- webkit_glue::StringToStdWString(tooltip_text);
- WebTextDirection text_direction = (dir == WebCore::RTL) ?
- WebKit::WebTextDirectionRightToLeft :
- WebKit::WebTextDirectionLeftToRight;
- webview_->delegate()->SetTooltipText(webview_, tooltip_text_as_wstring,
- text_direction);
- }
+ 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) {
- WebViewDelegate* delegate = webview_->delegate();
- if (delegate) {
- delegate->ScriptedPrint(WebFrameImpl::FromFrame(frame));
- }
+ if (webview_->client())
+ webview_->client()->printPage(WebFrameImpl::FromFrame(frame));
}
void ChromeClientImpl::exceededDatabaseQuota(WebCore::Frame* frame,
@@ -562,17 +547,16 @@ void ChromeClientImpl::popupOpened(PopupContainer* popup_container,
const WebCore::IntRect& bounds,
bool activatable,
bool handle_externally) {
- WebViewDelegate* delegate = webview_->delegate();
- if (!delegate)
+ if (!webview_->client())
return;
WebWidget* webwidget;
if (handle_externally) {
WebPopupMenuInfo popup_info;
GetPopupMenuInfo(popup_container, &popup_info);
- webwidget = delegate->CreatePopupWidgetWithInfo(webview_, popup_info);
+ webwidget = webview_->client()->createPopupMenu(popup_info);
} else {
- webwidget = delegate->CreatePopupWidget(webview_, activatable);
+ webwidget = webview_->client()->createPopupMenu(activatable);
}
static_cast<WebPopupMenuImpl*>(webwidget)->Init(
diff --git a/webkit/glue/dragclient_impl.cc b/webkit/glue/dragclient_impl.cc
index 75a8ba9..dff2ccd 100644
--- a/webkit/glue/dragclient_impl.cc
+++ b/webkit/glue/dragclient_impl.cc
@@ -61,11 +61,11 @@ void DragClientImpl::startDrag(WebCore::DragImageRef drag_image,
static_cast<WebCore::ClipboardChromium*>(clipboard)->dataObject());
WebCore::DragOperation drag_operation_mask;
- if (!clipboard->sourceOperation(drag_operation_mask)) {
+ if (!clipboard->sourceOperation(drag_operation_mask))
drag_operation_mask = WebCore::DragOperationEvery;
- }
- webview_->StartDragging(webkit_glue::IntPointToWebPoint(event_pos),
+ webview_->StartDragging(
+ webkit_glue::IntPointToWebPoint(event_pos),
drag_data,
static_cast<WebKit::WebDragOperationsMask>(drag_operation_mask));
}
diff --git a/webkit/glue/webframeloaderclient_impl.cc b/webkit/glue/webframeloaderclient_impl.cc
index d08377c..4f806cc 100644
--- a/webkit/glue/webframeloaderclient_impl.cc
+++ b/webkit/glue/webframeloaderclient_impl.cc
@@ -504,9 +504,8 @@ void WebFrameLoaderClient::dispatchDidChangeLocationWithinPage() {
// Anchor fragment navigations are not normal loads, so we need to synthesize
// some events for our delegate.
WebViewImpl* webview = webframe_->GetWebViewImpl();
- WebViewDelegate* d = webview->delegate();
- if (d)
- d->DidStartLoading(webview);
+ if (webview->client())
+ webview->client()->didStartLoading();
WebDataSourceImpl* ds = webframe_->GetDataSourceImpl();
DCHECK(ds) << "DataSource NULL when navigating to reference fragment";
@@ -550,8 +549,8 @@ void WebFrameLoaderClient::dispatchDidChangeLocationWithinPage() {
webframe_, is_new_navigation);
}
- if (d)
- d->DidStopLoading(webview);
+ if (webview->client())
+ webview->client()->didStopLoading();
}
void WebFrameLoaderClient::dispatchWillClose() {
@@ -885,12 +884,9 @@ void WebFrameLoaderClient::setMainDocumentError(DocumentLoader*,
}
void WebFrameLoaderClient::postProgressStartedNotification() {
- if (hasWebView()) {
- WebViewImpl* web_view = webframe_->GetWebViewImpl();
- WebViewDelegate* d = web_view->delegate();
- if (d)
- d->DidStartLoading(web_view);
- }
+ WebViewImpl* webview = webframe_->GetWebViewImpl();
+ if (webview && webview->client())
+ webview->client()->didStartLoading();
}
void WebFrameLoaderClient::postProgressEstimateChangedNotification() {
@@ -898,14 +894,11 @@ void WebFrameLoaderClient::postProgressEstimateChangedNotification() {
}
void WebFrameLoaderClient::postProgressFinishedNotification() {
- // TODO(ericroman): why might webframe_->webview_impl be null?
+ // TODO(ericroman): why might the webview be null?
// http://b/1234461
- if (hasWebView()) {
- WebViewImpl* web_view = webframe_->GetWebViewImpl();
- WebViewDelegate* d = web_view->delegate();
- if (d)
- d->DidStopLoading(web_view);
- }
+ WebViewImpl* webview = webframe_->GetWebViewImpl();
+ if (webview && webview->client())
+ webview->client()->didStopLoading();
}
void WebFrameLoaderClient::setMainFrameDocumentReady(bool ready) {
@@ -1335,9 +1328,9 @@ void WebFrameLoaderClient::HandleBackForwardNavigation(const GURL& url) {
if (!StringToInt(offset_str, &offset))
return;
- WebViewDelegate* d = webframe_->GetWebViewImpl()->delegate();
- if (d)
- d->NavigateBackForwardSoon(offset);
+ WebViewImpl* webview = webframe_->GetWebViewImpl();
+ if (webview->client())
+ webview->client()->navigateBackForwardSoon(offset);
}
PassOwnPtr<WebPluginLoadObserver> WebFrameLoaderClient::GetPluginLoadObserver() {
diff --git a/webkit/glue/webview_delegate.h b/webkit/glue/webview_delegate.h
index 4987326..f9f8837 100644
--- a/webkit/glue/webview_delegate.h
+++ b/webkit/glue/webview_delegate.h
@@ -31,7 +31,7 @@
#include "webkit/api/public/WebDragOperation.h"
#include "webkit/api/public/WebFrame.h"
#include "webkit/api/public/WebTextDirection.h"
-#include "webkit/api/public/WebWidgetClient.h"
+#include "webkit/api/public/WebViewClient.h"
#include "webkit/glue/context_menu.h"
namespace WebCore {
@@ -65,42 +65,11 @@ class WebFileChooserCallback {
DISALLOW_COPY_AND_ASSIGN(WebFileChooserCallback);
};
-
-// Inheritance here is somewhat weird, but since a WebView is a WebWidget,
-// it makes sense that a WebViewDelegate is a WebWidgetClient.
-class WebViewDelegate : virtual public WebKit::WebWidgetClient {
+// TODO(darin): Eliminate WebViewDelegate in favor of WebViewClient.
+class WebViewDelegate : public WebKit::WebViewClient {
public:
// WebView additions -------------------------------------------------------
- // This method is called to create a new WebView. The WebView should not be
- // made visible until the new WebView's Delegate has its Show method called.
- // The returned WebView pointer is assumed to be owned by the host window,
- // and the caller of CreateWebView should not release the given WebView.
- // |user_gesture| is true if a user action initiated this call.
- // |creator_url|, if nonempty, holds the security origin of the page creating
- // this WebView.
- virtual WebView* CreateWebView(WebView* webview,
- bool user_gesture,
- const GURL& creator_url) {
- return NULL;
- }
-
- // This method is called to create a new WebWidget to act as a popup
- // (like a drop-down menu).
- virtual WebKit::WebWidget* CreatePopupWidget(
- WebView* webview,
- bool activatable) {
- return NULL;
- }
-
- // Like CreatePopupWidget, except the actual widget is rendered by the
- // embedder using the supplied info.
- virtual WebKit::WebWidget* CreatePopupWidgetWithInfo(
- WebView* webview,
- const WebKit::WebPopupMenuInfo& info) {
- return NULL;
- }
-
// Notifies how many matches have been found so far, for a given request_id.
// |final_update| specifies whether this is the last update (all frames have
// completed scoping).
@@ -139,14 +108,6 @@ class WebViewDelegate : virtual public WebKit::WebWidgetClient {
return true;
}
- // Notifies the delegate that a load has begun.
- virtual void DidStartLoading(WebView* webview) {
- }
-
- // Notifies the delegate that all loads are finished.
- virtual void DidStopLoading(WebView* webview) {
- }
-
// Notifies that a new script context has been created for this frame.
// This is similar to WindowObjectCleared but only called once per frame
// context.
@@ -163,16 +124,6 @@ class WebViewDelegate : virtual public WebKit::WebWidgetClient {
// ChromeClient ------------------------------------------------------------
- // Appends a line to the application's error console. The message contains
- // an error description or other information, the line_no provides a line
- // number (e.g. for a JavaScript error report), and the source_id contains
- // a URL or other description of the source of the message.
- virtual void AddMessageToConsole(WebView* webview,
- const std::wstring& message,
- unsigned int line_no,
- const std::wstring& source_id) {
- }
-
// Queries the browser for suggestions to be shown for the form text field
// named |field_name|. |text| is the text entered by the user so far and
// |node_id| is the id of the node of the input field.
@@ -194,57 +145,6 @@ class WebViewDelegate : virtual public WebKit::WebWidgetClient {
// UIDelegate --------------------------------------------------------------
- // Displays a JavaScript alert panel associated with the given view. Clients
- // should visually indicate that this panel comes from JavaScript and some
- // information about the originating frame (at least the domain). The panel
- // should have a single OK button.
- virtual void RunJavaScriptAlert(WebKit::WebFrame* webframe,
- const std::wstring& message) {
- }
-
- // Displays a JavaScript confirm panel associated with the given view.
- // Clients should visually indicate that this panel comes
- // from JavaScript. The panel should have two buttons, e.g. "OK" and
- // "Cancel". Returns true if the user hit OK, or false if the user hit Cancel.
- virtual bool RunJavaScriptConfirm(WebKit::WebFrame* webframe,
- const std::wstring& message) {
- return false;
- }
-
- // Displays a JavaScript text input panel associated with the given view.
- // Clients should visually indicate that this panel comes from JavaScript.
- // The panel should have two buttons, e.g. "OK" and "Cancel", and an area to
- // type text. The default_value should appear as the initial text in the
- // panel when it is shown. If the user hit OK, returns true and fills result
- // with the text in the box. The value of result is undefined if the user
- // hit Cancel.
- virtual bool RunJavaScriptPrompt(WebKit::WebFrame* webframe,
- const std::wstring& message,
- const std::wstring& default_value,
- std::wstring* result) {
- return false;
- }
-
- // Sets the status bar text.
- virtual void SetStatusbarText(WebView* webview,
- const std::wstring& message) { }
-
- // Displays a "before unload" confirm panel associated with the given view.
- // The panel should have two buttons, e.g. "OK" and "Cancel", where OK means
- // that the navigation should continue, and Cancel means that the navigation
- // should be cancelled, leaving the user on the current page. Returns true
- // if the user hit OK, or false if the user hit Cancel.
- virtual bool RunBeforeUnloadConfirm(WebKit::WebFrame* webframe,
- const std::wstring& message) {
- return true; // OK, continue to navigate away
- }
-
- // Tells the client that we're hovering over a link with a given URL,
- // if the node is not a link, the URL will be an empty GURL.
- virtual void UpdateTargetURL(WebView* webview,
- const GURL& url) {
- }
-
// Called to display a file chooser prompt. The prompt should be pre-
// populated with the given initial_filename string. The WebViewDelegate
// will own the WebFileChooserCallback object and is responsible for
@@ -295,24 +195,6 @@ class WebViewDelegate : virtual public WebKit::WebWidgetClient {
const std::string& frame_charset) {
}
- // Starts a drag session with the supplied contextual information.
- // webview: The WebView sending the delegate method.
- // mouseCoords: Current mouse coordinates
- // drop_data: a WebDropData struct which should contain all the necessary
- // information for dragging data out of the webview.
- // drag_source_operation_mask: indicates what drag operations are allowed
- virtual void StartDragging(WebView* webview,
- const WebKit::WebPoint &mouseCoords,
- const WebKit::WebDragData& drag_data,
- WebKit::WebDragOperationsMask operations_mask) {
- }
-
- // Returns the focus to the client.
- // reverse: Whether the focus should go to the previous (if true) or the next
- // focusable element.
- virtual void TakeFocus(WebView* webview, bool reverse) {
- }
-
// Notification that a user metric has occurred.
virtual void UserMetricsRecordAction(const std::wstring& action) { }
@@ -331,27 +213,6 @@ class WebViewDelegate : virtual public WebKit::WebWidgetClient {
// History Related ---------------------------------------------------------
- // Tells the embedder to navigate back or forward in session history by the
- // given offset (relative to the current position in session history).
- virtual void NavigateBackForwardSoon(int offset) {
- }
-
- // Returns how many entries are in the back and forward lists, respectively.
- virtual int GetHistoryBackListCount() {
- return 0;
- }
- virtual int GetHistoryForwardListCount() {
- return 0;
- }
-
- // -------------------------------------------------------------------------
-
- // Tell the delegate the tooltip text and its directionality hint for the
- // current mouse position.
- virtual void SetTooltipText(WebView* webview,
- const std::wstring& tooltip_text,
- WebKit::WebTextDirection text_direction_hint) { }
-
// InspectorClient ---------------------------------------------------------
virtual void UpdateInspectorSettings(const std::wstring& raw_settings) { }
@@ -390,13 +251,6 @@ class WebViewDelegate : virtual public WebKit::WebWidgetClient {
// Update the spelling panel with the |word|.
virtual void UpdateSpellingUIWithMisspelledWord(const std::wstring& word) { }
- // Asks the user to print the page or a specific frame. Called in response to
- // a window.print() call.
- virtual void ScriptedPrint(WebKit::WebFrame* frame) { }
-
- // Called when an item was added to the history
- virtual void DidAddHistoryItem() { }
-
// The "CurrentKeyboardEvent" refers to the keyboard event passed to
// WebView's handleInputEvent method.
//
diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc
index e708327..38d4f94 100644
--- a/webkit/glue/webview_impl.cc
+++ b/webkit/glue/webview_impl.cc
@@ -116,6 +116,7 @@ using WebKit::WebTextDirection;
using WebKit::WebTextDirectionDefault;
using WebKit::WebTextDirectionLeftToRight;
using WebKit::WebTextDirectionRightToLeft;
+using WebKit::WebURL;
using webkit_glue::ImageResourceFetcher;
@@ -457,7 +458,7 @@ void WebViewImpl::MouseLeave(const WebMouseEvent& event) {
if (!main_frame() || !main_frame()->frameview())
return;
- delegate_->UpdateTargetURL(this, GURL());
+ client()->setMouseOverURL(WebURL());
main_frame()->frame()->eventHandler()->handleMouseMoveEvent(
PlatformMouseEventBuilder(main_frame()->frameview(), event));
@@ -1814,14 +1815,14 @@ void WebViewImpl::DidCommitLoad(bool* is_new_navigation) {
observed_new_navigation_ = false;
}
-void WebViewImpl::StartDragging(WebPoint event_pos,
+void WebViewImpl::StartDragging(const WebPoint& event_pos,
const WebDragData& drag_data,
WebDragOperationsMask mask) {
- if (delegate_) {
- DCHECK(!doing_drag_and_drop_);
- doing_drag_and_drop_ = true;
- delegate_->StartDragging(this, event_pos, drag_data, mask);
- }
+ if (!client())
+ return;
+ DCHECK(!doing_drag_and_drop_);
+ doing_drag_and_drop_ = true;
+ client()->startDragging(event_pos, drag_data, mask);
}
void WebViewImpl::OnImageFetchComplete(ImageResourceFetcher* fetcher,
diff --git a/webkit/glue/webview_impl.h b/webkit/glue/webview_impl.h
index f81e9dd..9b860bc 100644
--- a/webkit/glue/webview_impl.h
+++ b/webkit/glue/webview_impl.h
@@ -167,6 +167,11 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> {
static WebViewImpl* FromPage(WebCore::Page* page);
+ WebKit::WebViewClient* client() {
+ return delegate_;
+ }
+
+ // TODO(darin): Remove this method in favor of client().
WebViewDelegate* delegate() {
return delegate_;
}
@@ -228,7 +233,8 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> {
}
// Start a system drag and drop operation.
- void StartDragging(WebKit::WebPoint event_pos,
+ void StartDragging(
+ const WebKit::WebPoint& event_pos,
const WebKit::WebDragData& drag_data,
WebKit::WebDragOperationsMask drag_source_operation_mask);