| 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/plugin/npobject_stub.h" | 5 #include "chrome/plugin/npobject_stub.h" |
| 6 | 6 |
| 7 #include "chrome/common/child_process_logging.h" | 7 #include "chrome/common/child_process_logging.h" |
| 8 #include "chrome/common/plugin_messages.h" | 8 #include "chrome/common/plugin_messages.h" |
| 9 #include "chrome/plugin/npobject_util.h" | 9 #include "chrome/plugin/npobject_util.h" |
| 10 #include "chrome/plugin/plugin_channel_base.h" | 10 #include "chrome/plugin/plugin_channel_base.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // ScriptController manually deleted the object). As a result, | 48 // ScriptController manually deleted the object). As a result, |
| 49 // OnMessageReceived won't dispatch any more messages. Since this includes | 49 // OnMessageReceived won't dispatch any more messages. Since this includes |
| 50 // OnRelease, this object won't get deleted until OnChannelError which might | 50 // OnRelease, this object won't get deleted until OnChannelError which might |
| 51 // not happen for a long time if this renderer process has a long lived | 51 // not happen for a long time if this renderer process has a long lived |
| 52 // plugin instance to the same process. So we delete this object manually. | 52 // plugin instance to the same process. So we delete this object manually. |
| 53 npobject_ = NULL; | 53 npobject_ = NULL; |
| 54 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 54 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void NPObjectStub::OnMessageReceived(const IPC::Message& msg) { | 57 void NPObjectStub::OnMessageReceived(const IPC::Message& msg) { |
| 58 child_process_logging::ScopedActiveURLSetter url_setter(page_url_); | 58 child_process_logging::SetActiveURL(page_url_); |
| 59 | 59 |
| 60 if (!npobject_) { | 60 if (!npobject_) { |
| 61 if (msg.is_sync()) { | 61 if (msg.is_sync()) { |
| 62 // The object could be garbage because the frame has gone away, so | 62 // The object could be garbage because the frame has gone away, so |
| 63 // just send an error reply to the caller. | 63 // just send an error reply to the caller. |
| 64 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg); | 64 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg); |
| 65 reply->set_reply_error(); | 65 reply->set_reply_error(); |
| 66 Send(reply); | 66 Send(reply); |
| 67 } | 67 } |
| 68 | 68 |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 } | 374 } |
| 375 | 375 |
| 376 void NPObjectStub::OnSetException(const std::string& message) { | 376 void NPObjectStub::OnSetException(const std::string& message) { |
| 377 if (IsPluginProcess()) { | 377 if (IsPluginProcess()) { |
| 378 NOTREACHED() << "Should only be called on NPObjects in the renderer"; | 378 NOTREACHED() << "Should only be called on NPObjects in the renderer"; |
| 379 return; | 379 return; |
| 380 } | 380 } |
| 381 | 381 |
| 382 WebBindings::setException(npobject_, message.c_str()); | 382 WebBindings::setException(npobject_, message.c_str()); |
| 383 } | 383 } |
| OLD | NEW |