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_PLUGIN_PROCESS_HOST_H_ | 5 #ifndef CONTENT_BROWSER_PLUGIN_PROCESS_HOST_H_ |
6 #define CONTENT_BROWSER_PLUGIN_PROCESS_HOST_H_ | 6 #define CONTENT_BROWSER_PLUGIN_PROCESS_HOST_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #include <list> | 10 #include <list> |
11 #include <map> | 11 #include <map> |
12 #include <set> | 12 #include <set> |
13 #include <string> | 13 #include <string> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
17 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 19 #include "base/process/process_handle.h" |
19 #include "content/common/content_export.h" | 20 #include "content/common/content_export.h" |
20 #include "content/public/browser/browser_child_process_host_delegate.h" | 21 #include "content/public/browser/browser_child_process_host_delegate.h" |
21 #include "content/public/browser/browser_child_process_host_iterator.h" | 22 #include "content/public/browser/browser_child_process_host_iterator.h" |
22 #include "content/public/common/process_type.h" | 23 #include "content/public/common/process_type.h" |
23 #include "content/public/common/resource_type.h" | 24 #include "content/public/common/resource_type.h" |
24 #include "content/public/common/webplugininfo.h" | 25 #include "content/public/common/webplugininfo.h" |
25 #include "ipc/ipc_channel_proxy.h" | 26 #include "ipc/ipc_channel_proxy.h" |
26 #include "ui/gfx/native_widget_types.h" | 27 #include "ui/gfx/native_widget_types.h" |
27 | 28 |
28 struct ResourceHostMsg_Request; | 29 struct ResourceHostMsg_Request; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 void OnAppActivation(); | 114 void OnAppActivation(); |
114 #endif | 115 #endif |
115 | 116 |
116 const WebPluginInfo& info() const { return info_; } | 117 const WebPluginInfo& info() const { return info_; } |
117 | 118 |
118 #if defined(OS_WIN) | 119 #if defined(OS_WIN) |
119 // Tracks plugin parent windows created on the browser UI thread. | 120 // Tracks plugin parent windows created on the browser UI thread. |
120 void AddWindow(HWND window); | 121 void AddWindow(HWND window); |
121 #endif | 122 #endif |
122 | 123 |
| 124 // Given a pid of a plugin process, returns the plugin information in |info| |
| 125 // if we know about that process. Otherwise returns false. |
| 126 // This method can be called on any thread. |
| 127 static bool GetWebPluginInfoFromPluginPid(base::ProcessId pid, |
| 128 WebPluginInfo* info); |
| 129 |
123 private: | 130 private: |
124 // Sends a message to the plugin process to request creation of a new channel | 131 // Sends a message to the plugin process to request creation of a new channel |
125 // for the given mime type. | 132 // for the given mime type. |
126 void RequestPluginChannel(Client* client); | 133 void RequestPluginChannel(Client* client); |
127 | 134 |
128 // Message handlers. | 135 // Message handlers. |
129 void OnChannelCreated(const IPC::ChannelHandle& channel_handle); | 136 void OnChannelCreated(const IPC::ChannelHandle& channel_handle); |
130 void OnChannelDestroyed(int renderer_id); | 137 void OnChannelDestroyed(int renderer_id); |
131 | 138 |
132 #if defined(OS_WIN) | 139 #if defined(OS_WIN) |
(...skipping 21 matching lines...) Expand all Loading... |
154 // plugin process once the channel is opened. | 161 // plugin process once the channel is opened. |
155 std::vector<Client*> pending_requests_; | 162 std::vector<Client*> pending_requests_; |
156 | 163 |
157 // These are the channel requests that we have already sent to | 164 // These are the channel requests that we have already sent to |
158 // the plugin process, but haven't heard back about yet. | 165 // the plugin process, but haven't heard back about yet. |
159 std::list<Client*> sent_requests_; | 166 std::list<Client*> sent_requests_; |
160 | 167 |
161 // Information about the plugin. | 168 // Information about the plugin. |
162 WebPluginInfo info_; | 169 WebPluginInfo info_; |
163 | 170 |
| 171 // The pid of the plugin process. |
| 172 int pid_; |
| 173 |
164 #if defined(OS_WIN) | 174 #if defined(OS_WIN) |
165 // Tracks plugin parent windows created on the UI thread. | 175 // Tracks plugin parent windows created on the UI thread. |
166 std::set<HWND> plugin_parent_windows_set_; | 176 std::set<HWND> plugin_parent_windows_set_; |
167 #endif | 177 #endif |
168 #if defined(OS_MACOSX) | 178 #if defined(OS_MACOSX) |
169 // Tracks plugin windows currently visible. | 179 // Tracks plugin windows currently visible. |
170 std::set<uint32> plugin_visible_windows_set_; | 180 std::set<uint32> plugin_visible_windows_set_; |
171 // Tracks full screen windows currently visible. | 181 // Tracks full screen windows currently visible. |
172 std::set<uint32> plugin_fullscreen_windows_set_; | 182 std::set<uint32> plugin_fullscreen_windows_set_; |
173 // Tracks modal windows currently visible. | 183 // Tracks modal windows currently visible. |
(...skipping 22 matching lines...) Expand all Loading... |
196 : public BrowserChildProcessHostTypeIterator<PluginProcessHost> { | 206 : public BrowserChildProcessHostTypeIterator<PluginProcessHost> { |
197 public: | 207 public: |
198 PluginProcessHostIterator() | 208 PluginProcessHostIterator() |
199 : BrowserChildProcessHostTypeIterator<PluginProcessHost>( | 209 : BrowserChildProcessHostTypeIterator<PluginProcessHost>( |
200 PROCESS_TYPE_PLUGIN) {} | 210 PROCESS_TYPE_PLUGIN) {} |
201 }; | 211 }; |
202 | 212 |
203 } // namespace content | 213 } // namespace content |
204 | 214 |
205 #endif // CONTENT_BROWSER_PLUGIN_PROCESS_HOST_H_ | 215 #endif // CONTENT_BROWSER_PLUGIN_PROCESS_HOST_H_ |
OLD | NEW |