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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 // Represents the browser side of the browser <--> plugin communication | 40 // Represents the browser side of the browser <--> plugin communication |
41 // channel. Different plugins run in their own process, but multiple instances | 41 // channel. Different plugins run in their own process, but multiple instances |
42 // 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 |
43 // PluginProcessHost per plugin process, matched with a corresponding | 43 // PluginProcessHost per plugin process, matched with a corresponding |
44 // PluginProcess running in the plugin process. The browser is responsible for | 44 // PluginProcess running in the plugin process. The browser is responsible for |
45 // 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 |
46 // 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 |
47 // the renderer and plugin processes. | 47 // the renderer and plugin processes. |
48 class CONTENT_EXPORT PluginProcessHost | 48 class CONTENT_EXPORT PluginProcessHost |
49 : public content::BrowserChildProcessHostDelegate, | 49 : public content::BrowserChildProcessHostDelegate, |
50 public IPC::Message::Sender { | 50 public IPC::Sender { |
51 public: | 51 public: |
52 class Client { | 52 class Client { |
53 public: | 53 public: |
54 // Returns an opaque unique identifier for the process requesting | 54 // Returns an opaque unique identifier for the process requesting |
55 // the channel. | 55 // the channel. |
56 virtual int ID() = 0; | 56 virtual int ID() = 0; |
57 // Returns the resource context for the renderer requesting the channel. | 57 // Returns the resource context for the renderer requesting the channel. |
58 virtual content::ResourceContext* GetResourceContext() = 0; | 58 virtual content::ResourceContext* GetResourceContext() = 0; |
59 virtual bool OffTheRecord() = 0; | 59 virtual bool OffTheRecord() = 0; |
60 virtual void SetPluginInfo(const webkit::WebPluginInfo& info) = 0; | 60 virtual void SetPluginInfo(const webkit::WebPluginInfo& info) = 0; |
61 virtual void OnFoundPluginProcessHost(PluginProcessHost* host) = 0; | 61 virtual void OnFoundPluginProcessHost(PluginProcessHost* host) = 0; |
62 virtual void OnSentPluginChannelRequest() = 0; | 62 virtual void OnSentPluginChannelRequest() = 0; |
63 // 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. |
64 virtual void OnChannelOpened(const IPC::ChannelHandle& handle) = 0; | 64 virtual void OnChannelOpened(const IPC::ChannelHandle& handle) = 0; |
65 virtual void OnError() = 0; | 65 virtual void OnError() = 0; |
66 | 66 |
67 protected: | 67 protected: |
68 virtual ~Client() {} | 68 virtual ~Client() {} |
69 }; | 69 }; |
70 | 70 |
71 PluginProcessHost(); | 71 PluginProcessHost(); |
72 virtual ~PluginProcessHost(); | 72 virtual ~PluginProcessHost(); |
73 | 73 |
74 // IPC::Message::Sender implementation: | 74 // IPC::Sender implementation: |
75 virtual bool Send(IPC::Message* message) OVERRIDE; | 75 virtual bool Send(IPC::Message* message) OVERRIDE; |
76 | 76 |
77 // Initialize the new plugin process, returning true on success. This must | 77 // Initialize the new plugin process, returning true on success. This must |
78 // be called before the object can be used. | 78 // be called before the object can be used. |
79 bool Init(const webkit::WebPluginInfo& info); | 79 bool Init(const webkit::WebPluginInfo& info); |
80 | 80 |
81 // Force the plugin process to shutdown (cleanly). | 81 // Force the plugin process to shutdown (cleanly). |
82 void ForceShutdown(); | 82 void ForceShutdown(); |
83 | 83 |
84 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 84 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 187 |
188 class PluginProcessHostIterator | 188 class PluginProcessHostIterator |
189 : public content::BrowserChildProcessHostTypeIterator<PluginProcessHost> { | 189 : public content::BrowserChildProcessHostTypeIterator<PluginProcessHost> { |
190 public: | 190 public: |
191 PluginProcessHostIterator() | 191 PluginProcessHostIterator() |
192 : content::BrowserChildProcessHostTypeIterator<PluginProcessHost>( | 192 : content::BrowserChildProcessHostTypeIterator<PluginProcessHost>( |
193 content::PROCESS_TYPE_PLUGIN) {} | 193 content::PROCESS_TYPE_PLUGIN) {} |
194 }; | 194 }; |
195 | 195 |
196 #endif // CONTENT_BROWSER_PLUGIN_PROCESS_HOST_H_ | 196 #endif // CONTENT_BROWSER_PLUGIN_PROCESS_HOST_H_ |
OLD | NEW |