OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/process/process.h" | 15 #include "base/process/process.h" |
16 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
17 #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h" | 17 #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h" |
18 #include "content/browser/renderer_host/pepper/pepper_message_filter.h" | 18 #include "content/browser/renderer_host/pepper/pepper_message_filter.h" |
19 #include "content/public/browser/browser_child_process_host_delegate.h" | 19 #include "content/public/browser/browser_child_process_host_delegate.h" |
20 #include "content/public/browser/browser_child_process_host_iterator.h" | 20 #include "content/public/browser/browser_child_process_host_iterator.h" |
21 #include "ipc/ipc_sender.h" | 21 #include "ipc/ipc_sender.h" |
22 #include "ppapi/shared_impl/ppapi_permissions.h" | 22 #include "ppapi/shared_impl/ppapi_permissions.h" |
23 | 23 |
24 namespace net { | |
25 class HostResolver; | |
26 } | |
27 | |
28 namespace content { | 24 namespace content { |
29 class BrowserChildProcessHostImpl; | 25 class BrowserChildProcessHostImpl; |
30 class ResourceContext; | 26 class ResourceContext; |
31 struct PepperPluginInfo; | 27 struct PepperPluginInfo; |
32 | 28 |
33 // Process host for PPAPI plugin and broker processes. | 29 // Process host for PPAPI plugin and broker processes. |
34 // When used for the broker, interpret all references to "plugin" with "broker". | 30 // When used for the broker, interpret all references to "plugin" with "broker". |
35 class PpapiPluginProcessHost : public BrowserChildProcessHostDelegate, | 31 class PpapiPluginProcessHost : public BrowserChildProcessHostDelegate, |
36 public IPC::Sender { | 32 public IPC::Sender { |
37 public: | 33 public: |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 65 |
70 class BrokerClient : public Client { | 66 class BrokerClient : public Client { |
71 protected: | 67 protected: |
72 virtual ~BrokerClient() {} | 68 virtual ~BrokerClient() {} |
73 }; | 69 }; |
74 | 70 |
75 virtual ~PpapiPluginProcessHost(); | 71 virtual ~PpapiPluginProcessHost(); |
76 | 72 |
77 static PpapiPluginProcessHost* CreatePluginHost( | 73 static PpapiPluginProcessHost* CreatePluginHost( |
78 const PepperPluginInfo& info, | 74 const PepperPluginInfo& info, |
79 const base::FilePath& profile_data_directory, | 75 const base::FilePath& profile_data_directory); |
80 net::HostResolver* host_resolver); | |
81 static PpapiPluginProcessHost* CreateBrokerHost( | 76 static PpapiPluginProcessHost* CreateBrokerHost( |
82 const PepperPluginInfo& info); | 77 const PepperPluginInfo& info); |
83 | 78 |
84 // Notification that a PP_Instance has been created and the associated | 79 // Notification that a PP_Instance has been created and the associated |
85 // renderer related data including the RenderView/Process pair for the given | 80 // renderer related data including the RenderView/Process pair for the given |
86 // plugin. This is necessary so that when the plugin calls us with a | 81 // plugin. This is necessary so that when the plugin calls us with a |
87 // PP_Instance we can find the RenderView associated with it without trusting | 82 // PP_Instance we can find the RenderView associated with it without trusting |
88 // the plugin. | 83 // the plugin. |
89 static void DidCreateOutOfProcessInstance( | 84 static void DidCreateOutOfProcessInstance( |
90 int plugin_process_id, | 85 int plugin_process_id, |
(...skipping 24 matching lines...) Expand all Loading... |
115 } | 110 } |
116 | 111 |
117 // The client pointer must remain valid until its callback is issued. | 112 // The client pointer must remain valid until its callback is issued. |
118 | 113 |
119 private: | 114 private: |
120 class PluginNetworkObserver; | 115 class PluginNetworkObserver; |
121 | 116 |
122 // Constructors for plugin and broker process hosts, respectively. | 117 // Constructors for plugin and broker process hosts, respectively. |
123 // You must call Init before doing anything else. | 118 // You must call Init before doing anything else. |
124 PpapiPluginProcessHost(const PepperPluginInfo& info, | 119 PpapiPluginProcessHost(const PepperPluginInfo& info, |
125 const base::FilePath& profile_data_directory, | 120 const base::FilePath& profile_data_directory); |
126 net::HostResolver* host_resolver); | |
127 PpapiPluginProcessHost(); | 121 PpapiPluginProcessHost(); |
128 | 122 |
129 // Actually launches the process with the given plugin info. Returns true | 123 // Actually launches the process with the given plugin info. Returns true |
130 // on success (the process was spawned). | 124 // on success (the process was spawned). |
131 bool Init(const PepperPluginInfo& info); | 125 bool Init(const PepperPluginInfo& info); |
132 | 126 |
133 void RequestPluginChannel(Client* client); | 127 void RequestPluginChannel(Client* client); |
134 | 128 |
135 virtual void OnProcessLaunched() OVERRIDE; | 129 virtual void OnProcessLaunched() OVERRIDE; |
136 | 130 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 public: | 183 public: |
190 PpapiBrokerProcessHostIterator() | 184 PpapiBrokerProcessHostIterator() |
191 : BrowserChildProcessHostTypeIterator< | 185 : BrowserChildProcessHostTypeIterator< |
192 PpapiPluginProcessHost>(PROCESS_TYPE_PPAPI_BROKER) {} | 186 PpapiPluginProcessHost>(PROCESS_TYPE_PPAPI_BROKER) {} |
193 }; | 187 }; |
194 | 188 |
195 } // namespace content | 189 } // namespace content |
196 | 190 |
197 #endif // CONTENT_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_ | 191 #endif // CONTENT_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_ |
198 | 192 |
OLD | NEW |