summaryrefslogtreecommitdiffstats
path: root/content/browser/ppapi_plugin_process_host.h
diff options
context:
space:
mode:
authorddorwin@chromium.org <ddorwin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-30 16:32:14 +0000
committerddorwin@chromium.org <ddorwin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-30 16:32:14 +0000
commita50432d222a0e826fbd190586a6ce1c526ff95ca (patch)
tree0f3c29afec42f8b5e45d7830c4934248b640dd05 /content/browser/ppapi_plugin_process_host.h
parent3b0a9b06b129a1804e16720f768a79d45a9d3a41 (diff)
downloadchromium_src-a50432d222a0e826fbd190586a6ce1c526ff95ca.zip
chromium_src-a50432d222a0e826fbd190586a6ce1c526ff95ca.tar.gz
chromium_src-a50432d222a0e826fbd190586a6ce1c526ff95ca.tar.bz2
Combine PpapiBrokerProcessHost into PpapiPluginProcessHost.
The broker does not need the network observer, so I factored that out. Since the constructors for the broker and plugin are different, I made them private and added factories that also call Init(), which must be called before the object can be used. BUG=none TEST=none Review URL: http://codereview.chromium.org/7979028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103472 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/ppapi_plugin_process_host.h')
-rw-r--r--content/browser/ppapi_plugin_process_host.h47
1 files changed, 31 insertions, 16 deletions
diff --git a/content/browser/ppapi_plugin_process_host.h b/content/browser/ppapi_plugin_process_host.h
index 4405aff7..f31f10e 100644
--- a/content/browser/ppapi_plugin_process_host.h
+++ b/content/browser/ppapi_plugin_process_host.h
@@ -10,10 +10,10 @@
#include "base/basictypes.h"
#include "base/file_path.h"
+#include "base/memory/scoped_ptr.h"
#include "base/memory/ref_counted.h"
#include "content/browser/browser_child_process_host.h"
#include "content/browser/renderer_host/pepper_message_filter.h"
-#include "net/base/network_change_notifier.h"
struct PepperPluginInfo;
@@ -25,10 +25,10 @@ namespace net {
class HostResolver;
}
+// Process host for PPAPI plugin and broker processes.
+// When used for the broker, interpret all references to "plugin" with "broker".
class PpapiPluginProcessHost
- : public BrowserChildProcessHost,
- public net::NetworkChangeNotifier::IPAddressObserver,
- public net::NetworkChangeNotifier::OnlineStateObserver {
+ : public BrowserChildProcessHost {
public:
class Client {
public:
@@ -42,18 +42,23 @@ class PpapiPluginProcessHost
// IPC::ChannelHandle()
virtual void OnChannelOpened(base::ProcessHandle plugin_process_handle,
const IPC::ChannelHandle& channel_handle) = 0;
+ };
+ class PluginClient : public Client {
+ public:
// Returns the resource context for the renderer requesting the channel.
virtual const content::ResourceContext* GetResourceContext() = 0;
};
- // You must call Init before doing anything else.
- PpapiPluginProcessHost(net::HostResolver* host_resolver);
+ class BrokerClient : public Client {
+ };
+
virtual ~PpapiPluginProcessHost();
- // Actually launches the process with the given plugin info. Returns true
- // on success (the process was spawned).
- bool Init(const PepperPluginInfo& info);
+ static PpapiPluginProcessHost* CreatePluginHost(
+ const PepperPluginInfo& info,
+ net::HostResolver* host_resolver);
+ static PpapiPluginProcessHost* CreateBrokerHost(const PepperPluginInfo& info);
// Opens a new channel to the plugin. The client will be notified when the
// channel is ready or if there's an error.
@@ -64,6 +69,17 @@ class PpapiPluginProcessHost
// The client pointer must remain valid until its callback is issued.
private:
+ class PluginNetworkObserver;
+
+ // Constructors for plugin and broker process hosts, respectively.
+ // You must call Init before doing anything else.
+ PpapiPluginProcessHost(net::HostResolver* host_resolver);
+ PpapiPluginProcessHost();
+
+ // Actually launches the process with the given plugin info. Returns true
+ // on success (the process was spawned).
+ bool Init(const PepperPluginInfo& info);
+
void RequestPluginChannel(Client* client);
virtual bool CanShutdown();
@@ -75,18 +91,15 @@ class PpapiPluginProcessHost
void CancelRequests();
- // IPAddressObserver implementation.
- virtual void OnIPAddressChanged() OVERRIDE;
-
- // OnlineStateObserver implementation.
- virtual void OnOnlineStateChanged(bool online) OVERRIDE;
-
// IPC message handlers.
void OnRendererPluginChannelCreated(const IPC::ChannelHandle& handle);
- // Handles most requests from the plugin.
+ // Handles most requests from the plugin. May be NULL.
scoped_refptr<PepperMessageFilter> filter_;
+ // Observes network changes. May be NULL.
+ scoped_ptr<PluginNetworkObserver> network_observer_;
+
// Channel requests that we are waiting to send to the plugin process once
// the channel is opened.
std::vector<Client*> pending_requests_;
@@ -98,6 +111,8 @@ class PpapiPluginProcessHost
// Path to the plugin library.
FilePath plugin_path_;
+ const bool is_broker_;
+
DISALLOW_COPY_AND_ASSIGN(PpapiPluginProcessHost);
};