summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-23 14:40:50 +0000
committerbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-23 14:40:50 +0000
commitd8415ad900d21b08c678bc7b06b2e81581311f71 (patch)
treea22de25afa5b134c071284fe5823fb2b47033c26 /webkit
parent574b04420530b62321e47610e7edbcac2165830e (diff)
downloadchromium_src-d8415ad900d21b08c678bc7b06b2e81581311f71.zip
chromium_src-d8415ad900d21b08c678bc7b06b2e81581311f71.tar.gz
chromium_src-d8415ad900d21b08c678bc7b06b2e81581311f71.tar.bz2
Add hooks to content to request permission to connect to the PPAPI broker.
BUG=142639 TEST=browser_tests:PPAPITest.Broker Review URL: https://chromiumcodereview.appspot.com/10854040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152991 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/plugins/ppapi/plugin_delegate.h6
-rw-r--r--webkit/plugins/ppapi/ppb_broker_impl.cc8
-rw-r--r--webkit/plugins/ppapi/ppb_broker_impl.h4
3 files changed, 14 insertions, 4 deletions
diff --git a/webkit/plugins/ppapi/plugin_delegate.h b/webkit/plugins/ppapi/plugin_delegate.h
index 7418070..3e75cc5 100644
--- a/webkit/plugins/ppapi/plugin_delegate.h
+++ b/webkit/plugins/ppapi/plugin_delegate.h
@@ -299,12 +299,10 @@ class PluginDelegate {
// Provides access to the ppapi broker.
class Broker {
public:
- virtual void Connect(webkit::ppapi::PPB_Broker_Impl* client) = 0;
-
// Decrements the references to the broker.
// When there are no more references, this renderer's dispatcher is
// destroyed, allowing the broker to shutdown if appropriate.
- // Callers should not reference this object after calling Disconnect.
+ // Callers should not reference this object after calling Disconnect().
virtual void Disconnect(webkit::ppapi::PPB_Broker_Impl* client) = 0;
protected:
@@ -404,7 +402,7 @@ class PluginDelegate {
// A pointer is returned immediately, but it is not ready to be used until
// BrokerConnected has been called.
- // The caller is responsible for calling Release() on the returned pointer
+ // The caller is responsible for calling Disconnect() on the returned pointer
// to clean up the corresponding resources allocated during this call.
virtual Broker* ConnectToBroker(webkit::ppapi::PPB_Broker_Impl* client) = 0;
diff --git a/webkit/plugins/ppapi/ppb_broker_impl.cc b/webkit/plugins/ppapi/ppb_broker_impl.cc
index 2386e0d..49342fc 100644
--- a/webkit/plugins/ppapi/ppb_broker_impl.cc
+++ b/webkit/plugins/ppapi/ppb_broker_impl.cc
@@ -6,6 +6,9 @@
#include "base/logging.h"
#include "ppapi/shared_impl/platform_file.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h"
#include "webkit/plugins/ppapi/common.h"
#include "webkit/plugins/ppapi/plugin_module.h"
#include "webkit/plugins/ppapi/resource_helper.h"
@@ -75,6 +78,11 @@ int32_t PPB_Broker_Impl::GetHandle(int32_t* handle) {
return PP_OK;
}
+GURL PPB_Broker_Impl::GetDocumentUrl() {
+ PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this);
+ return plugin_instance->container()->element().document().url();
+}
+
// Transfers ownership of the handle to the plugin.
void PPB_Broker_Impl::BrokerConnected(int32_t handle, int32_t result) {
DCHECK(pipe_handle_ ==
diff --git a/webkit/plugins/ppapi/ppb_broker_impl.h b/webkit/plugins/ppapi/ppb_broker_impl.h
index 6799c4f..ab02ae8 100644
--- a/webkit/plugins/ppapi/ppb_broker_impl.h
+++ b/webkit/plugins/ppapi/ppb_broker_impl.h
@@ -36,6 +36,10 @@ class WEBKIT_PLUGINS_EXPORT PPB_Broker_Impl
scoped_refptr< ::ppapi::TrackedCallback> connect_callback) OVERRIDE;
virtual int32_t GetHandle(int32_t* handle) OVERRIDE;
+ // Returns the URL of the document this plug-in runs in. This is necessary to
+ // decide whether to grant access to the PPAPI broker.
+ GURL GetDocumentUrl();
+
void BrokerConnected(int32_t handle, int32_t result);
private: