summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webview_impl.cc
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-04 05:42:51 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-04 05:42:51 +0000
commit79dbc66fba17d6b4967fe86a577b11d15548cdec (patch)
treedf2853054e47aa76cea79eb6664f4c21cb54bd9e /webkit/glue/webview_impl.cc
parentbdc66ceff07dac7b74ddea70fabdf535936d39b1 (diff)
downloadchromium_src-79dbc66fba17d6b4967fe86a577b11d15548cdec.zip
chromium_src-79dbc66fba17d6b4967fe86a577b11d15548cdec.tar.gz
chromium_src-79dbc66fba17d6b4967fe86a577b11d15548cdec.tar.bz2
Hook up WebEditingClient.
Moves the WebViewDelegate parameter back to WebView::Create and adds a second parameter for WebEditingClient. I had hoped to make the WebEditingClient NULL for RenderView on Windows and Mac, but that turned out to not be an option. I need a few methods on all platforms. The Describe* functions from EditorClientImpl are moved into the TestWebViewDelegate since they are only applicable to layout tests. R=dglazkov BUG= TEST=none Review URL: http://codereview.chromium.org/195008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25432 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webview_impl.cc')
-rw-r--r--webkit/glue/webview_impl.cc31
1 files changed, 13 insertions, 18 deletions
diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc
index d5f9c06..b065563 100644
--- a/webkit/glue/webview_impl.cc
+++ b/webkit/glue/webview_impl.cc
@@ -101,6 +101,7 @@ using WebKit::WebCompositionCommand;
using WebKit::WebCompositionCommandConfirm;
using WebKit::WebCompositionCommandDiscard;
using WebKit::WebDragData;
+using WebKit::WebEditingClient;
using WebKit::WebFrame;
using WebKit::WebInputEvent;
using WebKit::WebKeyboardEvent;
@@ -323,24 +324,22 @@ static const WebCore::PopupContainerSettings kAutocompletePopupSettings = {
// WebView ----------------------------------------------------------------
/*static*/
-WebView* WebView::Create() {
- WebViewImpl* instance = new WebViewImpl();
+WebView* WebView::Create(WebViewDelegate* delegate,
+ WebEditingClient* editing_client) {
+ WebViewImpl* instance = new WebViewImpl(delegate, editing_client);
instance->AddRef();
return instance;
}
-void WebViewImpl::InitializeMainFrame(WebViewDelegate* delegate) {
+void WebViewImpl::InitializeMainFrame() {
// NOTE: The WebFrameImpl takes a reference to itself within InitMainFrame
// and releases that reference once the corresponding Frame is destroyed.
scoped_refptr<WebFrameImpl> main_frame = new WebFrameImpl();
- // Set the delegate before initializing the frame, so that notifications like
- // DidCreateDataSource make their way to the client.
- delegate_ = delegate;
main_frame->InitMainFrame(this);
WebDevToolsAgentDelegate* tools_delegate =
- delegate->GetWebDevToolsAgentDelegate();
+ delegate_->GetWebDevToolsAgentDelegate();
if (tools_delegate)
devtools_agent_.reset(new WebDevToolsAgentImpl(this, tools_delegate));
@@ -363,8 +362,11 @@ void WebView::ResetVisitedLinkState() {
}
-WebViewImpl::WebViewImpl()
- : ALLOW_THIS_IN_INITIALIZER_LIST(back_forward_list_client_impl_(this)),
+WebViewImpl::WebViewImpl(WebViewDelegate* delegate,
+ WebEditingClient* editing_client)
+ : delegate_(delegate),
+ ALLOW_THIS_IN_INITIALIZER_LIST(editor_client_impl_(this, editing_client)),
+ ALLOW_THIS_IN_INITIALIZER_LIST(back_forward_list_client_impl_(this)),
observed_new_navigation_(false),
#ifndef NDEBUG
new_navigation_loader_(NULL),
@@ -393,7 +395,7 @@ WebViewImpl::WebViewImpl()
// the page will take ownership of the various clients
page_.reset(new Page(new ChromeClientImpl(this),
new ContextMenuClientImpl(this),
- new EditorClientImpl(this),
+ &editor_client_impl_,
new DragClientImpl(this),
new WebInspectorClient(this)));
@@ -413,14 +415,6 @@ RenderTheme* WebViewImpl::theme() const {
return page_.get() ? page_->theme() : RenderTheme::defaultTheme().get();
}
-void WebViewImpl::SetUseEditorDelegate(bool value) {
- ASSERT(page_ != 0); // The macro doesn't like (!page_) with a scoped_ptr.
- ASSERT(page_->editorClient());
- EditorClientImpl* editor_client =
- static_cast<EditorClientImpl*>(page_->editorClient());
- editor_client->SetUseEditorDelegate(value);
-}
-
void WebViewImpl::SetTabKeyCyclesThroughElements(bool value) {
if (page_ != NULL) {
page_->setTabKeyCyclesThroughElements(value);
@@ -957,6 +951,7 @@ void WebViewImpl::close() {
// Reset the delegate to prevent notifications being sent as we're being
// deleted.
delegate_ = NULL;
+ editor_client_impl_.DropEditingClient();
Release(); // Balances AddRef from WebView::Create
}