summaryrefslogtreecommitdiffstats
path: root/content/common
diff options
context:
space:
mode:
authorraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-10 19:28:46 +0000
committerraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-10 19:28:46 +0000
commit83d12c8ddc0ce79975db70edb0ffd35305f49ee2 (patch)
tree79bd1b1125f32b97616d9b1ca7ad2555d6fa1e04 /content/common
parente981b3fa852cdbf3bb098e4ebf2d1def635b90c2 (diff)
downloadchromium_src-83d12c8ddc0ce79975db70edb0ffd35305f49ee2.zip
chromium_src-83d12c8ddc0ce79975db70edb0ffd35305f49ee2.tar.gz
chromium_src-83d12c8ddc0ce79975db70edb0ffd35305f49ee2.tar.bz2
Implement an IsAllowed function in the pepper PPB_Broker_Trusted API
Flash sometimes needs to synchronously know if it can launch the broker, otherwise it will try to launch the broker when it shouldn't, and end up popping an infobar. This adds an IsAllowed function to synchronously test whether the broker is allowed to launch without popping the infobar. Note that the document URL of the plugin instance is needed in order to check the broker permissions in the browser process. This is only available in the renderer process. In order to avoid an extra hop to the renderer process just to get this URL, it is sent to the browser (with the render view ID) upon initialization of the instance when the instance is registered with the browser process. BUG=163248 Review URL: https://chromiumcodereview.appspot.com/11316316 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172104 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common')
-rw-r--r--content/common/pepper_renderer_instance_data.cc28
-rw-r--r--content/common/pepper_renderer_instance_data.h31
-rw-r--r--content/common/view_messages.h30
3 files changed, 80 insertions, 9 deletions
diff --git a/content/common/pepper_renderer_instance_data.cc b/content/common/pepper_renderer_instance_data.cc
new file mode 100644
index 0000000..73b67a7
--- /dev/null
+++ b/content/common/pepper_renderer_instance_data.cc
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 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.
+
+#include "content/common/pepper_renderer_instance_data.h"
+
+namespace content {
+
+PepperRendererInstanceData::PepperRendererInstanceData()
+ : render_process_id(0),
+ render_view_id(0) {
+}
+
+PepperRendererInstanceData::PepperRendererInstanceData(
+ int render_process,
+ int render_view,
+ const GURL& document,
+ const GURL& plugin)
+ : render_process_id(render_process),
+ render_view_id(render_view),
+ document_url(document),
+ plugin_url(plugin) {
+}
+
+PepperRendererInstanceData::~PepperRendererInstanceData() {
+}
+
+} // namespace content
diff --git a/content/common/pepper_renderer_instance_data.h b/content/common/pepper_renderer_instance_data.h
new file mode 100644
index 0000000..b912792
--- /dev/null
+++ b/content/common/pepper_renderer_instance_data.h
@@ -0,0 +1,31 @@
+// Copyright (c) 2012 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.
+
+#ifndef CONTENT_COMMON_PEPPER_RENDERER_INSTANCE_DATA_H_
+#define CONTENT_COMMON_PEPPER_RENDERER_INSTANCE_DATA_H_
+
+#include "googleurl/src/gurl.h"
+
+namespace content {
+
+// This struct contains data which is associated with a particular plugin
+// instance and is related to the renderer in which the plugin instance lives.
+// This data is transferred to the browser process from the renderer when the
+// instance is created and is stored in the BrowserPpapiHost.
+struct PepperRendererInstanceData {
+ PepperRendererInstanceData();
+ PepperRendererInstanceData(int render_process,
+ int render_view,
+ const GURL& document,
+ const GURL& plugin);
+ ~PepperRendererInstanceData();
+ int render_process_id;
+ int render_view_id;
+ GURL document_url;
+ GURL plugin_url;
+};
+
+} // namespace content
+
+#endif // CONTENT_COMMON_PEPPER_RENDERER_INSTANCE_DATA_H_
diff --git a/content/common/view_messages.h b/content/common/view_messages.h
index 2727d49..5956f0d 100644
--- a/content/common/view_messages.h
+++ b/content/common/view_messages.h
@@ -12,6 +12,7 @@
#include "content/common/content_param_traits.h"
#include "content/common/edit_command.h"
#include "content/common/navigation_gesture.h"
+#include "content/common/pepper_renderer_instance_data.h"
#include "content/common/view_message_enums.h"
#include "content/port/common/input_event_ack_state.h"
#include "content/public/common/common_param_traits.h"
@@ -327,6 +328,13 @@ IPC_STRUCT_TRAITS_BEGIN(content::FrameNavigateParams)
IPC_STRUCT_TRAITS_MEMBER(socket_address)
IPC_STRUCT_TRAITS_END()
+IPC_STRUCT_TRAITS_BEGIN(content::PepperRendererInstanceData)
+ IPC_STRUCT_TRAITS_MEMBER(render_process_id)
+ IPC_STRUCT_TRAITS_MEMBER(render_view_id)
+ IPC_STRUCT_TRAITS_MEMBER(document_url)
+ IPC_STRUCT_TRAITS_MEMBER(plugin_url)
+IPC_STRUCT_TRAITS_END()
+
IPC_STRUCT_TRAITS_BEGIN(content::RendererPreferences)
IPC_STRUCT_TRAITS_MEMBER(can_accept_load_drops)
IPC_STRUCT_TRAITS_MEMBER(should_antialias_text)
@@ -1953,21 +1961,25 @@ IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_OpenChannelToPepperPlugin,
int /* plugin_child_id */)
// Notification that a plugin has created a new plugin instance. The parameters
-// indicate the plugin process ID that we're creating the instance for, and the
-// routing ID of the render view that the plugin instance is associated with.
-// This allows us to create a mapping in the browser process for what objects a
-// given PP_Instance is associated with.
+// indicate:
+// -The plugin process ID that we're creating the instance for.
+// -The instance ID of the instance being created.
+// -A PepperRendererInstanceData struct which contains properties from the
+// renderer which are associated with the plugin instance. This includes the
+// routing ID of the associated render view and the URL of plugin.
+// -Whether the plugin we're creating an instance for is external or internal.
//
// This message must be sync even though it returns no parameters to avoid
// a race condition with the plugin process. The plugin process sends messages
// to the browser that assume the browser knows about the instance. We need to
// make sure that the browser actually knows about the instance before we tell
// the plugin to run.
-IPC_SYNC_MESSAGE_CONTROL4_0(ViewHostMsg_DidCreateOutOfProcessPepperInstance,
- int /* plugin_child_id */,
- int32 /* pp_instance */,
- int /* view_routing_id */,
- bool /* is_external */)
+IPC_SYNC_MESSAGE_CONTROL4_0(
+ ViewHostMsg_DidCreateOutOfProcessPepperInstance,
+ int /* plugin_child_id */,
+ int32 /* pp_instance */,
+ content::PepperRendererInstanceData /* creation_data */,
+ bool /* is_external */)
// Notification that a plugin has destroyed an instance. This is the opposite of
// the "DidCreate" message above.