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

Side by Side Diff: content/browser/ppapi_plugin_process_host.h

Issue 9150017: Add a Content API around BrowserChildProcessHost, similar to what was done with ChildProcessHost.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix?! Created 8 years, 11 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
« no previous file with comments | « content/browser/plugin_service_impl.cc ('k') | content/browser/ppapi_plugin_process_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_ 5 #ifndef CONTENT_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_
6 #define CONTENT_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_ 6 #define CONTENT_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <queue> 9 #include <queue>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "content/browser/browser_child_process_host.h"
16 #include "content/browser/renderer_host/pepper_message_filter.h" 15 #include "content/browser/renderer_host/pepper_message_filter.h"
16 #include "content/public/browser/browser_child_process_host_delegate.h"
17 #include "content/public/browser/browser_child_process_host_iterator.h"
18 #include "ipc/ipc_message.h"
19
20 class BrowserChildProcessHost;
17 21
18 namespace content { 22 namespace content {
19 struct PepperPluginInfo; 23 struct PepperPluginInfo;
20 class ResourceContext; 24 class ResourceContext;
21 } 25 }
22 26
23 namespace net { 27 namespace net {
24 class HostResolver; 28 class HostResolver;
25 } 29 }
26 30
27 // Process host for PPAPI plugin and broker processes. 31 // Process host for PPAPI plugin and broker processes.
28 // When used for the broker, interpret all references to "plugin" with "broker". 32 // When used for the broker, interpret all references to "plugin" with "broker".
29 class PpapiPluginProcessHost 33 class PpapiPluginProcessHost : public content::BrowserChildProcessHostDelegate,
30 : public BrowserChildProcessHost { 34 public IPC::Message::Sender {
31 public: 35 public:
32 class Client { 36 class Client {
33 public: 37 public:
34 // Gets the information about the renderer that's requesting the channel. 38 // Gets the information about the renderer that's requesting the channel.
35 virtual void GetChannelInfo(base::ProcessHandle* renderer_handle, 39 virtual void GetChannelInfo(base::ProcessHandle* renderer_handle,
36 int* renderer_id) = 0; 40 int* renderer_id) = 0;
37 41
38 // Called when the channel is asynchronously opened to the plugin or on 42 // Called when the channel is asynchronously opened to the plugin or on
39 // error. On error, the parameters should be: 43 // error. On error, the parameters should be:
40 // base::kNullProcessHandle 44 // base::kNullProcessHandle
(...skipping 12 matching lines...) Expand all
53 }; 57 };
54 58
55 virtual ~PpapiPluginProcessHost(); 59 virtual ~PpapiPluginProcessHost();
56 60
57 static PpapiPluginProcessHost* CreatePluginHost( 61 static PpapiPluginProcessHost* CreatePluginHost(
58 const content::PepperPluginInfo& info, 62 const content::PepperPluginInfo& info,
59 net::HostResolver* host_resolver); 63 net::HostResolver* host_resolver);
60 static PpapiPluginProcessHost* CreateBrokerHost( 64 static PpapiPluginProcessHost* CreateBrokerHost(
61 const content::PepperPluginInfo& info); 65 const content::PepperPluginInfo& info);
62 66
67 // IPC::Message::Sender implementation:
68 virtual bool Send(IPC::Message* message) OVERRIDE;
69
63 // Opens a new channel to the plugin. The client will be notified when the 70 // Opens a new channel to the plugin. The client will be notified when the
64 // channel is ready or if there's an error. 71 // channel is ready or if there's an error.
65 void OpenChannelToPlugin(Client* client); 72 void OpenChannelToPlugin(Client* client);
66 73
67 const FilePath& plugin_path() const { return plugin_path_; } 74 const FilePath& plugin_path() const { return plugin_path_; }
68 75
69 // The client pointer must remain valid until its callback is issued. 76 // The client pointer must remain valid until its callback is issued.
70 77
71 private: 78 private:
72 class PluginNetworkObserver; 79 class PluginNetworkObserver;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 std::queue<Client*> sent_requests_; 115 std::queue<Client*> sent_requests_;
109 116
110 // Path to the plugin library. 117 // Path to the plugin library.
111 FilePath plugin_path_; 118 FilePath plugin_path_;
112 119
113 const bool is_broker_; 120 const bool is_broker_;
114 121
115 // The unique id created for the process. 122 // The unique id created for the process.
116 int process_id_; 123 int process_id_;
117 124
125 scoped_ptr<BrowserChildProcessHost> process_;
126
118 DISALLOW_COPY_AND_ASSIGN(PpapiPluginProcessHost); 127 DISALLOW_COPY_AND_ASSIGN(PpapiPluginProcessHost);
119 }; 128 };
120 129
130 class PpapiPluginProcessHostIterator
131 : public content::BrowserChildProcessHostTypeIterator<
132 PpapiPluginProcessHost> {
133 public:
134 PpapiPluginProcessHostIterator()
135 : content::BrowserChildProcessHostTypeIterator<
136 PpapiPluginProcessHost>(content::PROCESS_TYPE_PPAPI_PLUGIN) {}
137 };
138
139 class PpapiBrokerProcessHostIterator
140 : public content::BrowserChildProcessHostTypeIterator<
141 PpapiPluginProcessHost> {
142 public:
143 PpapiBrokerProcessHostIterator()
144 : content::BrowserChildProcessHostTypeIterator<
145 PpapiPluginProcessHost>(content::PROCESS_TYPE_PPAPI_BROKER) {}
146 };
147
121 #endif // CONTENT_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_ 148 #endif // CONTENT_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_
122 149
OLDNEW
« no previous file with comments | « content/browser/plugin_service_impl.cc ('k') | content/browser/ppapi_plugin_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698