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; | 18 struct PepperPluginInfo; |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 class ResourceContext; | 21 class ResourceContext; |
22 } | 22 } |
23 | 23 |
24 namespace net { | 24 namespace net { |
25 class HostResolver; | 25 class HostResolver; |
26 } | 26 } |
27 | 27 |
28 class PpapiPluginProcessHost | 28 class PpapiPluginProcessHost |
29 : public BrowserChildProcessHost, | 29 : public BrowserChildProcessHost, |
| 30 public net::NetworkChangeNotifier::IPAddressObserver, |
30 public net::NetworkChangeNotifier::OnlineStateObserver { | 31 public net::NetworkChangeNotifier::OnlineStateObserver { |
31 public: | 32 public: |
32 class Client { | 33 class Client { |
33 public: | 34 public: |
34 // Gets the information about the renderer that's requesting the channel. | 35 // Gets the information about the renderer that's requesting the channel. |
35 virtual void GetChannelInfo(base::ProcessHandle* renderer_handle, | 36 virtual void GetChannelInfo(base::ProcessHandle* renderer_handle, |
36 int* renderer_id) = 0; | 37 int* renderer_id) = 0; |
37 | 38 |
38 // Called when the channel is asynchronously opened to the plugin or on | 39 // Called when the channel is asynchronously opened to the plugin or on |
39 // error. On error, the parameters should be: | 40 // error. On error, the parameters should be: |
(...skipping 27 matching lines...) Expand all Loading... |
67 | 68 |
68 virtual bool CanShutdown(); | 69 virtual bool CanShutdown(); |
69 virtual void OnProcessLaunched(); | 70 virtual void OnProcessLaunched(); |
70 | 71 |
71 virtual bool OnMessageReceived(const IPC::Message& msg); | 72 virtual bool OnMessageReceived(const IPC::Message& msg); |
72 virtual void OnChannelConnected(int32 peer_pid); | 73 virtual void OnChannelConnected(int32 peer_pid); |
73 virtual void OnChannelError(); | 74 virtual void OnChannelError(); |
74 | 75 |
75 void CancelRequests(); | 76 void CancelRequests(); |
76 | 77 |
| 78 // IPAddressObserver implementation. |
| 79 virtual void OnIPAddressChanged() OVERRIDE; |
| 80 |
77 // OnlineStateObserver implementation. | 81 // OnlineStateObserver implementation. |
78 virtual void OnOnlineStateChanged(bool online); | 82 virtual void OnOnlineStateChanged(bool online) OVERRIDE; |
79 | 83 |
80 // IPC message handlers. | 84 // IPC message handlers. |
81 void OnRendererPluginChannelCreated(const IPC::ChannelHandle& handle); | 85 void OnRendererPluginChannelCreated(const IPC::ChannelHandle& handle); |
82 | 86 |
83 // Handles most requests from the plugin. | 87 // Handles most requests from the plugin. |
84 scoped_refptr<PepperMessageFilter> filter_; | 88 scoped_refptr<PepperMessageFilter> filter_; |
85 | 89 |
86 // Channel requests that we are waiting to send to the plugin process once | 90 // Channel requests that we are waiting to send to the plugin process once |
87 // the channel is opened. | 91 // the channel is opened. |
88 std::vector<Client*> pending_requests_; | 92 std::vector<Client*> pending_requests_; |
89 | 93 |
90 // Channel requests that we have already sent to the plugin process, but | 94 // Channel requests that we have already sent to the plugin process, but |
91 // haven't heard back about yet. | 95 // haven't heard back about yet. |
92 std::queue<Client*> sent_requests_; | 96 std::queue<Client*> sent_requests_; |
93 | 97 |
94 // Path to the plugin library. | 98 // Path to the plugin library. |
95 FilePath plugin_path_; | 99 FilePath plugin_path_; |
96 | 100 |
97 DISALLOW_COPY_AND_ASSIGN(PpapiPluginProcessHost); | 101 DISALLOW_COPY_AND_ASSIGN(PpapiPluginProcessHost); |
98 }; | 102 }; |
99 | 103 |
100 #endif // CONTENT_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_ | 104 #endif // CONTENT_BROWSER_PPAPI_PLUGIN_PROCESS_HOST_H_ |
101 | 105 |
OLD | NEW |