summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/common/plugin_messages.h5
-rw-r--r--content/plugin/webplugin_delegate_stub.cc8
-rw-r--r--content/plugin/webplugin_delegate_stub.h1
-rw-r--r--content/renderer/webplugin_delegate_proxy.cc6
-rw-r--r--content/renderer/webplugin_delegate_proxy.h1
-rw-r--r--webkit/plugins/npapi/plugin_instance.cc15
-rw-r--r--webkit/plugins/npapi/plugin_instance.h3
-rw-r--r--webkit/plugins/npapi/webplugin_delegate.h6
-rw-r--r--webkit/plugins/npapi/webplugin_delegate_impl.cc4
-rw-r--r--webkit/plugins/npapi/webplugin_delegate_impl.h1
-rw-r--r--webkit/plugins/npapi/webplugin_impl.cc10
-rw-r--r--webkit/plugins/npapi/webplugin_impl.h1
-rw-r--r--webkit/plugins/npapi/webview_plugin.cc5
-rw-r--r--webkit/plugins/npapi/webview_plugin.h1
-rw-r--r--webkit/plugins/ppapi/ppapi_webplugin_impl.cc4
-rw-r--r--webkit/plugins/ppapi/ppapi_webplugin_impl.h1
16 files changed, 70 insertions, 2 deletions
diff --git a/content/common/plugin_messages.h b/content/common/plugin_messages.h
index 136fa83..0b01cc8 100644
--- a/content/common/plugin_messages.h
+++ b/content/common/plugin_messages.h
@@ -183,6 +183,11 @@ IPC_MESSAGE_ROUTED0(PluginMsg_DidPaint)
IPC_SYNC_MESSAGE_ROUTED0_1(PluginMsg_GetPluginScriptableObject,
int /* route_id */)
+// Gets the form value of the plugin instance synchronously.
+IPC_SYNC_MESSAGE_ROUTED0_2(PluginMsg_GetFormValue,
+ string16 /* value */,
+ bool /* success */)
+
IPC_MESSAGE_ROUTED3(PluginMsg_DidFinishLoadWithReason,
GURL /* url */,
int /* reason */,
diff --git a/content/plugin/webplugin_delegate_stub.cc b/content/plugin/webplugin_delegate_stub.cc
index 9555313..00987b2 100644
--- a/content/plugin/webplugin_delegate_stub.cc
+++ b/content/plugin/webplugin_delegate_stub.cc
@@ -102,6 +102,7 @@ bool WebPluginDelegateStub::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(PluginMsg_DidPaint, OnDidPaint)
IPC_MESSAGE_HANDLER(PluginMsg_GetPluginScriptableObject,
OnGetPluginScriptableObject)
+ IPC_MESSAGE_HANDLER(PluginMsg_GetFormValue, OnGetFormValue)
IPC_MESSAGE_HANDLER(PluginMsg_UpdateGeometry, OnUpdateGeometry)
IPC_MESSAGE_HANDLER(PluginMsg_UpdateGeometrySync, OnUpdateGeometry)
IPC_MESSAGE_HANDLER(PluginMsg_SendJavaScriptStream,
@@ -292,6 +293,13 @@ void WebPluginDelegateStub::OnGetPluginScriptableObject(int* route_id) {
WebBindings::releaseObject(object);
}
+void WebPluginDelegateStub::OnGetFormValue(string16* value, bool* success) {
+ *success = false;
+ if (!delegate_)
+ return;
+ *success = delegate_->GetFormValue(value);
+}
+
void WebPluginDelegateStub::OnSendJavaScriptStream(const GURL& url,
const std::string& result,
bool success,
diff --git a/content/plugin/webplugin_delegate_stub.h b/content/plugin/webplugin_delegate_stub.h
index 629da0a..3c4610a 100644
--- a/content/plugin/webplugin_delegate_stub.h
+++ b/content/plugin/webplugin_delegate_stub.h
@@ -78,6 +78,7 @@ class WebPluginDelegateStub : public IPC::Channel::Listener,
const std::string& result,
bool success,
int notify_id);
+ void OnGetFormValue(string16* value, bool* success);
void OnSetContentAreaFocus(bool has_focus);
#if defined(OS_MACOSX)
diff --git a/content/renderer/webplugin_delegate_proxy.cc b/content/renderer/webplugin_delegate_proxy.cc
index b6c3619..f6c3d9c 100644
--- a/content/renderer/webplugin_delegate_proxy.cc
+++ b/content/renderer/webplugin_delegate_proxy.cc
@@ -937,6 +937,12 @@ NPObject* WebPluginDelegateProxy::GetPluginScriptableObject() {
return WebBindings::retainObject(npobject_);
}
+bool WebPluginDelegateProxy::GetFormValue(string16* value) {
+ bool success = false;
+ Send(new PluginMsg_GetFormValue(instance_id_, value, &success));
+ return success;
+}
+
void WebPluginDelegateProxy::DidFinishLoadWithReason(
const GURL& url, NPReason reason, int notify_id) {
Send(new PluginMsg_DidFinishLoadWithReason(
diff --git a/content/renderer/webplugin_delegate_proxy.h b/content/renderer/webplugin_delegate_proxy.h
index 7912436..3318140 100644
--- a/content/renderer/webplugin_delegate_proxy.h
+++ b/content/renderer/webplugin_delegate_proxy.h
@@ -71,6 +71,7 @@ class WebPluginDelegateProxy
const gfx::Rect& clip_rect);
virtual void Paint(WebKit::WebCanvas* canvas, const gfx::Rect& rect);
virtual NPObject* GetPluginScriptableObject();
+ virtual bool GetFormValue(string16* value);
virtual void DidFinishLoadWithReason(const GURL& url, NPReason reason,
int notify_id);
virtual void SetFocus(bool focused);
diff --git a/webkit/plugins/npapi/plugin_instance.cc b/webkit/plugins/npapi/plugin_instance.cc
index 53242af..30e16a5 100644
--- a/webkit/plugins/npapi/plugin_instance.cc
+++ b/webkit/plugins/npapi/plugin_instance.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -172,6 +172,19 @@ NPObject *PluginInstance::GetPluginScriptableObject() {
return value;
}
+bool PluginInstance::GetFormValue(string16* value) {
+ // Plugins will allocate memory for the return value by using NPN_MemAlloc().
+ char *plugin_value = NULL;
+ NPError error = NPP_GetValue(NPPVformValue, &plugin_value);
+ if (error != NPERR_NO_ERROR || !plugin_value) {
+ return false;
+ }
+ // Assumes the result is UTF8 text, as Firefox does.
+ *value = UTF8ToUTF16(plugin_value);
+ host_->host_functions()->memfree(plugin_value);
+ return true;
+}
+
// WebPluginLoadDelegate methods
void PluginInstance::DidFinishLoadWithReason(
const GURL& url, NPReason reason, int notify_id) {
diff --git a/webkit/plugins/npapi/plugin_instance.h b/webkit/plugins/npapi/plugin_instance.h
index d24bc9f..162b72e 100644
--- a/webkit/plugins/npapi/plugin_instance.h
+++ b/webkit/plugins/npapi/plugin_instance.h
@@ -152,6 +152,9 @@ class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> {
// Have the plugin create it's script object.
NPObject *GetPluginScriptableObject();
+ // Returns the form value of this instance.
+ bool GetFormValue(string16* value);
+
// WebViewDelegate methods that we implement. This is for handling
// callbacks during getURLNotify.
void DidFinishLoadWithReason(const GURL& url, NPReason reason, int notify_id);
diff --git a/webkit/plugins/npapi/webplugin_delegate.h b/webkit/plugins/npapi/webplugin_delegate.h
index c3a4a04..2a89f01 100644
--- a/webkit/plugins/npapi/webplugin_delegate.h
+++ b/webkit/plugins/npapi/webplugin_delegate.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -93,6 +93,10 @@ class WebPluginDelegate : public WebPlugin2DDeviceDelegate,
// Gets the NPObject associated with the plugin for scripting.
virtual NPObject* GetPluginScriptableObject() = 0;
+ // Gets the form value associated with the plugin instance.
+ // Returns false if the value is not available.
+ virtual bool GetFormValue(string16* value) = 0;
+
// Receives notification about a resource load that the plugin initiated
// for a frame.
virtual void DidFinishLoadWithReason(const GURL& url, NPReason reason,
diff --git a/webkit/plugins/npapi/webplugin_delegate_impl.cc b/webkit/plugins/npapi/webplugin_delegate_impl.cc
index 9d13b44..04f2193 100644
--- a/webkit/plugins/npapi/webplugin_delegate_impl.cc
+++ b/webkit/plugins/npapi/webplugin_delegate_impl.cc
@@ -196,6 +196,10 @@ NPObject* WebPluginDelegateImpl::GetPluginScriptableObject() {
return instance_->GetPluginScriptableObject();
}
+bool WebPluginDelegateImpl::GetFormValue(string16* value) {
+ return instance_->GetFormValue(value);
+}
+
void WebPluginDelegateImpl::DidFinishLoadWithReason(const GURL& url,
NPReason reason,
int notify_id) {
diff --git a/webkit/plugins/npapi/webplugin_delegate_impl.h b/webkit/plugins/npapi/webplugin_delegate_impl.h
index 84c74fc..26bfb65 100644
--- a/webkit/plugins/npapi/webplugin_delegate_impl.h
+++ b/webkit/plugins/npapi/webplugin_delegate_impl.h
@@ -106,6 +106,7 @@ class WebPluginDelegateImpl : public WebPluginDelegate {
virtual bool HandleInputEvent(const WebKit::WebInputEvent& event,
WebKit::WebCursorInfo* cursor_info);
virtual NPObject* GetPluginScriptableObject();
+ virtual bool GetFormValue(string16* value);
virtual void DidFinishLoadWithReason(
const GURL& url, NPReason reason, int notify_id);
virtual int GetProcessId();
diff --git a/webkit/plugins/npapi/webplugin_impl.cc b/webkit/plugins/npapi/webplugin_impl.cc
index 91eada0..17473b9 100644
--- a/webkit/plugins/npapi/webplugin_impl.cc
+++ b/webkit/plugins/npapi/webplugin_impl.cc
@@ -260,6 +260,16 @@ NPObject* WebPluginImpl::scriptableObject() {
return delegate_->GetPluginScriptableObject();
}
+bool WebPluginImpl::getFormValue(WebKit::WebString* value) {
+ if (!delegate_)
+ return false;
+ string16 form_value;
+ if (!delegate_->GetFormValue(&form_value))
+ return false;
+ *value = form_value;
+ return true;
+}
+
void WebPluginImpl::paint(WebCanvas* canvas, const WebRect& paint_rect) {
if (!delegate_ || !container_)
return;
diff --git a/webkit/plugins/npapi/webplugin_impl.h b/webkit/plugins/npapi/webplugin_impl.h
index d08332c..9eaf10c 100644
--- a/webkit/plugins/npapi/webplugin_impl.h
+++ b/webkit/plugins/npapi/webplugin_impl.h
@@ -71,6 +71,7 @@ class WebPluginImpl : public WebPlugin,
WebKit::WebPluginContainer* container);
virtual void destroy();
virtual NPObject* scriptableObject();
+ virtual bool getFormValue(WebKit::WebString* value);
virtual void paint(
WebKit::WebCanvas* canvas, const WebKit::WebRect& paint_rect);
virtual void updateGeometry(
diff --git a/webkit/plugins/npapi/webview_plugin.cc b/webkit/plugins/npapi/webview_plugin.cc
index d1df40f..cda369b 100644
--- a/webkit/plugins/npapi/webview_plugin.cc
+++ b/webkit/plugins/npapi/webview_plugin.cc
@@ -37,6 +37,7 @@ using WebKit::WebPluginContainer;
using WebKit::WebPoint;
using WebKit::WebRect;
using WebKit::WebSize;
+using WebKit::WebString;
using WebKit::WebURLError;
using WebKit::WebURLRequest;
using WebKit::WebURLResponse;
@@ -116,6 +117,10 @@ NPObject* WebViewPlugin::scriptableObject() {
return NULL;
}
+bool WebViewPlugin::getFormValue(WebString* value) {
+ return false;
+}
+
void WebViewPlugin::paint(WebCanvas* canvas, const WebRect& rect) {
gfx::Rect paintRect(rect_.Intersect(rect));
if (paintRect.IsEmpty())
diff --git a/webkit/plugins/npapi/webview_plugin.h b/webkit/plugins/npapi/webview_plugin.h
index 96e0d73..c03c8a5 100644
--- a/webkit/plugins/npapi/webview_plugin.h
+++ b/webkit/plugins/npapi/webview_plugin.h
@@ -76,6 +76,7 @@ class WebViewPlugin: public WebKit::WebPlugin, public WebKit::WebViewClient,
virtual void destroy();
virtual NPObject* scriptableObject();
+ virtual bool getFormValue(WebKit::WebString* value);
virtual void paint(WebKit::WebCanvas* canvas, const WebKit::WebRect& rect);
diff --git a/webkit/plugins/ppapi/ppapi_webplugin_impl.cc b/webkit/plugins/ppapi/ppapi_webplugin_impl.cc
index cf5066a..f99f319 100644
--- a/webkit/plugins/ppapi/ppapi_webplugin_impl.cc
+++ b/webkit/plugins/ppapi/ppapi_webplugin_impl.cc
@@ -107,6 +107,10 @@ NPObject* WebPluginImpl::scriptableObject() {
return message_channel_np_object;
}
+bool WebPluginImpl::getFormValue(WebString* value) {
+ return false;
+}
+
void WebPluginImpl::paint(WebCanvas* canvas, const WebRect& rect) {
if (!instance_->IsFullscreenOrPending())
instance_->Paint(canvas, plugin_rect_, rect);
diff --git a/webkit/plugins/ppapi/ppapi_webplugin_impl.h b/webkit/plugins/ppapi/ppapi_webplugin_impl.h
index e35471f..f47176d 100644
--- a/webkit/plugins/ppapi/ppapi_webplugin_impl.h
+++ b/webkit/plugins/ppapi/ppapi_webplugin_impl.h
@@ -41,6 +41,7 @@ class WebPluginImpl : public WebKit::WebPlugin {
virtual bool initialize(WebKit::WebPluginContainer* container);
virtual void destroy();
virtual NPObject* scriptableObject();
+ virtual bool getFormValue(WebKit::WebString* value);
virtual void paint(WebKit::WebCanvas* canvas, const WebKit::WebRect& rect);
virtual void updateGeometry(
const WebKit::WebRect& frame_rect,