Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2081)

Unified Diff: content/renderer/pepper/pepper_browser_connection.h

Issue 15947004: Allow renderer to create pepper ResourceHosts in the browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/pepper/pepper_browser_connection.h
diff --git a/content/renderer/pepper/pepper_browser_connection.h b/content/renderer/pepper/pepper_browser_connection.h
new file mode 100644
index 0000000000000000000000000000000000000000..ebee10ca7e84779bfdf239f4047963a8dc1956fb
--- /dev/null
+++ b/content/renderer/pepper/pepper_browser_connection.h
@@ -0,0 +1,61 @@
+// Copyright (c) 2013 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_RENDERER_PEPPER_PEPPER_BROWSER_CONNECTION_H_
+#define CONTENT_RENDERER_PEPPER_PEPPER_BROWSER_CONNECTION_H_
+
+#include <map>
+
+#include "base/callback.h"
+#include "content/public/renderer/render_view_observer.h"
+#include "ppapi/c/pp_instance.h"
+
+namespace content {
+
+class PepperPluginDelegateImpl;
+
+// This class represents a connection from the renderer to the browser for
+// sending/receiving pepper ResourceHost related messages. When the browser
+// and renderer communicate about ResourceHosts, they should pass the plugin
+// process ID to identify which plugin they are talking about.
+class PepperBrowserConnection {
+ public:
+ typedef base::Callback<void(int)> PendingResourceIDCallback;
+
+ explicit PepperBrowserConnection(PepperPluginDelegateImpl* plugin_delegate);
+ virtual ~PepperBrowserConnection();
+
+ bool OnMessageReceived(const IPC::Message& message);
+
+ // Sends a request to the browser to create a ResourceHost for the given
+ // |instance| of a plugin identified by |child_process_id|. |callback| will be
+ // run when a reply is received with the pending resource ID.
+ void SendBrowserCreate(PP_Instance instance,
+ int child_process_id,
+ const IPC::Message& create_message,
+ const PendingResourceIDCallback& callback);
+
+ private:
+ // Message handlers.
+ void OnMsgCreateResourceHostFromHostReply(int32_t sequence_number,
+ int pending_resource_host_id);
+
+ // Return the next sequence number.
+ int32_t GetNextSequence();
+
+ // The plugin delegate that owns us.
+ PepperPluginDelegateImpl* plugin_delegate_;
+
+ // Sequence number to track pending callbacks.
+ int32_t next_sequence_number_;
+
+ // Maps a sequence number to the callback to be run.
+ std::map<int32_t, PendingResourceIDCallback> pending_create_map_;
+
+ DISALLOW_COPY_AND_ASSIGN(PepperBrowserConnection);
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_PEPPER_PEPPER_BROWSER_CONNECTION_H_
« no previous file with comments | « content/renderer/pepper/mock_renderer_ppapi_host.cc ('k') | content/renderer/pepper/pepper_browser_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698