OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "chrome/renderer/plugin_channel_host.h" | 5 #include "chrome/renderer/plugin_channel_host.h" |
6 | 6 |
7 #include "chrome/common/plugin_messages.h" | 7 #include "chrome/common/plugin_messages.h" |
8 | 8 |
| 9 #if defined(OS_POSIX) |
| 10 #include "chrome/common/ipc_channel_posix.h" |
| 11 #endif |
| 12 |
9 // A simple MessageFilter that will ignore all messages and respond to sync | 13 // A simple MessageFilter that will ignore all messages and respond to sync |
10 // messages with an error when is_listening_ is false. | 14 // messages with an error when is_listening_ is false. |
11 class IsListeningFilter : public IPC::ChannelProxy::MessageFilter { | 15 class IsListeningFilter : public IPC::ChannelProxy::MessageFilter { |
12 public: | 16 public: |
13 IsListeningFilter() {} | 17 IsListeningFilter() {} |
14 | 18 |
15 // MessageFilter overrides | 19 // MessageFilter overrides |
16 virtual void OnFilterRemoved() {} | 20 virtual void OnFilterRemoved() {} |
17 virtual void OnFilterAdded(IPC::Channel* channel) { channel_ = channel; } | 21 virtual void OnFilterAdded(IPC::Channel* channel) { channel_ = channel; } |
18 virtual bool OnMessageReceived(const IPC::Message& message); | 22 virtual bool OnMessageReceived(const IPC::Message& message); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 ClassFactory, | 73 ClassFactory, |
70 ipc_message_loop, | 74 ipc_message_loop, |
71 true)); | 75 true)); |
72 return result; | 76 return result; |
73 } | 77 } |
74 | 78 |
75 PluginChannelHost::PluginChannelHost() { | 79 PluginChannelHost::PluginChannelHost() { |
76 } | 80 } |
77 | 81 |
78 PluginChannelHost::~PluginChannelHost() { | 82 PluginChannelHost::~PluginChannelHost() { |
| 83 #if defined(OS_POSIX) |
| 84 IPC::RemoveAndCloseChannelSocket(channel_name()); |
| 85 #endif |
79 } | 86 } |
80 | 87 |
81 bool PluginChannelHost::Init(MessageLoop* ipc_message_loop, | 88 bool PluginChannelHost::Init(MessageLoop* ipc_message_loop, |
82 bool create_pipe_now) { | 89 bool create_pipe_now) { |
83 bool ret = PluginChannelBase::Init(ipc_message_loop, create_pipe_now); | 90 bool ret = PluginChannelBase::Init(ipc_message_loop, create_pipe_now); |
84 is_listening_filter_ = new IsListeningFilter; | 91 is_listening_filter_ = new IsListeningFilter; |
85 channel_->AddFilter(is_listening_filter_); | 92 channel_->AddFilter(is_listening_filter_); |
86 return ret; | 93 return ret; |
87 } | 94 } |
88 | 95 |
(...skipping 21 matching lines...) Expand all Loading... |
110 void PluginChannelHost::OnChannelError() { | 117 void PluginChannelHost::OnChannelError() { |
111 PluginChannelBase::OnChannelError(); | 118 PluginChannelBase::OnChannelError(); |
112 | 119 |
113 for (ProxyMap::iterator iter = proxies_.begin(); | 120 for (ProxyMap::iterator iter = proxies_.begin(); |
114 iter != proxies_.end(); iter++) { | 121 iter != proxies_.end(); iter++) { |
115 iter->second->OnChannelError(); | 122 iter->second->OnChannelError(); |
116 } | 123 } |
117 | 124 |
118 proxies_.clear(); | 125 proxies_.clear(); |
119 } | 126 } |
OLD | NEW |