summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-24 06:57:10 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-24 06:57:10 +0000
commitb2528b7bc699a5ff432636ee6b13e6ea559b4ac8 (patch)
treeb7d4c65c5e3ddef8e23f176ccdd71386d62633df /webkit
parent8445640d01d91669819883ac480d8e60f2d6cfa5 (diff)
downloadchromium_src-b2528b7bc699a5ff432636ee6b13e6ea559b4ac8.zip
chromium_src-b2528b7bc699a5ff432636ee6b13e6ea559b4ac8.tar.gz
chromium_src-b2528b7bc699a5ff432636ee6b13e6ea559b4ac8.tar.bz2
Move some more methods from WebViewDelegate to WebViewClient.
R=dglazkov BUG=10033 TEST=none Review URL: http://codereview.chromium.org/224010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27054 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/api/public/WebViewClient.h13
-rw-r--r--webkit/glue/editor_client_impl.cc9
-rw-r--r--webkit/glue/webview_delegate.h23
-rw-r--r--webkit/glue/webview_impl.cc4
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.h4
5 files changed, 23 insertions, 30 deletions
diff --git a/webkit/api/public/WebViewClient.h b/webkit/api/public/WebViewClient.h
index 5460716..480243d 100644
--- a/webkit/api/public/WebViewClient.h
+++ b/webkit/api/public/WebViewClient.h
@@ -43,6 +43,7 @@ namespace WebKit {
class WebFileChooserCompletion;
class WebFrame;
class WebNode;
+ class WebNotificationPresenter;
class WebRange;
class WebString;
class WebWidget;
@@ -79,6 +80,9 @@ namespace WebKit {
// should be printed.
virtual void printPage(WebFrame*) = 0;
+ // Called to retrieve the provider of desktop notifications.
+ virtual WebNotificationPresenter* notificationPresenter() = 0;
+
// Navigational --------------------------------------------------------
@@ -113,6 +117,15 @@ namespace WebKit {
virtual void didExecuteCommand(const WebString& commandName) = 0;
virtual void didEndEditing() = 0;
+ // This method is called in response to WebView's handleInputEvent()
+ // when the default action for the current keyboard event is not
+ // suppressed by the page, to give the embedder a chance to handle
+ // the keyboard event specially.
+ //
+ // Returns true if the keyboard event was handled by the embedder,
+ // indicating that the default action should be suppressed.
+ virtual bool handleCurrentKeyboardEvent() = 0;
+
// Spellchecker --------------------------------------------------------
diff --git a/webkit/glue/editor_client_impl.cc b/webkit/glue/editor_client_impl.cc
index d4df2a6..888145b 100644
--- a/webkit/glue/editor_client_impl.cc
+++ b/webkit/glue/editor_client_impl.cc
@@ -630,11 +630,10 @@ void EditorClientImpl::handleKeyboardEvent(WebCore::KeyboardEvent* evt) {
ShowFormAutofillForNode(evt->target()->toNode());
}
- // Calls WebViewDelegate's HandleCurrentKeyboardEvent() first to give it a
- // chance to handle the keyboard event. Bypass handleEditingKeyboardEvent(),
- // if WebViewDelegate handles the event.
- WebViewDelegate* d = webview_->delegate();
- if ((d && d->HandleCurrentKeyboardEvent()) || handleEditingKeyboardEvent(evt))
+ // Give the embedder a chance to handle the keyboard event.
+ if ((webview_->client() &&
+ webview_->client()->handleCurrentKeyboardEvent()) ||
+ handleEditingKeyboardEvent(evt))
evt->setDefaultHandled();
}
diff --git a/webkit/glue/webview_delegate.h b/webkit/glue/webview_delegate.h
index ced0887..3d1964c 100644
--- a/webkit/glue/webview_delegate.h
+++ b/webkit/glue/webview_delegate.h
@@ -137,12 +137,6 @@ class WebViewDelegate : public WebKit::WebViewClient {
const std::wstring& value) {
}
- // Called to retrieve the provider of desktop notifications. Pointer
- // is owned by the implementation of WebViewDelegate.
- virtual WebKit::WebNotificationPresenter* GetNotificationPresenter() {
- return NULL;
- }
-
// UIDelegate --------------------------------------------------------------
// Called to display a file chooser prompt. The prompt should be pre-
@@ -208,8 +202,6 @@ class WebViewDelegate : public WebKit::WebViewClient {
const SkBitmap& image) {
}
- // History Related ---------------------------------------------------------
-
// InspectorClient ---------------------------------------------------------
virtual void UpdateInspectorSettings(const std::wstring& raw_settings) { }
@@ -220,21 +212,6 @@ class WebViewDelegate : public WebKit::WebViewClient {
return NULL;
}
- // Editor Client -----------------------------------------------------------
-
- // The "CurrentKeyboardEvent" refers to the keyboard event passed to
- // WebView's handleInputEvent method.
- //
- // This method is called in response to WebView's handleInputEvent() when
- // the default action for the current keyboard event is not suppressed by the
- // page, to give WebViewDelegate a chance to handle the keyboard event
- // specially.
- //
- // Returns true if the keyboard event was handled by WebViewDelegate.
- virtual bool HandleCurrentKeyboardEvent() {
- return false;
- }
-
protected:
~WebViewDelegate() { }
};
diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc
index 5cb6a29..409d766 100644
--- a/webkit/glue/webview_impl.cc
+++ b/webkit/glue/webview_impl.cc
@@ -1876,8 +1876,8 @@ WebCore::Node* WebViewImpl::GetNodeForWindowPos(int x, int y) {
#if ENABLE(NOTIFICATIONS)
WebKit::NotificationPresenterImpl* WebViewImpl::GetNotificationPresenter() {
- if (!notification_presenter_.isInitialized() && delegate_)
- notification_presenter_.initialize(delegate_->GetNotificationPresenter());
+ if (!notification_presenter_.isInitialized() && client())
+ notification_presenter_.initialize(client()->notificationPresenter());
return &notification_presenter_;
}
#endif
diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h
index e688a9f..57afc3c 100644
--- a/webkit/tools/test_shell/test_webview_delegate.h
+++ b/webkit/tools/test_shell/test_webview_delegate.h
@@ -90,6 +90,9 @@ class TestWebViewDelegate : public WebViewDelegate,
const WebKit::WebConsoleMessage& message,
const WebKit::WebString& source_name, unsigned source_line);
virtual void printPage(WebKit::WebFrame* frame) {}
+ virtual WebKit::WebNotificationPresenter* notificationPresenter() {
+ return NULL;
+ }
virtual void didStartLoading() {}
virtual void didStopLoading() {}
virtual bool shouldBeginEditing(const WebKit::WebRange& range);
@@ -114,6 +117,7 @@ class TestWebViewDelegate : public WebViewDelegate,
virtual void didChangeContents();
virtual void didExecuteCommand(const WebKit::WebString& command_name) {}
virtual void didEndEditing();
+ virtual bool handleCurrentKeyboardEvent() { return false; }
virtual void spellCheck(
const WebKit::WebString& text, int& offset, int& length) {}
virtual WebKit::WebString autoCorrectWord(