| OLD | NEW |
| 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_PLUGIN_PLUGIN_CHANNEL_H_ | 5 #ifndef CONTENT_PLUGIN_PLUGIN_CHANNEL_H_ |
| 6 #define CONTENT_PLUGIN_PLUGIN_CHANNEL_H_ | 6 #define CONTENT_PLUGIN_PLUGIN_CHANNEL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_handle.h" | 11 #include "base/memory/scoped_handle.h" |
| 12 #include "base/process.h" | 12 #include "base/process.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "content/plugin/plugin_channel_base.h" | 14 #include "content/plugin/plugin_channel_base.h" |
| 15 #include "content/plugin/webplugin_delegate_stub.h" | 15 #include "content/plugin/webplugin_delegate_stub.h" |
| 16 | 16 |
| 17 namespace base { | 17 namespace base { |
| 18 class WaitableEvent; | 18 class WaitableEvent; |
| 19 } | 19 } |
| 20 | 20 |
| 21 // Encapsulates an IPC channel between the plugin process and one renderer | 21 // Encapsulates an IPC channel between the plugin process and one renderer |
| 22 // process. On the renderer side there's a corresponding PluginChannelHost. | 22 // process. On the renderer side there's a corresponding PluginChannelHost. |
| 23 class PluginChannel : public PluginChannelBase { | 23 class PluginChannel : public PluginChannelBase { |
| 24 public: | 24 public: |
| 25 // Get a new PluginChannel object for the current process to talk to the | 25 // Get a new PluginChannel object for the current process to talk to the |
| 26 // given renderer process. The renderer ID is an opaque unique ID generated | 26 // given renderer process. The renderer ID is an opaque unique ID generated |
| 27 // by the browser. | 27 // by the browser. |
| 28 static PluginChannel* GetPluginChannel(int renderer_id, | 28 static PluginChannel* GetPluginChannel( |
| 29 MessageLoop* ipc_message_loop); | 29 int renderer_id, base::MessageLoopProxy* ipc_message_loop); |
| 30 | 30 |
| 31 // Send a message to all renderers that the process is going to shutdown. | 31 // Send a message to all renderers that the process is going to shutdown. |
| 32 static void NotifyRenderersOfPendingShutdown(); | 32 static void NotifyRenderersOfPendingShutdown(); |
| 33 | 33 |
| 34 virtual ~PluginChannel(); | 34 virtual ~PluginChannel(); |
| 35 | 35 |
| 36 virtual bool Send(IPC::Message* msg); | 36 virtual bool Send(IPC::Message* msg); |
| 37 virtual bool OnMessageReceived(const IPC::Message& message); | 37 virtual bool OnMessageReceived(const IPC::Message& message); |
| 38 | 38 |
| 39 base::ProcessHandle renderer_handle() const { return renderer_handle_; } | 39 base::ProcessHandle renderer_handle() const { return renderer_handle_; } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 55 #endif | 55 #endif |
| 56 | 56 |
| 57 protected: | 57 protected: |
| 58 // IPC::Channel::Listener implementation: | 58 // IPC::Channel::Listener implementation: |
| 59 virtual void OnChannelConnected(int32 peer_pid); | 59 virtual void OnChannelConnected(int32 peer_pid); |
| 60 virtual void OnChannelError(); | 60 virtual void OnChannelError(); |
| 61 | 61 |
| 62 virtual void CleanUp(); | 62 virtual void CleanUp(); |
| 63 | 63 |
| 64 // Overrides PluginChannelBase::Init. | 64 // Overrides PluginChannelBase::Init. |
| 65 virtual bool Init(MessageLoop* ipc_message_loop, bool create_pipe_now); | 65 virtual bool Init(base::MessageLoopProxy* ipc_message_loop, |
| 66 bool create_pipe_now); |
| 66 | 67 |
| 67 private: | 68 private: |
| 68 class MessageFilter; | 69 class MessageFilter; |
| 69 | 70 |
| 70 // Called on the plugin thread | 71 // Called on the plugin thread |
| 71 PluginChannel(); | 72 PluginChannel(); |
| 72 | 73 |
| 73 virtual bool OnControlMessageReceived(const IPC::Message& msg); | 74 virtual bool OnControlMessageReceived(const IPC::Message& msg); |
| 74 | 75 |
| 75 static PluginChannelBase* ClassFactory() { return new PluginChannel(); } | 76 static PluginChannelBase* ClassFactory() { return new PluginChannel(); } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 91 | 92 |
| 92 int in_send_; // Tracks if we're in a Send call. | 93 int in_send_; // Tracks if we're in a Send call. |
| 93 bool log_messages_; // True if we should log sent and received messages. | 94 bool log_messages_; // True if we should log sent and received messages. |
| 94 bool incognito_; // True if the renderer is in incognito mode. | 95 bool incognito_; // True if the renderer is in incognito mode. |
| 95 scoped_refptr<MessageFilter> filter_; // Handles the modal dialog events. | 96 scoped_refptr<MessageFilter> filter_; // Handles the modal dialog events. |
| 96 | 97 |
| 97 DISALLOW_COPY_AND_ASSIGN(PluginChannel); | 98 DISALLOW_COPY_AND_ASSIGN(PluginChannel); |
| 98 }; | 99 }; |
| 99 | 100 |
| 100 #endif // CONTENT_PLUGIN_PLUGIN_CHANNEL_H_ | 101 #endif // CONTENT_PLUGIN_PLUGIN_CHANNEL_H_ |
| OLD | NEW |