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
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_