Add ability to create pending resource hosts.

Allows the host side to register a ResourceHost as pending and send an ID to the plugin, to be connected to a PluginResource at a future time.

BUG=


Review URL: https://chromiumcodereview.appspot.com/11414147

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171099 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ppapi/proxy/plugin_resource.cc b/ppapi/proxy/plugin_resource.cc
index e86e090..3dd47baa 100644
--- a/ppapi/proxy/plugin_resource.cc
+++ b/ppapi/proxy/plugin_resource.cc
@@ -81,6 +81,20 @@
       new PpapiHostMsg_ResourceCreated(params, pp_instance(), msg));
 }
 
+void PluginResource::AttachToPendingHost(Destination dest,
+                                         int pending_host_id) {
+  // Connecting to a pending host is a replacement for "create".
+  if (dest == RENDERER) {
+    DCHECK(!sent_create_to_renderer_);
+    sent_create_to_renderer_ = true;
+  } else {
+    DCHECK(!sent_create_to_browser_);
+    sent_create_to_browser_ = true;
+  }
+  GetSender(dest)->Send(
+      new PpapiHostMsg_AttachToPendingHost(pp_resource(), pending_host_id));
+}
+
 void PluginResource::Post(Destination dest, const IPC::Message& msg) {
   ResourceMessageCallParams params(pp_resource(), GetNextSequence());
   SendResourceCall(dest, params, msg);