| 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 <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
| 16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
| 19 #include "content/public/browser/browser_child_process_host_delegate.h" | 19 #include "content/public/browser/browser_child_process_host_delegate.h" |
| 20 #include "content/public/browser/browser_child_process_host_iterator.h" | 20 #include "content/public/browser/browser_child_process_host_iterator.h" |
| 21 #include "content/public/common/process_type.h" | 21 #include "content/public/common/process_type.h" |
| 22 #include "content/public/common/webplugininfo.h" |
| 22 #include "ipc/ipc_channel_proxy.h" | 23 #include "ipc/ipc_channel_proxy.h" |
| 23 #include "webkit/plugins/webplugininfo.h" | |
| 24 #include "ui/gfx/native_widget_types.h" | 24 #include "ui/gfx/native_widget_types.h" |
| 25 | 25 |
| 26 namespace gfx { | 26 namespace gfx { |
| 27 class Rect; | 27 class Rect; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace IPC { | 30 namespace IPC { |
| 31 struct ChannelHandle; | 31 struct ChannelHandle; |
| 32 } | 32 } |
| 33 | 33 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 47 public IPC::Sender { | 47 public IPC::Sender { |
| 48 public: | 48 public: |
| 49 class Client { | 49 class Client { |
| 50 public: | 50 public: |
| 51 // Returns an opaque unique identifier for the process requesting | 51 // Returns an opaque unique identifier for the process requesting |
| 52 // the channel. | 52 // the channel. |
| 53 virtual int ID() = 0; | 53 virtual int ID() = 0; |
| 54 // Returns the resource context for the renderer requesting the channel. | 54 // Returns the resource context for the renderer requesting the channel. |
| 55 virtual ResourceContext* GetResourceContext() = 0; | 55 virtual ResourceContext* GetResourceContext() = 0; |
| 56 virtual bool OffTheRecord() = 0; | 56 virtual bool OffTheRecord() = 0; |
| 57 virtual void SetPluginInfo(const webkit::WebPluginInfo& info) = 0; | 57 virtual void SetPluginInfo(const WebPluginInfo& info) = 0; |
| 58 virtual void OnFoundPluginProcessHost(PluginProcessHost* host) = 0; | 58 virtual void OnFoundPluginProcessHost(PluginProcessHost* host) = 0; |
| 59 virtual void OnSentPluginChannelRequest() = 0; | 59 virtual void OnSentPluginChannelRequest() = 0; |
| 60 // The client should delete itself when one of these methods is called. | 60 // The client should delete itself when one of these methods is called. |
| 61 virtual void OnChannelOpened(const IPC::ChannelHandle& handle) = 0; | 61 virtual void OnChannelOpened(const IPC::ChannelHandle& handle) = 0; |
| 62 virtual void OnError() = 0; | 62 virtual void OnError() = 0; |
| 63 | 63 |
| 64 protected: | 64 protected: |
| 65 virtual ~Client() {} | 65 virtual ~Client() {} |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 PluginProcessHost(); | 68 PluginProcessHost(); |
| 69 virtual ~PluginProcessHost(); | 69 virtual ~PluginProcessHost(); |
| 70 | 70 |
| 71 // IPC::Sender implementation: | 71 // IPC::Sender implementation: |
| 72 virtual bool Send(IPC::Message* message) OVERRIDE; | 72 virtual bool Send(IPC::Message* message) OVERRIDE; |
| 73 | 73 |
| 74 // Initialize the new plugin process, returning true on success. This must | 74 // Initialize the new plugin process, returning true on success. This must |
| 75 // be called before the object can be used. | 75 // be called before the object can be used. |
| 76 bool Init(const webkit::WebPluginInfo& info); | 76 bool Init(const WebPluginInfo& info); |
| 77 | 77 |
| 78 // Force the plugin process to shutdown (cleanly). | 78 // Force the plugin process to shutdown (cleanly). |
| 79 void ForceShutdown(); | 79 void ForceShutdown(); |
| 80 | 80 |
| 81 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 81 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
| 82 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 82 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
| 83 virtual void OnChannelError() OVERRIDE; | 83 virtual void OnChannelError() OVERRIDE; |
| 84 | 84 |
| 85 // Tells the plugin process to create a new channel for communication with a | 85 // Tells the plugin process to create a new channel for communication with a |
| 86 // renderer. When the plugin process responds with the channel name, | 86 // renderer. When the plugin process responds with the channel name, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 101 // that reply back to the plugin that requested the dialog. | 101 // that reply back to the plugin that requested the dialog. |
| 102 void OnModalDialogResponse(const std::string& json_retval, | 102 void OnModalDialogResponse(const std::string& json_retval, |
| 103 IPC::Message* sync_result); | 103 IPC::Message* sync_result); |
| 104 | 104 |
| 105 #if defined(OS_MACOSX) | 105 #if defined(OS_MACOSX) |
| 106 // This function is called on the IO thread when the browser becomes the | 106 // This function is called on the IO thread when the browser becomes the |
| 107 // active application. | 107 // active application. |
| 108 void OnAppActivation(); | 108 void OnAppActivation(); |
| 109 #endif | 109 #endif |
| 110 | 110 |
| 111 const webkit::WebPluginInfo& info() const { return info_; } | 111 const WebPluginInfo& info() const { return info_; } |
| 112 | 112 |
| 113 #if defined(OS_WIN) | 113 #if defined(OS_WIN) |
| 114 // Tracks plugin parent windows created on the browser UI thread. | 114 // Tracks plugin parent windows created on the browser UI thread. |
| 115 void AddWindow(HWND window); | 115 void AddWindow(HWND window); |
| 116 #endif | 116 #endif |
| 117 | 117 |
| 118 // Adds an IPC message filter. A reference will be kept to the filter. | 118 // Adds an IPC message filter. A reference will be kept to the filter. |
| 119 void AddFilter(IPC::ChannelProxy::MessageFilter* filter); | 119 void AddFilter(IPC::ChannelProxy::MessageFilter* filter); |
| 120 | 120 |
| 121 private: | 121 private: |
| (...skipping 28 matching lines...) Expand all Loading... |
| 150 | 150 |
| 151 // These are channel requests that we are waiting to send to the | 151 // These are channel requests that we are waiting to send to the |
| 152 // plugin process once the channel is opened. | 152 // plugin process once the channel is opened. |
| 153 std::vector<Client*> pending_requests_; | 153 std::vector<Client*> pending_requests_; |
| 154 | 154 |
| 155 // These are the channel requests that we have already sent to | 155 // These are the channel requests that we have already sent to |
| 156 // the plugin process, but haven't heard back about yet. | 156 // the plugin process, but haven't heard back about yet. |
| 157 std::list<Client*> sent_requests_; | 157 std::list<Client*> sent_requests_; |
| 158 | 158 |
| 159 // Information about the plugin. | 159 // Information about the plugin. |
| 160 webkit::WebPluginInfo info_; | 160 WebPluginInfo info_; |
| 161 | 161 |
| 162 #if defined(OS_WIN) | 162 #if defined(OS_WIN) |
| 163 // Tracks plugin parent windows created on the UI thread. | 163 // Tracks plugin parent windows created on the UI thread. |
| 164 std::set<HWND> plugin_parent_windows_set_; | 164 std::set<HWND> plugin_parent_windows_set_; |
| 165 #endif | 165 #endif |
| 166 #if defined(OS_MACOSX) | 166 #if defined(OS_MACOSX) |
| 167 // Tracks plugin windows currently visible. | 167 // Tracks plugin windows currently visible. |
| 168 std::set<uint32> plugin_visible_windows_set_; | 168 std::set<uint32> plugin_visible_windows_set_; |
| 169 // Tracks full screen windows currently visible. | 169 // Tracks full screen windows currently visible. |
| 170 std::set<uint32> plugin_fullscreen_windows_set_; | 170 std::set<uint32> plugin_fullscreen_windows_set_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 183 : public BrowserChildProcessHostTypeIterator<PluginProcessHost> { | 183 : public BrowserChildProcessHostTypeIterator<PluginProcessHost> { |
| 184 public: | 184 public: |
| 185 PluginProcessHostIterator() | 185 PluginProcessHostIterator() |
| 186 : BrowserChildProcessHostTypeIterator<PluginProcessHost>( | 186 : BrowserChildProcessHostTypeIterator<PluginProcessHost>( |
| 187 PROCESS_TYPE_PLUGIN) {} | 187 PROCESS_TYPE_PLUGIN) {} |
| 188 }; | 188 }; |
| 189 | 189 |
| 190 } // namespace content | 190 } // namespace content |
| 191 | 191 |
| 192 #endif // CONTENT_BROWSER_PLUGIN_PROCESS_HOST_H_ | 192 #endif // CONTENT_BROWSER_PLUGIN_PROCESS_HOST_H_ |
| OLD | NEW |