diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-21 23:06:05 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-21 23:06:05 +0000 |
commit | 00d7e6289878922b937039cf542144a8c7906e8e (patch) | |
tree | c32e756faa3f6c079b81c5f759a65642b210bd2e | |
parent | 33eb5ad09b9cc9fe9f1fb95c4ba41ace5c3b6bc8 (diff) | |
download | chromium_src-00d7e6289878922b937039cf542144a8c7906e8e.zip chromium_src-00d7e6289878922b937039cf542144a8c7906e8e.tar.gz chromium_src-00d7e6289878922b937039cf542144a8c7906e8e.tar.bz2 |
Use webtextinput to insert text for middle-click paste.
Remove InsertText() from webview.
Review URL: http://codereview.chromium.org/87002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14153 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/renderer/render_view.cc | 5 | ||||
-rw-r--r-- | webkit/glue/webtextinput.h | 14 | ||||
-rw-r--r-- | webkit/glue/webview.h | 3 | ||||
-rw-r--r-- | webkit/glue/webview_impl.cc | 12 | ||||
-rw-r--r-- | webkit/glue/webview_impl.h | 3 |
5 files changed, 10 insertions, 27 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index f208182..9523e7a 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -73,6 +73,7 @@ #include "webkit/glue/webpreferences.h" #include "webkit/glue/webplugin_delegate.h" #include "webkit/glue/webresponse.h" +#include "webkit/glue/webtextinput.h" #include "webkit/glue/weburlrequest.h" #include "webkit/glue/webview.h" @@ -2443,7 +2444,9 @@ void RenderView::OnZoom(int function) { } void RenderView::OnInsertText(const string16& text) { - webview()->InsertText(text); + WebTextInput* text_input = webview()->GetMainFrame()->GetTextInput(); + if (text_input) + text_input->InsertText(UTF16ToUTF8(text)); } void RenderView::OnSetPageEncoding(const std::wstring& encoding_name) { diff --git a/webkit/glue/webtextinput.h b/webkit/glue/webtextinput.h index fb51f83..60dfa7a 100644 --- a/webkit/glue/webtextinput.h +++ b/webkit/glue/webtextinput.h @@ -1,13 +1,9 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 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. -// -// Class WebTextInput provides text input APIs used by TextInputController -// in test_shell. It only facilitates layout tests and should not be used -// by renderers. -#ifndef WEBKIT_GLUE_WEBTEXTINPUT_H__ -#define WEBKIT_GLUE_WEBTEXTINPUT_H__ +#ifndef WEBKIT_GLUE_WEBTEXTINPUT_H_ +#define WEBKIT_GLUE_WEBTEXTINPUT_H_ #include <string> #include "base/basictypes.h" @@ -56,7 +52,7 @@ class WebTextInput { virtual void MakeAttributedString(const std::string& str) = 0; private: - DISALLOW_EVIL_CONSTRUCTORS(WebTextInput); + DISALLOW_COPY_AND_ASSIGN(WebTextInput); }; -#endif // #ifndef WEBKIT_GLUE_WEBTEXTINPUT_H__ +#endif // #ifndef WEBKIT_GLUE_WEBTEXTINPUT_H_ diff --git a/webkit/glue/webview.h b/webkit/glue/webview.h index 99ad41e..8f39bd31 100644 --- a/webkit/glue/webview.h +++ b/webkit/glue/webview.h @@ -166,9 +166,6 @@ class WebView : public WebWidget { virtual void ZoomOut(bool text_only) = 0; virtual void ResetZoom() = 0; - // Insert text into the current editor. - virtual void InsertText(const string16& text) = 0; - // Copy to the clipboard the image located at a particular point in the // WebView (if there is such an image) virtual void CopyImageAt(int x, int y) = 0; diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc index 11e1d07..03db938 100644 --- a/webkit/glue/webview_impl.cc +++ b/webkit/glue/webview_impl.cc @@ -1550,18 +1550,6 @@ void WebViewImpl::ResetZoom() { main_frame()->frame()->isZoomFactorTextOnly()); } -void WebViewImpl::InsertText(const string16& text) { - Frame* focused = GetFocusedWebCoreFrame(); - if (!focused) - return; - Editor* editor = focused->editor(); - if (!editor || !editor->canEdit()) - return; - - editor->insertTextWithoutSendingTextEvent( - webkit_glue::String16ToString(text), false, NULL); -} - void WebViewImpl::CopyImageAt(int x, int y) { if (!page_.get()) return; diff --git a/webkit/glue/webview_impl.h b/webkit/glue/webview_impl.h index 373bcd5..5b3565b 100644 --- a/webkit/glue/webview_impl.h +++ b/webkit/glue/webview_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 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. @@ -92,7 +92,6 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { virtual void ZoomIn(bool text_only); virtual void ZoomOut(bool text_only); virtual void ResetZoom(); - virtual void InsertText(const string16& text); virtual void CopyImageAt(int x, int y); virtual void InspectElement(int x, int y); virtual void ShowJavaScriptConsole(); |