summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/renderer/pepper_plugin_delegate_impl.cc17
-rw-r--r--chrome/renderer/pepper_plugin_delegate_impl.h4
-rw-r--r--chrome/renderer/render_view.cc46
-rw-r--r--chrome/renderer/render_view.h3
-rw-r--r--chrome/renderer/webplugin_delegate_pepper.cc49
-rw-r--r--chrome/renderer/webplugin_delegate_pepper.h11
-rw-r--r--third_party/npapi/bindings/npapi_extensions.h6
-rw-r--r--webkit/glue/plugins/pepper_plugin_delegate.h8
-rw-r--r--webkit/glue/plugins/pepper_plugin_instance.cc33
-rw-r--r--webkit/glue/plugins/pepper_plugin_instance.h15
-rw-r--r--webkit/glue/plugins/pepper_webplugin_impl.cc35
-rw-r--r--webkit/glue/plugins/pepper_webplugin_impl.h10
-rw-r--r--webkit/glue/plugins/webplugin_delegate.h12
-rw-r--r--webkit/glue/plugins/webplugin_impl.cc49
-rw-r--r--webkit/glue/plugins/webplugin_impl.h47
15 files changed, 233 insertions, 112 deletions
diff --git a/chrome/renderer/pepper_plugin_delegate_impl.cc b/chrome/renderer/pepper_plugin_delegate_impl.cc
index 40ef961..16a1b8f 100644
--- a/chrome/renderer/pepper_plugin_delegate_impl.cc
+++ b/chrome/renderer/pepper_plugin_delegate_impl.cc
@@ -6,6 +6,7 @@
#include "app/surface/transport_dib.h"
#include "base/scoped_ptr.h"
+#include "chrome/renderer/render_view.h"
#include "webkit/glue/plugins/pepper_plugin_instance.h"
#if defined(OS_MACOSX)
@@ -131,3 +132,19 @@ PepperPluginDelegateImpl::CreateImage2D(int width, int height) {
return new PlatformImage2DImpl(width, height, dib);
}
+
+void PepperPluginDelegateImpl::DidChangeNumberOfFindResults(int identifier,
+ int total,
+ bool final_result) {
+ if (total == 0) {
+ render_view_->ReportNoFindInPageResults(identifier);
+ } else {
+ render_view_->reportFindInPageMatchCount(identifier, total, final_result);
+ }
+}
+
+void PepperPluginDelegateImpl::DidChangeSelectedFindResult(int identifier,
+ int index) {
+ render_view_->reportFindInPageSelection(
+ identifier, index + 1, WebKit::WebRect());
+}
diff --git a/chrome/renderer/pepper_plugin_delegate_impl.h b/chrome/renderer/pepper_plugin_delegate_impl.h
index 2edb4dd..9a6d28cfb 100644
--- a/chrome/renderer/pepper_plugin_delegate_impl.h
+++ b/chrome/renderer/pepper_plugin_delegate_impl.h
@@ -33,6 +33,10 @@ class PepperPluginDelegateImpl
virtual void InstanceCreated(pepper::PluginInstance* instance);
virtual void InstanceDeleted(pepper::PluginInstance* instance);
virtual PlatformImage2D* CreateImage2D(int width, int height);
+ virtual void DidChangeNumberOfFindResults(int identifier,
+ int total,
+ bool final_result);
+ virtual void DidChangeSelectedFindResult(int identifier, int index);
private:
// Pointer to the RenderView that owns us.
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 004c31c..f5c1aeb 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -1127,12 +1127,6 @@ void RenderView::OnCopy() {
if (!webview())
return;
- if (webview()->mainFrame()->document().isPluginDocument()) {
- webkit_glue::WebPluginDelegate* delegate = GetDelegateForPluginDocument();
- delegate->Copy();
- return;
- }
-
webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Copy"));
UserMetricsRecordAction("Copy");
}
@@ -3486,10 +3480,8 @@ GURL RenderView::GetAlternateErrorPageURL(const GURL& failed_url,
return url;
}
-webkit_glue::WebPluginDelegate* RenderView::GetDelegateForPluginDocument() {
- WebPlugin* plugin =
- webview()->mainFrame()->document().to<WebPluginDocument>().plugin();
- return static_cast<webkit_glue::WebPluginImpl*>(plugin)->delegate();
+WebKit::WebPlugin* RenderView::GetWebPluginFromPluginDocument() {
+ return webview()->mainFrame()->document().to<WebPluginDocument>().plugin();
}
void RenderView::OnFind(int request_id, const string16& search_text,
@@ -3497,19 +3489,19 @@ void RenderView::OnFind(int request_id, const string16& search_text,
WebFrame* main_frame = webview()->mainFrame();
if (main_frame->document().isPluginDocument()) {
- webkit_glue::WebPluginDelegate* delegate = GetDelegateForPluginDocument();
+#if defined(WEBPLUGIN_HAS_FIND_INTERFACE)
if (options.findNext) {
// Just navigate back/forward.
- delegate->SelectFindResult(options.forward);
+ GetWebPluginFromPluginDocument()->selectFindResult(options.forward);
} else {
- if (delegate->SupportsFind()) {
- delegate->StartFind(UTF16ToUTF8(search_text),
- options.matchCase,
- request_id);
+ if (GetWebPluginFromPluginDocument()->supportsFind()) {
+ GetWebPluginFromPluginDocument()->startFind(
+ search_text, options.matchCase, request_id);
} else {
ReportNoFindInPageResults(request_id);
}
}
+#endif
return;
}
@@ -3622,7 +3614,9 @@ void RenderView::OnStopFinding(const ViewMsg_StopFinding_Params& params) {
WebDocument doc = view->mainFrame()->document();
if (doc.isPluginDocument()) {
- GetDelegateForPluginDocument()->StopFind();
+#if defined(WEBPLUGIN_HAS_FIND_INTERFACE)
+ GetWebPluginFromPluginDocument()->stopFind();
+#endif
return;
}
@@ -3681,24 +3675,6 @@ void RenderView::OnZoom(PageZoom::Function function) {
return;
webview()->hidePopups();
- // Should we be saving zoom levels for plugins? It's not clear, so for now
- // don't.
- if (webview()->mainFrame()->document().isPluginDocument()) {
- webkit_glue::WebPluginDelegate* delegate = GetDelegateForPluginDocument();
- int zoom;
- if (function == PageZoom::RESET) {
- zoom = 0;
- } else if (function == PageZoom::ZOOM_OUT) {
- zoom = -1;
- } else if (function == PageZoom::ZOOM_IN) {
- zoom = 1;
- } else {
- NOTREACHED();
- return;
- }
- delegate->Zoom(zoom);
- return;
- }
int zoom_level = webview()->zoomLevel();
int new_zoom_level = webview()->setZoomLevel(false,
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index 30af943..e2c8387 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -108,6 +108,7 @@ class WebGeolocationServiceInterface;
class WebImage;
class WebMediaPlayer;
class WebMediaPlayerClient;
+class WebPlugin;
class WebStorageNamespace;
class WebURLRequest;
struct WebFileChooserParams;
@@ -880,7 +881,7 @@ class RenderView : public RenderWidget,
WebKit::WebFrame* GetChildFrame(const std::wstring& frame_xpath) const;
// Should only be called if this object wraps a PluginDocument.
- webkit_glue::WebPluginDelegate* GetDelegateForPluginDocument();
+ WebKit::WebPlugin* GetWebPluginFromPluginDocument();
// Decodes a data: URL image or returns an empty image in case of failure.
SkBitmap ImageFromDataUrl(const GURL&) const;
diff --git a/chrome/renderer/webplugin_delegate_pepper.cc b/chrome/renderer/webplugin_delegate_pepper.cc
index 3bb4ee2..fa379bb 100644
--- a/chrome/renderer/webplugin_delegate_pepper.cc
+++ b/chrome/renderer/webplugin_delegate_pepper.cc
@@ -55,7 +55,6 @@
#include "webkit/glue/plugins/plugin_list.h"
#include "webkit/glue/plugins/plugin_host.h"
#include "webkit/glue/plugins/plugin_stream_url.h"
-#include "webkit/glue/scoped_clipboard_writer_glue.h"
#include "webkit/glue/webkit_glue.h"
#if defined(ENABLE_GPU)
@@ -322,12 +321,12 @@ WebPluginResourceClient* WebPluginDelegatePepper::CreateSeekableResourceClient(
return instance()->GetRangeRequest(range_request_id);
}
-void WebPluginDelegatePepper::StartFind(const std::string& search_text,
+void WebPluginDelegatePepper::StartFind(const string16& search_text,
bool case_sensitive,
int identifier) {
find_identifier_ = identifier;
GetFindExtensions()->startFind(
- instance()->npp(), search_text.c_str(), case_sensitive);
+ instance()->npp(), UTF16ToUTF8(search_text).c_str(), case_sensitive);
}
void WebPluginDelegatePepper::SelectFindResult(bool forward) {
@@ -502,40 +501,34 @@ NPFontExtensions* WebPluginDelegatePepper::GetFontExtensions() {
return &g_font_extensions;
}
-void WebPluginDelegatePepper::Zoom(int factor) {
+void WebPluginDelegatePepper::SetZoomFactor(float scale, bool text_only) {
NPPExtensions* extensions = NULL;
instance()->NPP_GetValue(NPPVPepperExtensions, &extensions);
if (extensions && extensions->zoom)
- extensions->zoom(instance()->npp(), factor);
+ extensions->zoom(instance()->npp(), scale, text_only);
}
-void WebPluginDelegatePepper::Copy() {
- ScopedClipboardWriterGlue scw(webkit_glue::ClipboardGetClipboard());
- string16 text = GetSelectedText(true);
- if (!text.empty()) {
- // Got html data.
- scw.WriteHTML(text, std::string());
- return;
- }
-
- text = GetSelectedText(false);
- if (!text.empty())
- scw.WriteText(text);
+bool WebPluginDelegatePepper::HasSelection() const {
+ return !GetSelectedText(false).empty();
}
-string16 WebPluginDelegatePepper::GetSelectedText() {
+string16 WebPluginDelegatePepper::GetSelectionAsText() const {
return GetSelectedText(false);
}
-string16 WebPluginDelegatePepper::GetSelectedText(bool html) {
+string16 WebPluginDelegatePepper::GetSelectionAsMarkup() const {
+ return GetSelectedText(true);
+}
+
+string16 WebPluginDelegatePepper::GetSelectedText(bool html) const {
NPPExtensions* extensions = NULL;
- instance()->NPP_GetValue(NPPVPepperExtensions, &extensions);
+ instance_->NPP_GetValue(NPPVPepperExtensions, &extensions);
if (!extensions || !extensions->getSelection)
return string16();
void* text;
NPSelectionType type = html ? NPSelectionTypeHTML : NPSelectionTypePlainText;
- NPP npp = instance()->npp();
+ NPP npp = instance_->npp();
if (extensions->getSelection(npp, &type, &text) != NPERR_NO_ERROR)
return string16();
@@ -1543,20 +1536,6 @@ void BuildMouseWheelEvent(const WebInputEvent* event, NPPepperEvent* npevent) {
bool WebPluginDelegatePepper::HandleInputEvent(const WebInputEvent& event,
WebCursorInfo* cursor_info) {
- if (event.type == WebInputEvent::KeyDown) {
- const WebKeyboardEvent* key_event =
- reinterpret_cast<const WebKeyboardEvent*>(&event);
-#if defined(OS_MACOSX)
- if (key_event->modifiers == NPEventModifier_MetaKey &&
-#else
- if (key_event->modifiers == NPEventModifier_ControlKey &&
-#endif
- key_event->windowsKeyCode == base::VKEY_C) {
- Copy();
- return true;
- }
- }
-
NPPepperEvent npevent;
npevent.type = ConvertEventTypes(event.type);
diff --git a/chrome/renderer/webplugin_delegate_pepper.h b/chrome/renderer/webplugin_delegate_pepper.h
index e812cd9..f18f68a8 100644
--- a/chrome/renderer/webplugin_delegate_pepper.h
+++ b/chrome/renderer/webplugin_delegate_pepper.h
@@ -81,7 +81,7 @@ class WebPluginDelegatePepper : public webkit_glue::WebPluginDelegate,
virtual webkit_glue::WebPluginResourceClient* CreateSeekableResourceClient(
unsigned long resource_id, int range_request_id);
virtual bool SupportsFind();
- virtual void StartFind(const std::string& search_text,
+ virtual void StartFind(const string16& search_text,
bool case_sensitive,
int identifier);
virtual void SelectFindResult(bool forward);
@@ -95,9 +95,10 @@ class WebPluginDelegatePepper : public webkit_glue::WebPluginDelegate,
virtual NPWidgetExtensions* GetWidgetExtensions();
virtual bool SetCursor(NPCursorType type);
virtual NPFontExtensions* GetFontExtensions();
- virtual void Zoom(int factor);
- virtual void Copy();
- virtual string16 GetSelectedText();
+ virtual void SetZoomFactor(float scale, bool text_only);
+ virtual bool HasSelection() const;
+ virtual string16 GetSelectionAsText() const;
+ virtual string16 GetSelectionAsMarkup() const;
// WebPlugin2DDeviceDelegate implementation.
virtual NPError Device2DQueryCapability(int32 capability, int32* value);
@@ -268,7 +269,7 @@ class WebPluginDelegatePepper : public webkit_glue::WebPluginDelegate,
// Returns the selection. If nothing is selected, returns an empty string.
// If html is true, it will return a string only if html data is available.
- string16 GetSelectedText(bool html);
+ string16 GetSelectedText(bool html) const;
base::WeakPtr<RenderView> render_view_;
diff --git a/third_party/npapi/bindings/npapi_extensions.h b/third_party/npapi/bindings/npapi_extensions.h
index 0ce4360..144417b 100644
--- a/third_party/npapi/bindings/npapi_extensions.h
+++ b/third_party/npapi/bindings/npapi_extensions.h
@@ -1037,10 +1037,12 @@ typedef struct _NPPFindExtensions {
/* Returns NULL if the plugin does not support find extensions. */
typedef NPPFindExtensions* (*NPPGetFindExtensionsPtr)(NPP instance);
-/* Zooms plugins. 0 means reset, -1 means zoom out, and +1 means zoom in. */
+/* Zooms a plugin to the given factor. If text_only is true, then only the text
+ * should be zoomed. */
typedef NPError (*NPPZoomPtr) (
NPP instance,
- int factor);
+ float factor,
+ bool text_only);
typedef NPError (*NPPWidgetPropertyChangedPtr) (
NPP instance,
diff --git a/webkit/glue/plugins/pepper_plugin_delegate.h b/webkit/glue/plugins/pepper_plugin_delegate.h
index c00a9b3..ffc9d52 100644
--- a/webkit/glue/plugins/pepper_plugin_delegate.h
+++ b/webkit/glue/plugins/pepper_plugin_delegate.h
@@ -44,6 +44,14 @@ class PluginDelegate {
// The caller will own the pointer returned from this.
virtual PlatformImage2D* CreateImage2D(int width, int height) = 0;
+
+ // Notifies that the number of find results has changed.
+ virtual void DidChangeNumberOfFindResults(int identifier,
+ int total,
+ bool final_result) = 0;
+
+ // Notifies that the index of the currently selected item has been updated.
+ virtual void DidChangeSelectedFindResult(int identifier, int index) = 0;
};
} // namespace pepper
diff --git a/webkit/glue/plugins/pepper_plugin_instance.cc b/webkit/glue/plugins/pepper_plugin_instance.cc
index 65863f1..7ddbcaf 100644
--- a/webkit/glue/plugins/pepper_plugin_instance.cc
+++ b/webkit/glue/plugins/pepper_plugin_instance.cc
@@ -86,7 +86,8 @@ PluginInstance::PluginInstance(PluginDelegate* delegate,
module_(module),
instance_interface_(instance_interface),
container_(NULL),
- full_frame_(false) {
+ full_frame_(false),
+ find_identifier_(-1) {
DCHECK(delegate);
module_->InstanceCreated(this);
delegate_->InstanceCreated(this);
@@ -245,4 +246,34 @@ void PluginInstance::ViewFlushedPaint() {
device_context_2d_->ViewFlushedPaint();
}
+string16 PluginInstance::GetSelectedText(bool html) {
+ // TODO: implement me
+ return string16();
+}
+
+void PluginInstance::Zoom(float factor, bool text_only) {
+ // TODO: implement me
+}
+
+bool PluginInstance::SupportsFind() {
+ // TODO: implement me
+ return false;
+}
+
+void PluginInstance::StartFind(const string16& search_text,
+ bool case_sensitive,
+ int identifier) {
+ find_identifier_ = identifier;
+ // TODO: implement me
+}
+
+void PluginInstance::SelectFindResult(bool forward) {
+ // TODO: implement me
+}
+
+void PluginInstance::StopFind() {
+ find_identifier_ = -1;
+ // TODO: implement me
+}
+
} // namespace pepper
diff --git a/webkit/glue/plugins/pepper_plugin_instance.h b/webkit/glue/plugins/pepper_plugin_instance.h
index 017a1e8..8de9090 100644
--- a/webkit/glue/plugins/pepper_plugin_instance.h
+++ b/webkit/glue/plugins/pepper_plugin_instance.h
@@ -10,6 +10,7 @@
#include "base/basictypes.h"
#include "base/ref_counted.h"
+#include "base/string16.h"
#include "gfx/rect.h"
#include "third_party/ppapi/c/pp_instance.h"
#include "third_party/ppapi/c/pp_resource.h"
@@ -56,6 +57,8 @@ class PluginInstance : public base::RefCounted<PluginInstance> {
const gfx::Rect& position() const { return position_; }
const gfx::Rect& clip() const { return clip_; }
+ int find_identifier() const { return find_identifier_; }
+
PP_Instance GetPPInstance();
// Paints the current backing store to the web page.
@@ -93,6 +96,15 @@ class PluginInstance : public base::RefCounted<PluginInstance> {
void ViewInitiatedPaint();
void ViewFlushedPaint();
+ string16 GetSelectedText(bool html);
+ void Zoom(float factor, bool text_only);
+ bool SupportsFind();
+ void StartFind(const string16& search_text,
+ bool case_sensitive,
+ int identifier);
+ void SelectFindResult(bool forward);
+ void StopFind();
+
private:
PluginDelegate* delegate_;
scoped_refptr<PluginModule> module_;
@@ -118,6 +130,9 @@ class PluginInstance : public base::RefCounted<PluginInstance> {
// The current device context for painting in 2D.
scoped_refptr<DeviceContext2D> device_context_2d_;
+ // The id of the current find operation, or -1 if none is in process.
+ int find_identifier_;
+
DISALLOW_COPY_AND_ASSIGN(PluginInstance);
};
diff --git a/webkit/glue/plugins/pepper_webplugin_impl.cc b/webkit/glue/plugins/pepper_webplugin_impl.cc
index 2bddcc0..c2cae30 100644
--- a/webkit/glue/plugins/pepper_webplugin_impl.cc
+++ b/webkit/glue/plugins/pepper_webplugin_impl.cc
@@ -18,6 +18,7 @@ using WebKit::WebCanvas;
using WebKit::WebPluginContainer;
using WebKit::WebPluginParams;
using WebKit::WebRect;
+using WebKit::WebString;
using WebKit::WebVector;
namespace pepper {
@@ -144,4 +145,38 @@ void WebPluginImpl::didFailLoadingFrameRequest(
const WebKit::WebURLError& error) {
}
+bool WebPluginImpl::hasSelection() const {
+ return !selectionAsText().isEmpty();
+}
+
+WebKit::WebString WebPluginImpl::selectionAsText() const {
+ return instance_->GetSelectedText(false);
+}
+
+WebKit::WebString WebPluginImpl::selectionAsMarkup() const {
+ return instance_->GetSelectedText(true);
+}
+
+void WebPluginImpl::setZoomFactor(float scale, bool text_only) {
+ instance_->Zoom(scale, text_only);
+}
+
+bool WebPluginImpl::supportsFind() {
+ return instance_->SupportsFind();
+}
+
+void WebPluginImpl::startFind(const WebString& search_text,
+ bool case_sensitive,
+ int identifier) {
+ instance_->StartFind(search_text, case_sensitive, identifier);
+}
+
+void WebPluginImpl::selectFindResult(bool forward) {
+ instance_->SelectFindResult(forward);
+}
+
+void WebPluginImpl::stopFind() {
+ instance_->StopFind();
+}
+
} // namespace pepper
diff --git a/webkit/glue/plugins/pepper_webplugin_impl.h b/webkit/glue/plugins/pepper_webplugin_impl.h
index 040a67b..0b1827d 100644
--- a/webkit/glue/plugins/pepper_webplugin_impl.h
+++ b/webkit/glue/plugins/pepper_webplugin_impl.h
@@ -60,6 +60,16 @@ class WebPluginImpl : public WebKit::WebPlugin {
virtual void didFailLoadingFrameRequest(const WebKit::WebURL& url,
void* notify_data,
const WebKit::WebURLError& error);
+ virtual bool hasSelection() const;
+ virtual WebKit::WebString selectionAsText() const;
+ virtual WebKit::WebString selectionAsMarkup() const;
+ virtual void setZoomFactor(float scale, bool text_only);
+ virtual bool supportsFind();
+ virtual void startFind(const WebKit::WebString& search_text,
+ bool case_sensitive,
+ int identifier);
+ virtual void selectFindResult(bool forward);
+ virtual void stopFind();
struct InitData {
scoped_refptr<PluginModule> module;
diff --git a/webkit/glue/plugins/webplugin_delegate.h b/webkit/glue/plugins/webplugin_delegate.h
index f496d52..3b04d24 100644
--- a/webkit/glue/plugins/webplugin_delegate.h
+++ b/webkit/glue/plugins/webplugin_delegate.h
@@ -143,7 +143,7 @@ class WebPluginDelegate : public WebPlugin2DDeviceDelegate,
// See WebPluginContainerImpl's description of the interface.
virtual bool SupportsFind() { return false; }
- virtual void StartFind(const std::string& search_text,
+ virtual void StartFind(const string16& search_text,
bool case_sensitive,
int identifier) {}
virtual void SelectFindResult(bool forward) {}
@@ -156,11 +156,11 @@ class WebPluginDelegate : public WebPlugin2DDeviceDelegate,
// Used for zooming of full page plugins. 0 means reset, while -1 means zoom
// out and +1 means zoom in.
- virtual void Zoom(int factor) {}
- // Copy the selected text.
- virtual void Copy() {}
- // Gets the selected UTF8 text, if any.
- virtual string16 GetSelectedText() { return string16(); }
+ virtual void SetZoomFactor(float scale, bool text_only) {}
+ // Gets the selected text, if any.
+ virtual bool HasSelection() const { return false; }
+ virtual string16 GetSelectionAsText() const { return string16(); }
+ virtual string16 GetSelectionAsMarkup() const { return string16(); }
};
} // namespace webkit_glue
diff --git a/webkit/glue/plugins/webplugin_impl.cc b/webkit/glue/plugins/webplugin_impl.cc
index 96f7b4b..d7ba1a4 100644
--- a/webkit/glue/plugins/webplugin_impl.cc
+++ b/webkit/glue/plugins/webplugin_impl.cc
@@ -2,11 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "webkit/glue/plugins/webplugin_impl.h"
+
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "gfx/rect.h"
+#include "googleurl/src/gurl.h"
#include "net/base/escape.h"
#include "net/base/net_errors.h"
#include "skia/ext/platform_canvas.h"
@@ -35,9 +38,7 @@
#include "webkit/glue/plugins/plugin_host.h"
#include "webkit/glue/plugins/plugin_instance.h"
#include "webkit/glue/plugins/webplugin_delegate.h"
-#include "webkit/glue/plugins/webplugin_impl.h"
#include "webkit/glue/plugins/webplugin_page_delegate.h"
-#include "googleurl/src/gurl.h"
using WebKit::WebCanvas;
using WebKit::WebConsoleMessage;
@@ -422,11 +423,51 @@ void WebPluginImpl::printEnd() {
delegate_->PrintEnd();
}
-WebString WebPluginImpl::selectedText() {
+bool WebPluginImpl::hasSelection() const {
+ if (!delegate_)
+ return false;
+
+ return delegate_->HasSelection();
+}
+
+WebKit::WebString WebPluginImpl::selectionAsText() const {
+ if (!delegate_)
+ return WebString();
+
+ return delegate_->GetSelectionAsText();
+}
+
+WebKit::WebString WebPluginImpl::selectionAsMarkup() const {
if (!delegate_)
return WebString();
- return delegate_->GetSelectedText();
+ return delegate_->GetSelectionAsMarkup();
+}
+
+void WebPluginImpl::setZoomFactor(float scale, bool text_only) {
+ if (delegate_)
+ delegate_->SetZoomFactor(scale, text_only);
+}
+
+bool WebPluginImpl::supportsFind() {
+ return delegate_ && delegate_->SupportsFind();
+}
+
+void WebPluginImpl::startFind(const WebString& search_text,
+ bool case_sensitive,
+ int identifier) {
+ if (delegate_)
+ delegate_->StartFind(search_text, case_sensitive, identifier);
+}
+
+void WebPluginImpl::selectFindResult(bool forward) {
+ if (delegate_)
+ delegate_->SelectFindResult(forward);
+}
+
+void WebPluginImpl::stopFind() {
+ if (delegate_)
+ delegate_->StopFind();
}
diff --git a/webkit/glue/plugins/webplugin_impl.h b/webkit/glue/plugins/webplugin_impl.h
index 8436ae7..033dcb3 100644
--- a/webkit/glue/plugins/webplugin_impl.h
+++ b/webkit/glue/plugins/webplugin_impl.h
@@ -93,20 +93,40 @@ class WebPluginImpl : public WebPlugin,
int printer_dpi);
virtual bool printPage(int page_number, WebKit::WebCanvas* canvas);
virtual void printEnd();
- virtual WebKit::WebString selectedText();
+ virtual bool hasSelection() const;
+ virtual WebKit::WebString selectionAsText() const;
+ virtual WebKit::WebString selectionAsMarkup() const;
+ virtual void setZoomFactor(float scale, bool text_only);
+ virtual bool supportsFind();
+ virtual void startFind(const WebKit::WebString& search_text,
+ bool case_sensitive,
+ int identifier);
+ virtual void selectFindResult(bool forward);
+ virtual void stopFind();
// WebPlugin implementation:
void SetWindow(gfx::PluginWindowHandle window);
-
- // Whether input events should be sent to the delegate.
virtual void SetAcceptsInputEvents(bool accepts) {
accepts_input_events_ = accepts;
}
-
void WillDestroyWindow(gfx::PluginWindowHandle window);
#if defined(OS_WIN)
void SetWindowlessPumpEvent(HANDLE pump_messages_event) { }
#endif
+ virtual void CancelResource(unsigned long id);
+ virtual void Invalidate();
+ virtual void InvalidateRect(const gfx::Rect& rect);
+ virtual NPObject* GetWindowScriptNPObject();
+ virtual NPObject* GetPluginElement();
+ virtual void SetCookie(const GURL& url,
+ const GURL& first_party_for_cookies,
+ const std::string& cookie);
+ virtual std::string GetCookies(const GURL& url,
+ const GURL& first_party_for_cookies);
+ virtual void ShowModalHTMLDialog(const GURL& url, int width, int height,
+ const std::string& json_arguments,
+ std::string* json_retval);
+ virtual void OnMissingPluginStatus(int status);
// Given a (maybe partial) url, completes using the base url.
GURL CompleteURL(const char* url);
@@ -147,9 +167,6 @@ class WebPluginImpl : public WebPlugin,
int notify_id,
Referrer referrer_flag);
- // Cancels a pending request.
- void CancelResource(unsigned long id);
-
// Returns the next avaiable resource id. Returns 0 if the operation fails.
// It may fail if the page has already been closed.
unsigned long GetNextResourceId();
@@ -167,22 +184,6 @@ class WebPluginImpl : public WebPlugin,
gfx::Rect GetWindowClipRect(const gfx::Rect& rect);
- NPObject* GetWindowScriptNPObject();
- NPObject* GetPluginElement();
-
- void SetCookie(const GURL& url,
- const GURL& first_party_for_cookies,
- const std::string& cookie);
- std::string GetCookies(const GURL& url,
- const GURL& first_party_for_cookies);
-
- void ShowModalHTMLDialog(const GURL& url, int width, int height,
- const std::string& json_arguments,
- std::string* json_retval);
- void OnMissingPluginStatus(int status);
- void Invalidate();
- void InvalidateRect(const gfx::Rect& rect);
-
// Sets the actual Widget for the plugin.
void SetContainer(WebKit::WebPluginContainer* container);