| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ppb_flash_message_loop_proxy.h" | 5 #include "ppapi/proxy/ppb_flash_message_loop_proxy.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
| 9 #include "ppapi/c/private/ppb_flash_message_loop.h" | 9 #include "ppapi/c/private/ppb_flash_message_loop.h" |
| 10 #include "ppapi/proxy/enter_proxy.h" | 10 #include "ppapi/proxy/enter_proxy.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 HostResource result; | 90 HostResource result; |
| 91 dispatcher->Send(new PpapiHostMsg_PPBFlashMessageLoop_Create( | 91 dispatcher->Send(new PpapiHostMsg_PPBFlashMessageLoop_Create( |
| 92 API_ID_PPB_FLASH_MESSAGELOOP, instance, &result)); | 92 API_ID_PPB_FLASH_MESSAGELOOP, instance, &result)); |
| 93 if (result.is_null()) | 93 if (result.is_null()) |
| 94 return 0; | 94 return 0; |
| 95 return (new FlashMessageLoop(result))->GetReference(); | 95 return (new FlashMessageLoop(result))->GetReference(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 bool PPB_Flash_MessageLoop_Proxy::OnMessageReceived(const IPC::Message& msg) { | 98 bool PPB_Flash_MessageLoop_Proxy::OnMessageReceived(const IPC::Message& msg) { |
| 99 if (!dispatcher()->permissions().HasPermission(PERMISSION_FLASH)) |
| 100 return false; |
| 101 |
| 99 bool handled = true; | 102 bool handled = true; |
| 100 IPC_BEGIN_MESSAGE_MAP(PPB_Flash_MessageLoop_Proxy, msg) | 103 IPC_BEGIN_MESSAGE_MAP(PPB_Flash_MessageLoop_Proxy, msg) |
| 101 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlashMessageLoop_Create, | 104 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlashMessageLoop_Create, |
| 102 OnMsgCreate) | 105 OnMsgCreate) |
| 103 // We cannot use IPC_MESSAGE_HANDLER here. Because it tries to send the sync | 106 // We cannot use IPC_MESSAGE_HANDLER here. Because it tries to send the sync |
| 104 // message reply after the handler returns. However, in this case, the | 107 // message reply after the handler returns. However, in this case, the |
| 105 // PPB_Flash_MessageLoop_Proxy object may be destroyed before the handler | 108 // PPB_Flash_MessageLoop_Proxy object may be destroyed before the handler |
| 106 // returns. | 109 // returns. |
| 107 IPC_MESSAGE_HANDLER_DELAY_REPLY(PpapiHostMsg_PPBFlashMessageLoop_Run, | 110 IPC_MESSAGE_HANDLER_DELAY_REPLY(PpapiHostMsg_PPBFlashMessageLoop_Run, |
| 108 OnMsgRun) | 111 OnMsgRun) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 void PPB_Flash_MessageLoop_Proxy::WillQuitSoon( | 151 void PPB_Flash_MessageLoop_Proxy::WillQuitSoon( |
| 149 scoped_ptr<IPC::Message> reply_message, | 152 scoped_ptr<IPC::Message> reply_message, |
| 150 int32_t result) { | 153 int32_t result) { |
| 151 PpapiHostMsg_PPBFlashMessageLoop_Run::WriteReplyParams(reply_message.get(), | 154 PpapiHostMsg_PPBFlashMessageLoop_Run::WriteReplyParams(reply_message.get(), |
| 152 result); | 155 result); |
| 153 Send(reply_message.release()); | 156 Send(reply_message.release()); |
| 154 } | 157 } |
| 155 | 158 |
| 156 } // namespace proxy | 159 } // namespace proxy |
| 157 } // namespace ppapi | 160 } // namespace ppapi |
| OLD | NEW |