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

Side by Side Diff: chrome/browser/plugin_process_host.h

Issue 14142: Start using the proxy resolve IPC for plugins.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 CHROME_BROWSER_PLUGIN_PROCESS_HOST_H_ 5 #ifndef CHROME_BROWSER_PLUGIN_PROCESS_HOST_H_
6 #define CHROME_BROWSER_PLUGIN_PROCESS_HOST_H_ 6 #define CHROME_BROWSER_PLUGIN_PROCESS_HOST_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/id_map.h" 11 #include "base/id_map.h"
12 #include "base/object_watcher.h" 12 #include "base/object_watcher.h"
13 #include "base/process.h" 13 #include "base/process.h"
14 #include "base/scoped_ptr.h" 14 #include "base/scoped_ptr.h"
15 #include "base/task.h" 15 #include "base/task.h"
16 #include "chrome/browser/resource_message_filter.h" 16 #include "chrome/browser/resource_message_filter.h"
17 #include "chrome/common/ipc_channel_proxy.h" 17 #include "chrome/common/ipc_channel_proxy.h"
18 #include "chrome/browser/net/resolve_proxy_msg_helper.h"
18 #include "chrome/browser/resource_message_filter.h" 19 #include "chrome/browser/resource_message_filter.h"
19 20
20 class PluginService; 21 class PluginService;
21 class PluginProcessHost; 22 class PluginProcessHost;
22 class ResourceDispatcherHost; 23 class ResourceDispatcherHost;
23 class URLRequestContext; 24 class URLRequestContext;
24 struct ViewHostMsg_Resource_Request; 25 struct ViewHostMsg_Resource_Request;
25 class GURL; 26 class GURL;
26 27
27 // Represents the browser side of the browser <--> plugin communication 28 // Represents the browser side of the browser <--> plugin communication
28 // channel. Different plugins run in their own process, but multiple instances 29 // channel. Different plugins run in their own process, but multiple instances
29 // of the same plugin run in the same process. There will be one 30 // of the same plugin run in the same process. There will be one
30 // PluginProcessHost per plugin process, matched with a corresponding 31 // PluginProcessHost per plugin process, matched with a corresponding
31 // PluginProcess running in the plugin process. The browser is responsible for 32 // PluginProcess running in the plugin process. The browser is responsible for
32 // starting the plugin process when a plugin is created that doesn't already 33 // starting the plugin process when a plugin is created that doesn't already
33 // have a process. After that, most of the communication is directly between 34 // have a process. After that, most of the communication is directly between
34 // the renderer and plugin processes. 35 // the renderer and plugin processes.
35 class PluginProcessHost : public IPC::Channel::Listener, 36 class PluginProcessHost : public IPC::Channel::Listener,
36 public IPC::Message::Sender, 37 public IPC::Message::Sender,
37 public base::ObjectWatcher::Delegate { 38 public base::ObjectWatcher::Delegate,
39 public ResolveProxyMsgHelper::Delegate {
38 public: 40 public:
39 PluginProcessHost(PluginService* plugin_service); 41 PluginProcessHost(PluginService* plugin_service);
40 ~PluginProcessHost(); 42 ~PluginProcessHost();
41 43
42 // Initialize the new plugin process, returning true on success. This must 44 // Initialize the new plugin process, returning true on success. This must
43 // be called before the object can be used. If plugin_path is the 45 // be called before the object can be used. If plugin_path is the
44 // ActiveX-shim, then activex_clsid is the class id of ActiveX control, 46 // ActiveX-shim, then activex_clsid is the class id of ActiveX control,
45 // otherwise activex_clsid is ignored. 47 // otherwise activex_clsid is ignored.
46 bool Init(const FilePath& plugin_path, 48 bool Init(const FilePath& plugin_path,
47 const std::string& activex_clsid, 49 const std::string& activex_clsid,
48 const std::wstring& locale); 50 const std::wstring& locale);
49 51
50 // IPC::Message::Sender implementation: 52 // IPC::Message::Sender implementation:
51 virtual bool Send(IPC::Message* msg); 53 virtual bool Send(IPC::Message* msg);
52 54
53 // ObjectWatcher::Delegate implementation: 55 // ObjectWatcher::Delegate implementation:
54 virtual void OnObjectSignaled(HANDLE object); 56 virtual void OnObjectSignaled(HANDLE object);
55 57
56 // IPC::Channel::Listener implementation: 58 // IPC::Channel::Listener implementation:
57 virtual void OnMessageReceived(const IPC::Message& msg); 59 virtual void OnMessageReceived(const IPC::Message& msg);
58 virtual void OnChannelConnected(int32 peer_pid); 60 virtual void OnChannelConnected(int32 peer_pid);
59 virtual void OnChannelError(); 61 virtual void OnChannelError();
60 62
63 // ResolveProxyMsgHelper::Delegate implementation:
64 virtual void OnResolveProxyCompleted(IPC::Message* reply_msg,
65 int result,
66 const std::string& proxy_list);
67
61 // Getter to the process, may return NULL if there is no connection. 68 // Getter to the process, may return NULL if there is no connection.
62 HANDLE process() { return process_.handle(); } 69 HANDLE process() { return process_.handle(); }
63 70
64 // Tells the plugin process to create a new channel for communication with a 71 // Tells the plugin process to create a new channel for communication with a
65 // renderer. When the plugin process responds with the channel name, 72 // renderer. When the plugin process responds with the channel name,
66 // reply_msg is used to send the name to the renderer. 73 // reply_msg is used to send the name to the renderer.
67 void OpenChannelToPlugin(ResourceMessageFilter* renderer_message_filter, 74 void OpenChannelToPlugin(ResourceMessageFilter* renderer_message_filter,
68 const std::string& mime_type, 75 const std::string& mime_type,
69 IPC::Message* reply_msg); 76 IPC::Message* reply_msg);
70 77
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // IPC Channel's id. 157 // IPC Channel's id.
151 std::wstring channel_id_; 158 std::wstring channel_id_;
152 159
153 // Path to the file of that plugin. 160 // Path to the file of that plugin.
154 FilePath plugin_path_; 161 FilePath plugin_path_;
155 162
156 PluginService* plugin_service_; 163 PluginService* plugin_service_;
157 164
158 ResourceDispatcherHost* resource_dispatcher_host_; 165 ResourceDispatcherHost* resource_dispatcher_host_;
159 166
160 // This RevocableStore prevents ResolveProxy completion callbacks from 167 // Helper class for handling PluginHost_ResolveProxy messages (manages the
161 // accessing a deleted PluginProcessHost (since we do not cancel the 168 // requests to the proxy service).
162 // in-progress resolve requests during destruction). 169 ResolveProxyMsgHelper resolve_proxy_msg_helper_;
163 RevocableStore revocable_store_;
164 170
165 DISALLOW_EVIL_CONSTRUCTORS(PluginProcessHost); 171 DISALLOW_EVIL_CONSTRUCTORS(PluginProcessHost);
166 }; 172 };
167 173
168 #endif // CHROME_BROWSER_PLUGIN_PROCESS_HOST_H_ 174 #endif // CHROME_BROWSER_PLUGIN_PROCESS_HOST_H_
169 175
OLDNEW
« no previous file with comments | « chrome/browser/net/resolve_proxy_msg_helper_unittest.cc ('k') | chrome/browser/plugin_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698