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_NPAPI_PLUGIN_CHANNEL_HOST_H_ | 5 #ifndef CONTENT_RENDERER_NPAPI_PLUGIN_CHANNEL_HOST_H_ |
6 #define CONTENT_RENDERER_NPAPI_PLUGIN_CHANNEL_HOST_H_ | 6 #define CONTENT_RENDERER_NPAPI_PLUGIN_CHANNEL_HOST_H_ |
7 | 7 |
8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
9 #include "content/child/npapi/np_channel_base.h" | 9 #include "content/child/npapi/np_channel_base.h" |
10 #include "ipc/ipc_channel_handle.h" | 10 #include "ipc/ipc_channel_handle.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 class NPObjectBase; | 13 class NPObjectBase; |
14 | 14 |
15 // Encapsulates an IPC channel between the renderer and one plugin process. | 15 // Encapsulates an IPC channel between the renderer and one plugin process. |
16 // On the plugin side there's a corresponding PluginChannel. | 16 // On the plugin side there's a corresponding PluginChannel. |
17 class PluginChannelHost : public NPChannelBase { | 17 class PluginChannelHost : public NPChannelBase { |
18 public: | 18 public: |
19 #if defined(OS_MACOSX) | 19 #if defined(OS_MACOSX) |
20 // TODO(shess): Debugging for http://crbug.com/97285 . See comment | 20 // TODO(shess): Debugging for http://crbug.com/97285 . See comment |
21 // in plugin_channel_host.cc. | 21 // in plugin_channel_host.cc. |
22 static bool* GetRemoveTrackingFlag(); | 22 static bool* GetRemoveTrackingFlag(); |
23 #endif | 23 #endif |
24 static PluginChannelHost* GetPluginChannelHost( | 24 static PluginChannelHost* GetPluginChannelHost( |
25 const IPC::ChannelHandle& channel_handle, | 25 const IPC::ChannelHandle& channel_handle, |
26 base::MessageLoopProxy* ipc_message_loop); | 26 base::MessageLoopProxy* ipc_message_loop); |
27 | 27 |
28 virtual bool Init(base::MessageLoopProxy* ipc_message_loop, | 28 virtual bool Init(base::MessageLoopProxy* ipc_message_loop, |
29 bool create_pipe_now, | 29 bool create_pipe_now, |
30 base::WaitableEvent* shutdown_event) OVERRIDE; | 30 base::WaitableEvent* shutdown_event) override; |
31 | 31 |
32 virtual int GenerateRouteID() OVERRIDE; | 32 virtual int GenerateRouteID() override; |
33 | 33 |
34 void AddRoute(int route_id, IPC::Listener* listener, | 34 void AddRoute(int route_id, IPC::Listener* listener, |
35 NPObjectBase* npobject); | 35 NPObjectBase* npobject); |
36 void RemoveRoute(int route_id); | 36 void RemoveRoute(int route_id); |
37 | 37 |
38 // NPChannelBase override: | 38 // NPChannelBase override: |
39 virtual bool Send(IPC::Message* msg) OVERRIDE; | 39 virtual bool Send(IPC::Message* msg) override; |
40 | 40 |
41 // IPC::Listener override | 41 // IPC::Listener override |
42 virtual void OnChannelError() OVERRIDE; | 42 virtual void OnChannelError() override; |
43 | 43 |
44 static void Broadcast(IPC::Message* message) { | 44 static void Broadcast(IPC::Message* message) { |
45 NPChannelBase::Broadcast(message); | 45 NPChannelBase::Broadcast(message); |
46 } | 46 } |
47 | 47 |
48 bool expecting_shutdown() { return expecting_shutdown_; } | 48 bool expecting_shutdown() { return expecting_shutdown_; } |
49 | 49 |
50 private: | 50 private: |
51 // Called on the render thread | 51 // Called on the render thread |
52 PluginChannelHost(); | 52 PluginChannelHost(); |
53 virtual ~PluginChannelHost(); | 53 virtual ~PluginChannelHost(); |
54 | 54 |
55 static NPChannelBase* ClassFactory() { return new PluginChannelHost(); } | 55 static NPChannelBase* ClassFactory() { return new PluginChannelHost(); } |
56 | 56 |
57 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; | 57 virtual bool OnControlMessageReceived(const IPC::Message& message) override; |
58 void OnSetException(const std::string& message); | 58 void OnSetException(const std::string& message); |
59 void OnPluginShuttingDown(); | 59 void OnPluginShuttingDown(); |
60 | 60 |
61 // Keep track of all the registered WebPluginDelegeProxies to | 61 // Keep track of all the registered WebPluginDelegeProxies to |
62 // inform about OnChannelError | 62 // inform about OnChannelError |
63 typedef base::hash_map<int, IPC::Listener*> ProxyMap; | 63 typedef base::hash_map<int, IPC::Listener*> ProxyMap; |
64 ProxyMap proxies_; | 64 ProxyMap proxies_; |
65 | 65 |
66 // True if we are expecting the plugin process to go away - in which case, | 66 // True if we are expecting the plugin process to go away - in which case, |
67 // don't treat it as a crash. | 67 // don't treat it as a crash. |
68 bool expecting_shutdown_; | 68 bool expecting_shutdown_; |
69 | 69 |
70 DISALLOW_COPY_AND_ASSIGN(PluginChannelHost); | 70 DISALLOW_COPY_AND_ASSIGN(PluginChannelHost); |
71 }; | 71 }; |
72 | 72 |
73 } // namespace content | 73 } // namespace content |
74 | 74 |
75 #endif // CONTENT_RENDERER_NPAPI_PLUGIN_CHANNEL_HOST_H_ | 75 #endif // CONTENT_RENDERER_NPAPI_PLUGIN_CHANNEL_HOST_H_ |
OLD | NEW |