| 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_talk_private_proxy.h" | 5 #include "ppapi/proxy/ppb_talk_private_proxy.h" |
| 6 | 6 |
| 7 #include "ipc/ipc_message_macros.h" | 7 #include "ipc/ipc_message_macros.h" |
| 8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
| 9 #include "ppapi/proxy/plugin_dispatcher.h" | 9 #include "ppapi/proxy/plugin_dispatcher.h" |
| 10 #include "ppapi/proxy/plugin_globals.h" | 10 #include "ppapi/proxy/plugin_globals.h" |
| 11 #include "ppapi/proxy/plugin_proxy_delegate.h" | |
| 12 #include "ppapi/proxy/ppapi_messages.h" | 11 #include "ppapi/proxy/ppapi_messages.h" |
| 13 #include "ppapi/shared_impl/resource.h" | 12 #include "ppapi/shared_impl/resource.h" |
| 14 #include "ppapi/shared_impl/tracked_callback.h" | 13 #include "ppapi/shared_impl/tracked_callback.h" |
| 15 #include "ppapi/thunk/enter.h" | 14 #include "ppapi/thunk/enter.h" |
| 16 #include "ppapi/thunk/ppb_talk_private_api.h" | 15 #include "ppapi/thunk/ppb_talk_private_api.h" |
| 17 | 16 |
| 18 namespace ppapi { | 17 namespace ppapi { |
| 19 namespace proxy { | 18 namespace proxy { |
| 20 | 19 |
| 21 namespace { | 20 namespace { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 32 int32_t GetPermission(scoped_refptr<TrackedCallback> callback) { | 31 int32_t GetPermission(scoped_refptr<TrackedCallback> callback) { |
| 33 if (TrackedCallback::IsPending(callback_)) | 32 if (TrackedCallback::IsPending(callback_)) |
| 34 return PP_ERROR_INPROGRESS; | 33 return PP_ERROR_INPROGRESS; |
| 35 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance( | 34 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance( |
| 36 pp_instance()); | 35 pp_instance()); |
| 37 if (!dispatcher) | 36 if (!dispatcher) |
| 38 return PP_ERROR_FAILED; | 37 return PP_ERROR_FAILED; |
| 39 | 38 |
| 40 callback_ = callback; | 39 callback_ = callback; |
| 41 | 40 |
| 42 if (PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser( | 41 if (PluginGlobals::Get()->GetBrowserSender()->Send( |
| 43 new PpapiHostMsg_PPBTalk_GetPermission( | 42 new PpapiHostMsg_PPBTalk_GetPermission( |
| 44 API_ID_PPB_TALK, | 43 API_ID_PPB_TALK, |
| 45 dispatcher->plugin_dispatcher_id(), | 44 dispatcher->plugin_dispatcher_id(), |
| 46 pp_resource()))) | 45 pp_resource()))) |
| 47 return PP_OK_COMPLETIONPENDING; | 46 return PP_OK_COMPLETIONPENDING; |
| 48 return PP_ERROR_FAILED; | 47 return PP_ERROR_FAILED; |
| 49 } | 48 } |
| 50 | 49 |
| 51 void GotCompletion(int32_t result) { | 50 void GotCompletion(int32_t result) { |
| 52 callback_->Run(result); | 51 callback_->Run(result); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 83 PP_Resource resource, | 82 PP_Resource resource, |
| 84 int32_t result) { | 83 int32_t result) { |
| 85 thunk::EnterResourceNoLock<thunk::PPB_Talk_Private_API> enter( | 84 thunk::EnterResourceNoLock<thunk::PPB_Talk_Private_API> enter( |
| 86 resource, false); | 85 resource, false); |
| 87 if (enter.succeeded()) | 86 if (enter.succeeded()) |
| 88 static_cast<Talk*>(enter.object())->GotCompletion(result); | 87 static_cast<Talk*>(enter.object())->GotCompletion(result); |
| 89 } | 88 } |
| 90 | 89 |
| 91 } // namespace proxy | 90 } // namespace proxy |
| 92 } // namespace ppapi | 91 } // namespace ppapi |
| OLD | NEW |