| 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 "ppapi/proxy/plugin_dispatcher.h" | 5 #include "ppapi/proxy/plugin_dispatcher.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 PluginDispatcher* PluginDispatcher::Get() { | 59 PluginDispatcher* PluginDispatcher::Get() { |
| 60 return g_dispatcher; | 60 return g_dispatcher; |
| 61 } | 61 } |
| 62 | 62 |
| 63 // static | 63 // static |
| 64 void PluginDispatcher::SetGlobal(PluginDispatcher* dispatcher) { | 64 void PluginDispatcher::SetGlobal(PluginDispatcher* dispatcher) { |
| 65 DCHECK(!dispatcher || !g_dispatcher); | 65 DCHECK(!dispatcher || !g_dispatcher); |
| 66 g_dispatcher = dispatcher; | 66 g_dispatcher = dispatcher; |
| 67 } | 67 } |
| 68 | 68 |
| 69 bool PluginDispatcher::IsPlugin() const { |
| 70 return true; |
| 71 } |
| 72 |
| 69 void PluginDispatcher::OnMessageReceived(const IPC::Message& msg) { | 73 void PluginDispatcher::OnMessageReceived(const IPC::Message& msg) { |
| 70 if (msg.routing_id() == MSG_ROUTING_CONTROL) { | 74 if (msg.routing_id() == MSG_ROUTING_CONTROL) { |
| 71 // Handle some plugin-specific control messages. | 75 // Handle some plugin-specific control messages. |
| 72 IPC_BEGIN_MESSAGE_MAP(PluginDispatcher, msg) | 76 IPC_BEGIN_MESSAGE_MAP(PluginDispatcher, msg) |
| 73 IPC_MESSAGE_HANDLER(PpapiMsg_InitializeModule, OnMsgInitializeModule) | 77 IPC_MESSAGE_HANDLER(PpapiMsg_InitializeModule, OnMsgInitializeModule) |
| 74 IPC_MESSAGE_HANDLER(PpapiMsg_Shutdown, OnMsgShutdown) | 78 IPC_MESSAGE_HANDLER(PpapiMsg_Shutdown, OnMsgShutdown) |
| 75 | 79 |
| 76 // Forward all other control messages to the superclass. | 80 // Forward all other control messages to the superclass. |
| 77 IPC_MESSAGE_UNHANDLED(Dispatcher::OnMessageReceived(msg)) | 81 IPC_MESSAGE_UNHANDLED(Dispatcher::OnMessageReceived(msg)) |
| 78 IPC_END_MESSAGE_MAP() | 82 IPC_END_MESSAGE_MAP() |
| (...skipping 12 matching lines...) Expand all Loading... |
| 91 | 95 |
| 92 void PluginDispatcher::OnMsgShutdown() { | 96 void PluginDispatcher::OnMsgShutdown() { |
| 93 if (shutdown_module_) | 97 if (shutdown_module_) |
| 94 shutdown_module_(); | 98 shutdown_module_(); |
| 95 MessageLoop::current()->Quit(); | 99 MessageLoop::current()->Quit(); |
| 96 } | 100 } |
| 97 | 101 |
| 98 } // namespace proxy | 102 } // namespace proxy |
| 99 } // namespace pp | 103 } // namespace pp |
| 100 | 104 |
| OLD | NEW |