| 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_RENDERER_PLUGIN_CHANNEL_HOST_H_ | 5 #ifndef CONTENT_RENDERER_PLUGIN_CHANNEL_HOST_H_ |
| 6 #define CONTENT_RENDERER_PLUGIN_CHANNEL_HOST_H_ | 6 #define CONTENT_RENDERER_PLUGIN_CHANNEL_HOST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/hash_tables.h" | 9 #include "base/hash_tables.h" |
| 10 #include "content/common/np_channel_base.h" | 10 #include "content/common/np_channel_base.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 static PluginChannelHost* GetPluginChannelHost( | 25 static PluginChannelHost* GetPluginChannelHost( |
| 26 const IPC::ChannelHandle& channel_handle, | 26 const IPC::ChannelHandle& channel_handle, |
| 27 base::MessageLoopProxy* ipc_message_loop); | 27 base::MessageLoopProxy* ipc_message_loop); |
| 28 | 28 |
| 29 virtual bool Init(base::MessageLoopProxy* ipc_message_loop, | 29 virtual bool Init(base::MessageLoopProxy* ipc_message_loop, |
| 30 bool create_pipe_now, | 30 bool create_pipe_now, |
| 31 base::WaitableEvent* shutdown_event) OVERRIDE; | 31 base::WaitableEvent* shutdown_event) OVERRIDE; |
| 32 | 32 |
| 33 virtual int GenerateRouteID() OVERRIDE; | 33 virtual int GenerateRouteID() OVERRIDE; |
| 34 | 34 |
| 35 void AddRoute(int route_id, IPC::Channel::Listener* listener, | 35 void AddRoute(int route_id, IPC::Listener* listener, |
| 36 NPObjectBase* npobject); | 36 NPObjectBase* npobject); |
| 37 void RemoveRoute(int route_id); | 37 void RemoveRoute(int route_id); |
| 38 | 38 |
| 39 // NPChannelBase override: | 39 // NPChannelBase override: |
| 40 virtual bool Send(IPC::Message* msg) OVERRIDE; | 40 virtual bool Send(IPC::Message* msg) OVERRIDE; |
| 41 | 41 |
| 42 // IPC::Channel::Listener override | 42 // IPC::Listener override |
| 43 virtual void OnChannelError() OVERRIDE; | 43 virtual void OnChannelError() OVERRIDE; |
| 44 | 44 |
| 45 static void SetListening(bool flag); | 45 static void SetListening(bool flag); |
| 46 | 46 |
| 47 static bool IsListening(); | 47 static bool IsListening(); |
| 48 | 48 |
| 49 static void Broadcast(IPC::Message* message) { | 49 static void Broadcast(IPC::Message* message) { |
| 50 NPChannelBase::Broadcast(message); | 50 NPChannelBase::Broadcast(message); |
| 51 } | 51 } |
| 52 | 52 |
| 53 bool expecting_shutdown() { return expecting_shutdown_; } | 53 bool expecting_shutdown() { return expecting_shutdown_; } |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 // Called on the render thread | 56 // Called on the render thread |
| 57 PluginChannelHost(); | 57 PluginChannelHost(); |
| 58 virtual ~PluginChannelHost(); | 58 virtual ~PluginChannelHost(); |
| 59 | 59 |
| 60 static NPChannelBase* ClassFactory() { return new PluginChannelHost(); } | 60 static NPChannelBase* ClassFactory() { return new PluginChannelHost(); } |
| 61 | 61 |
| 62 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; | 62 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; |
| 63 void OnSetException(const std::string& message); | 63 void OnSetException(const std::string& message); |
| 64 void OnPluginShuttingDown(); | 64 void OnPluginShuttingDown(); |
| 65 | 65 |
| 66 // Keep track of all the registered WebPluginDelegeProxies to | 66 // Keep track of all the registered WebPluginDelegeProxies to |
| 67 // inform about OnChannelError | 67 // inform about OnChannelError |
| 68 typedef base::hash_map<int, IPC::Channel::Listener*> ProxyMap; | 68 typedef base::hash_map<int, IPC::Listener*> ProxyMap; |
| 69 ProxyMap proxies_; | 69 ProxyMap proxies_; |
| 70 | 70 |
| 71 // An IPC MessageFilter that can be told to filter out all messages. This is | 71 // An IPC MessageFilter that can be told to filter out all messages. This is |
| 72 // used when the JS debugger is attached in order to avoid browser hangs. | 72 // used when the JS debugger is attached in order to avoid browser hangs. |
| 73 scoped_refptr<IsListeningFilter> is_listening_filter_; | 73 scoped_refptr<IsListeningFilter> is_listening_filter_; |
| 74 | 74 |
| 75 // True if we are expecting the plugin process to go away - in which case, | 75 // True if we are expecting the plugin process to go away - in which case, |
| 76 // don't treat it as a crash. | 76 // don't treat it as a crash. |
| 77 bool expecting_shutdown_; | 77 bool expecting_shutdown_; |
| 78 | 78 |
| 79 DISALLOW_COPY_AND_ASSIGN(PluginChannelHost); | 79 DISALLOW_COPY_AND_ASSIGN(PluginChannelHost); |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 #endif // CONTENT_RENDERER_PLUGIN_CHANNEL_HOST_H_ | 82 #endif // CONTENT_RENDERER_PLUGIN_CHANNEL_HOST_H_ |
| OLD | NEW |