| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/plugin/plugin_channel.h" | 5 #include "chrome/plugin/plugin_channel.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/lock.h" | 8 #include "base/lock.h" |
| 9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 in_send_++; | 183 in_send_++; |
| 184 if (log_messages_) { | 184 if (log_messages_) { |
| 185 VLOG(1) << "sending message @" << msg << " on channel @" << this | 185 VLOG(1) << "sending message @" << msg << " on channel @" << this |
| 186 << " with type " << msg->type(); | 186 << " with type " << msg->type(); |
| 187 } | 187 } |
| 188 bool result = PluginChannelBase::Send(msg); | 188 bool result = PluginChannelBase::Send(msg); |
| 189 in_send_--; | 189 in_send_--; |
| 190 return result; | 190 return result; |
| 191 } | 191 } |
| 192 | 192 |
| 193 void PluginChannel::OnMessageReceived(const IPC::Message& msg) { | 193 bool PluginChannel::OnMessageReceived(const IPC::Message& msg) { |
| 194 if (log_messages_) { | 194 if (log_messages_) { |
| 195 VLOG(1) << "received message @" << &msg << " on channel @" << this | 195 VLOG(1) << "received message @" << &msg << " on channel @" << this |
| 196 << " with type " << msg.type(); | 196 << " with type " << msg.type(); |
| 197 } | 197 } |
| 198 PluginChannelBase::OnMessageReceived(msg); | 198 return PluginChannelBase::OnMessageReceived(msg); |
| 199 } | 199 } |
| 200 | 200 |
| 201 void PluginChannel::OnControlMessageReceived(const IPC::Message& msg) { | 201 bool PluginChannel::OnControlMessageReceived(const IPC::Message& msg) { |
| 202 bool handled = true; |
| 202 IPC_BEGIN_MESSAGE_MAP(PluginChannel, msg) | 203 IPC_BEGIN_MESSAGE_MAP(PluginChannel, msg) |
| 203 IPC_MESSAGE_HANDLER(PluginMsg_CreateInstance, OnCreateInstance) | 204 IPC_MESSAGE_HANDLER(PluginMsg_CreateInstance, OnCreateInstance) |
| 204 IPC_MESSAGE_HANDLER_DELAY_REPLY(PluginMsg_DestroyInstance, | 205 IPC_MESSAGE_HANDLER_DELAY_REPLY(PluginMsg_DestroyInstance, |
| 205 OnDestroyInstance) | 206 OnDestroyInstance) |
| 206 IPC_MESSAGE_HANDLER(PluginMsg_GenerateRouteID, OnGenerateRouteID) | 207 IPC_MESSAGE_HANDLER(PluginMsg_GenerateRouteID, OnGenerateRouteID) |
| 207 IPC_MESSAGE_HANDLER(PluginMsg_ClearSiteData, OnClearSiteData) | 208 IPC_MESSAGE_HANDLER(PluginMsg_ClearSiteData, OnClearSiteData) |
| 208 IPC_MESSAGE_UNHANDLED_ERROR() | 209 IPC_MESSAGE_UNHANDLED(handled = false) |
| 209 IPC_END_MESSAGE_MAP() | 210 IPC_END_MESSAGE_MAP() |
| 211 DCHECK(handled); |
| 212 return handled; |
| 210 } | 213 } |
| 211 | 214 |
| 212 void PluginChannel::OnCreateInstance(const std::string& mime_type, | 215 void PluginChannel::OnCreateInstance(const std::string& mime_type, |
| 213 int* instance_id) { | 216 int* instance_id) { |
| 214 *instance_id = GenerateRouteID(); | 217 *instance_id = GenerateRouteID(); |
| 215 scoped_refptr<WebPluginDelegateStub> stub(new WebPluginDelegateStub( | 218 scoped_refptr<WebPluginDelegateStub> stub(new WebPluginDelegateStub( |
| 216 mime_type, *instance_id, this)); | 219 mime_type, *instance_id, this)); |
| 217 AddRoute(*instance_id, stub, NULL); | 220 AddRoute(*instance_id, stub, NULL); |
| 218 plugin_stubs_.push_back(stub); | 221 plugin_stubs_.push_back(stub); |
| 219 } | 222 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 } | 320 } |
| 318 | 321 |
| 319 bool PluginChannel::Init(MessageLoop* ipc_message_loop, bool create_pipe_now) { | 322 bool PluginChannel::Init(MessageLoop* ipc_message_loop, bool create_pipe_now) { |
| 320 if (!PluginChannelBase::Init(ipc_message_loop, create_pipe_now)) | 323 if (!PluginChannelBase::Init(ipc_message_loop, create_pipe_now)) |
| 321 return false; | 324 return false; |
| 322 | 325 |
| 323 channel_->AddFilter(filter_.get()); | 326 channel_->AddFilter(filter_.get()); |
| 324 return true; | 327 return true; |
| 325 } | 328 } |
| 326 | 329 |
| OLD | NEW |