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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_BROWSER_CONNECTION_H_
6 #define CONTENT_RENDERER_PEPPER_PEPPER_BROWSER_CONNECTION_H_
7
8 #include <map>
9
10 #include "base/callback.h"
11 #include "content/public/renderer/render_view_observer.h"
12 #include "ppapi/c/pp_instance.h"
13
14 namespace content {
15
16 class PepperPluginDelegateImpl;
17
18 // This class represents a connection from the renderer to the browser for
19 // sending/receiving pepper ResourceHost related messages. When the browser
20 // and renderer communicate about ResourceHosts, they should pass the plugin
21 // process ID to identify which plugin they are talking about.
22 class PepperBrowserConnection {
23 public:
24 typedef base::Callback<void(int)> PendingResourceIDCallback;
25
26 explicit PepperBrowserConnection(PepperPluginDelegateImpl* plugin_delegate);
27 virtual ~PepperBrowserConnection();
28
29 bool OnMessageReceived(const IPC::Message& message);
30
31 // Sends a request to the browser to create a ResourceHost for the given
32 // |instance| of a plugin identified by |child_process_id|. |callback| will be
33 // run when a reply is received with the pending resource ID.
34 void SendBrowserCreate(PP_Instance instance,
35 int child_process_id,
36 const IPC::Message& create_message,
37 const PendingResourceIDCallback& callback);
38
39 private:
40 // Message handlers.
41 void OnMsgCreateResourceHostFromHostReply(int32_t sequence_number,
42 int pending_resource_host_id);
43
44 // Return the next sequence number.
45 int32_t GetNextSequence();
46
47 // The plugin delegate that owns us.
48 PepperPluginDelegateImpl* plugin_delegate_;
49
50 // Sequence number to track pending callbacks.
51 int32_t next_sequence_number_;
52
53 // Maps a sequence number to the callback to be run.
54 std::map<int32_t, PendingResourceIDCallback> pending_create_map_;
55
56 DISALLOW_COPY_AND_ASSIGN(PepperBrowserConnection);
57 };
58
59 } // namespace content
60
61 #endif // CONTENT_RENDERER_PEPPER_PEPPER_BROWSER_CONNECTION_H_
OLDNEW
« 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