summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/webplugin_delegate_pepper.cc
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-08 20:33:01 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-08 20:33:01 +0000
commit0fdbf8c361ea8b3a51c9c81b9e90da145d357a3c (patch)
treed9816c6046fab903f2695301e13eded622422626 /chrome/renderer/webplugin_delegate_pepper.cc
parentf51ffcf1fa06f12c96cc3bcb6c0659c65371fe81 (diff)
downloadchromium_src-0fdbf8c361ea8b3a51c9c81b9e90da145d357a3c.zip
chromium_src-0fdbf8c361ea8b3a51c9c81b9e90da145d357a3c.tar.gz
chromium_src-0fdbf8c361ea8b3a51c9c81b9e90da145d357a3c.tar.bz2
Chrome side of making RenderView not special case PluginDocument and making the WebPlugin API more like WebView.
Review URL: http://codereview.chromium.org/2827047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51886 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/webplugin_delegate_pepper.cc')
-rw-r--r--chrome/renderer/webplugin_delegate_pepper.cc49
1 files changed, 14 insertions, 35 deletions
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);