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

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

Issue 9150017: Add a Content API around BrowserChildProcessHost, similar to what was done with ChildProcessHost.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix?! Created 8 years, 11 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
« no previous file with comments | « content/browser/gpu/gpu_process_host.cc ('k') | content/browser/plugin_process_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_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 #pragma once 7 #pragma once
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 10
11 #include <list> 11 #include <list>
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/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
18 #include "content/browser/browser_child_process_host.h"
19 #include "content/common/content_export.h" 19 #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_iterator.h"
20 #include "ipc/ipc_channel_proxy.h" 22 #include "ipc/ipc_channel_proxy.h"
21 #include "webkit/plugins/webplugininfo.h" 23 #include "webkit/plugins/webplugininfo.h"
22 #include "ui/gfx/native_widget_types.h" 24 #include "ui/gfx/native_widget_types.h"
23 25
26 class BrowserChildProcessHost;
27
24 namespace content { 28 namespace content {
25 class ResourceContext; 29 class ResourceContext;
26 } 30 }
27 31
28 namespace gfx { 32 namespace gfx {
29 class Rect; 33 class Rect;
30 } 34 }
31 35
32 namespace IPC { 36 namespace IPC {
33 struct ChannelHandle; 37 struct ChannelHandle;
34 } 38 }
35 39
36 // Represents the browser side of the browser <--> plugin communication 40 // Represents the browser side of the browser <--> plugin communication
37 // channel. Different plugins run in their own process, but multiple instances 41 // channel. Different plugins run in their own process, but multiple instances
38 // of the same plugin run in the same process. There will be one 42 // of the same plugin run in the same process. There will be one
39 // PluginProcessHost per plugin process, matched with a corresponding 43 // PluginProcessHost per plugin process, matched with a corresponding
40 // PluginProcess running in the plugin process. The browser is responsible for 44 // PluginProcess running in the plugin process. The browser is responsible for
41 // starting the plugin process when a plugin is created that doesn't already 45 // starting the plugin process when a plugin is created that doesn't already
42 // have a process. After that, most of the communication is directly between 46 // have a process. After that, most of the communication is directly between
43 // the renderer and plugin processes. 47 // the renderer and plugin processes.
44 class CONTENT_EXPORT PluginProcessHost : public BrowserChildProcessHost { 48 class CONTENT_EXPORT PluginProcessHost
49 : public content::BrowserChildProcessHostDelegate,
50 public IPC::Message::Sender {
45 public: 51 public:
46 class Client { 52 class Client {
47 public: 53 public:
48 // Returns an opaque unique identifier for the process requesting 54 // Returns an opaque unique identifier for the process requesting
49 // the channel. 55 // the channel.
50 virtual int ID() = 0; 56 virtual int ID() = 0;
51 // Returns the resource context for the renderer requesting the channel. 57 // Returns the resource context for the renderer requesting the channel.
52 virtual const content::ResourceContext& GetResourceContext() = 0; 58 virtual const content::ResourceContext& GetResourceContext() = 0;
53 virtual bool OffTheRecord() = 0; 59 virtual bool OffTheRecord() = 0;
54 virtual void SetPluginInfo(const webkit::WebPluginInfo& info) = 0; 60 virtual void SetPluginInfo(const webkit::WebPluginInfo& info) = 0;
55 virtual void OnFoundPluginProcessHost(PluginProcessHost* host) = 0; 61 virtual void OnFoundPluginProcessHost(PluginProcessHost* host) = 0;
56 virtual void OnSentPluginChannelRequest() = 0; 62 virtual void OnSentPluginChannelRequest() = 0;
57 // The client should delete itself when one of these methods is called. 63 // The client should delete itself when one of these methods is called.
58 virtual void OnChannelOpened(const IPC::ChannelHandle& handle) = 0; 64 virtual void OnChannelOpened(const IPC::ChannelHandle& handle) = 0;
59 virtual void OnError() = 0; 65 virtual void OnError() = 0;
60 66
61 protected: 67 protected:
62 virtual ~Client() {} 68 virtual ~Client() {}
63 }; 69 };
64 70
65 PluginProcessHost(); 71 PluginProcessHost();
66 virtual ~PluginProcessHost(); 72 virtual ~PluginProcessHost();
67 73
74 // IPC::Message::Sender implementation:
75 virtual bool Send(IPC::Message* message) OVERRIDE;
76
68 // Initialize the new plugin process, returning true on success. This must 77 // Initialize the new plugin process, returning true on success. This must
69 // be called before the object can be used. 78 // be called before the object can be used.
70 bool Init(const webkit::WebPluginInfo& info); 79 bool Init(const webkit::WebPluginInfo& info);
71 80
72 // Force the plugin process to shutdown (cleanly). 81 // Force the plugin process to shutdown (cleanly).
73 void ForceShutdown(); 82 void ForceShutdown();
74 83
75 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; 84 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
76 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; 85 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
77 virtual void OnChannelError() OVERRIDE; 86 virtual void OnChannelError() OVERRIDE;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // Tracks plugin windows currently visible. 171 // Tracks plugin windows currently visible.
163 std::set<uint32> plugin_visible_windows_set_; 172 std::set<uint32> plugin_visible_windows_set_;
164 // Tracks full screen windows currently visible. 173 // Tracks full screen windows currently visible.
165 std::set<uint32> plugin_fullscreen_windows_set_; 174 std::set<uint32> plugin_fullscreen_windows_set_;
166 // Tracks modal windows currently visible. 175 // Tracks modal windows currently visible.
167 std::set<uint32> plugin_modal_windows_set_; 176 std::set<uint32> plugin_modal_windows_set_;
168 // Tracks the current visibility of the cursor. 177 // Tracks the current visibility of the cursor.
169 bool plugin_cursor_visible_; 178 bool plugin_cursor_visible_;
170 #endif 179 #endif
171 180
181 scoped_ptr<BrowserChildProcessHost> process_;
182
172 DISALLOW_COPY_AND_ASSIGN(PluginProcessHost); 183 DISALLOW_COPY_AND_ASSIGN(PluginProcessHost);
173 }; 184 };
174 185
186 class PluginProcessHostIterator
187 : public content::BrowserChildProcessHostTypeIterator<PluginProcessHost> {
188 public:
189 PluginProcessHostIterator()
190 : content::BrowserChildProcessHostTypeIterator<PluginProcessHost>(
191 content::PROCESS_TYPE_PLUGIN) {}
192 };
193
175 #endif // CONTENT_BROWSER_PLUGIN_PROCESS_HOST_H_ 194 #endif // CONTENT_BROWSER_PLUGIN_PROCESS_HOST_H_
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host.cc ('k') | content/browser/plugin_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698