| 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 #include "third_party/WebKit/WebKit/chromium/public/WebBindings.h" |
| 10 |
| 9 // A simple MessageFilter that will ignore all messages and respond to sync | 11 // A simple MessageFilter that will ignore all messages and respond to sync |
| 10 // messages with an error when is_listening_ is false. | 12 // messages with an error when is_listening_ is false. |
| 11 class IsListeningFilter : public IPC::ChannelProxy::MessageFilter { | 13 class IsListeningFilter : public IPC::ChannelProxy::MessageFilter { |
| 12 public: | 14 public: |
| 13 IsListeningFilter() {} | 15 IsListeningFilter() {} |
| 14 | 16 |
| 15 // MessageFilter overrides | 17 // MessageFilter overrides |
| 16 virtual void OnFilterRemoved() {} | 18 virtual void OnFilterRemoved() {} |
| 17 virtual void OnFilterAdded(IPC::Channel* channel) { channel_ = channel; } | 19 virtual void OnFilterAdded(IPC::Channel* channel) { channel_ = channel; } |
| 18 virtual bool OnMessageReceived(const IPC::Message& message); | 20 virtual bool OnMessageReceived(const IPC::Message& message); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 102 |
| 101 if (!npobject) | 103 if (!npobject) |
| 102 proxies_[route_id] = listener; | 104 proxies_[route_id] = listener; |
| 103 } | 105 } |
| 104 | 106 |
| 105 void PluginChannelHost::RemoveRoute(int route_id) { | 107 void PluginChannelHost::RemoveRoute(int route_id) { |
| 106 proxies_.erase(route_id); | 108 proxies_.erase(route_id); |
| 107 PluginChannelBase::RemoveRoute(route_id); | 109 PluginChannelBase::RemoveRoute(route_id); |
| 108 } | 110 } |
| 109 | 111 |
| 112 void PluginChannelHost::OnControlMessageReceived(const IPC::Message& message) { |
| 113 IPC_BEGIN_MESSAGE_MAP(PluginChannelHost, message) |
| 114 IPC_MESSAGE_HANDLER(PluginHostMsg_SetException, OnSetException) |
| 115 IPC_MESSAGE_UNHANDLED_ERROR() |
| 116 IPC_END_MESSAGE_MAP() |
| 117 } |
| 118 |
| 119 void PluginChannelHost::OnSetException(const std::string& message) { |
| 120 WebKit::WebBindings::setException(NULL, message.c_str()); |
| 121 } |
| 122 |
| 110 void PluginChannelHost::OnChannelError() { | 123 void PluginChannelHost::OnChannelError() { |
| 111 PluginChannelBase::OnChannelError(); | 124 PluginChannelBase::OnChannelError(); |
| 112 | 125 |
| 113 for (ProxyMap::iterator iter = proxies_.begin(); | 126 for (ProxyMap::iterator iter = proxies_.begin(); |
| 114 iter != proxies_.end(); iter++) { | 127 iter != proxies_.end(); iter++) { |
| 115 iter->second->OnChannelError(); | 128 iter->second->OnChannelError(); |
| 116 } | 129 } |
| 117 | 130 |
| 118 proxies_.clear(); | 131 proxies_.clear(); |
| 119 } | 132 } |
| OLD | NEW |