OLD | NEW |
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/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "content/browser/browser_child_process_host.h" | 14 #include "content/browser/browser_child_process_host.h" |
15 #include "content/browser/renderer_host/pepper_message_filter.h" | 15 #include "content/browser/renderer_host/pepper_message_filter.h" |
16 #include "net/base/network_change_notifier.h" | 16 #include "net/base/network_change_notifier.h" |
17 | 17 |
18 struct PepperPluginInfo; | |
19 | |
20 namespace content { | 18 namespace content { |
21 class ResourceContext; | 19 class ResourceContext; |
22 } | 20 } |
23 | 21 |
24 namespace net { | 22 namespace net { |
25 class HostResolver; | 23 class HostResolver; |
26 } | 24 } |
27 | 25 |
| 26 namespace webkit { |
| 27 namespace ppapi { |
| 28 struct PluginInfo; |
| 29 } |
| 30 } |
| 31 |
28 class PpapiPluginProcessHost | 32 class PpapiPluginProcessHost |
29 : public BrowserChildProcessHost, | 33 : public BrowserChildProcessHost, |
30 public net::NetworkChangeNotifier::IPAddressObserver, | 34 public net::NetworkChangeNotifier::IPAddressObserver, |
31 public net::NetworkChangeNotifier::OnlineStateObserver { | 35 public net::NetworkChangeNotifier::OnlineStateObserver { |
32 public: | 36 public: |
33 class Client { | 37 class Client { |
34 public: | 38 public: |
35 // Gets the information about the renderer that's requesting the channel. | 39 // Gets the information about the renderer that's requesting the channel. |
36 virtual void GetChannelInfo(base::ProcessHandle* renderer_handle, | 40 virtual void GetChannelInfo(base::ProcessHandle* renderer_handle, |
37 int* renderer_id) = 0; | 41 int* renderer_id) = 0; |
38 | 42 |
39 // Called when the channel is asynchronously opened to the plugin or on | 43 // Called when the channel is asynchronously opened to the plugin or on |
40 // error. On error, the parameters should be: | 44 // error. On error, the parameters should be: |
41 // base::kNullProcessHandle | 45 // base::kNullProcessHandle |
42 // IPC::ChannelHandle() | 46 // IPC::ChannelHandle() |
43 virtual void OnChannelOpened(base::ProcessHandle plugin_process_handle, | 47 virtual void OnChannelOpened(base::ProcessHandle plugin_process_handle, |
44 const IPC::ChannelHandle& channel_handle) = 0; | 48 const IPC::ChannelHandle& channel_handle) = 0; |
45 | 49 |
46 // Returns the resource context for the renderer requesting the channel. | 50 // Returns the resource context for the renderer requesting the channel. |
47 virtual const content::ResourceContext* GetResourceContext() = 0; | 51 virtual const content::ResourceContext* GetResourceContext() = 0; |
48 }; | 52 }; |
49 | 53 |
50 // You must call Init before doing anything else. | 54 // You must call Init before doing anything else. |
51 PpapiPluginProcessHost(net::HostResolver* host_resolver); | 55 PpapiPluginProcessHost(net::HostResolver* host_resolver); |
52 virtual ~PpapiPluginProcessHost(); | 56 virtual ~PpapiPluginProcessHost(); |
53 | 57 |
54 // Actually launches the process with the given plugin info. Returns true | 58 // Actually launches the process with the given plugin info. Returns true |
55 // on success (the process was spawned). | 59 // on success (the process was spawned). |
56 bool Init(const PepperPluginInfo& info); | 60 bool Init(const webkit::ppapi::PluginInfo& info); |
57 | 61 |
58 // Opens a new channel to the plugin. The client will be notified when the | 62 // Opens a new channel to the plugin. The client will be notified when the |
59 // channel is ready or if there's an error. | 63 // channel is ready or if there's an error. |
60 void OpenChannelToPlugin(Client* client); | 64 void OpenChannelToPlugin(Client* client); |
61 | 65 |
62 const FilePath& plugin_path() const { return plugin_path_; } | 66 const FilePath& plugin_path() const { return plugin_path_; } |
63 | 67 |
64 // The client pointer must remain valid until its callback is issued. | 68 // The client pointer must remain valid until its callback is issued. |
65 | 69 |
66 private: | 70 private: |
(...skipping 29 matching lines...) Expand all Loading... |
96 std::queue<Client*> sent_requests_; | 100 std::queue<Client*> sent_requests_; |
97 | 101 |
98 // Path to the plugin library. | 102 // Path to the plugin library. |
99 FilePath plugin_path_; | 103 FilePath plugin_path_; |
100 | 104 |
101 DISALLOW_COPY_AND_ASSIGN(PpapiPluginProcessHost); | 105 DISALLOW_COPY_AND_ASSIGN(PpapiPluginProcessHost); |
102 }; | 106 }; |
103 | 107 |
104 #endif // CONTENT_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_ | 108 #endif // CONTENT_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_ |
105 | 109 |
OLD | NEW |