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

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 RenderView;
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 : public RenderViewObserver {
23 public:
24 typedef base::Callback<void(int)> PendingResourceIDCallback;
25
26 explicit PepperBrowserConnection(RenderView* render_view);
27 virtual ~PepperBrowserConnection();
28
29 // RenderViewObserver overrides.
30 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
31
32 // Sends a request to the browser to create a ResourceHost for the given
33 // |instance| of a plugin identified by |child_process_id|. |callback| will be
34 // run when a reply is received with the pending resource ID.
35 void SendBrowserCreate(PP_Instance instance,
36 int child_process_id,
37 const IPC::Message& create_message,
38 PendingResourceIDCallback callback);
yzshen1 2013/05/29 17:57:21 const &?
raymes 2013/06/04 04:11:11 Done.
39
40 private:
41 // Message handlers.
42 void OnMsgCreateResourceHostFromHostReply(int32_t sequence_number,
43 int pending_resource_host_id);
44
45 // Return the next sequence number.
46 int32_t GetNextSequence();
47
48 // Sequence number to track pending callbacks.
49 int32_t next_sequence_number_;
50
51 // Maps a sequence number to the callback to be run.
52 std::map<int32_t, PendingResourceIDCallback> pending_create_map_;
53
54 DISALLOW_COPY_AND_ASSIGN(PepperBrowserConnection);
55 };
56
57 } // namespace content
58
59 #endif // CONTENT_RENDERER_PEPPER_PEPPER_BROWSER_CONNECTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698