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
3 // found in the LICENSE file.
5 #include "ppapi/proxy/talk_resource.h"
7 #include "ppapi/proxy/ppapi_messages.h"
12 TalkResource::TalkResource(Connection connection
, PP_Instance instance
)
13 : PluginResource(connection
, instance
) {
16 TalkResource::~TalkResource() {
19 thunk::PPB_Talk_Private_API
* TalkResource::AsPPB_Talk_Private_API() {
23 int32_t TalkResource::GetPermission(scoped_refptr
<TrackedCallback
> callback
) {
24 if (TrackedCallback::IsPending(callback_
))
25 return PP_ERROR_INPROGRESS
;
28 if (!sent_create_to_browser())
29 SendCreate(BROWSER
, PpapiHostMsg_Talk_Create());
31 Call
<PpapiPluginMsg_Talk_GetPermissionReply
>(
33 PpapiHostMsg_Talk_GetPermission(),
34 base::Bind(&TalkResource::GetPermissionReply
, base::Unretained(this)));
35 return PP_OK_COMPLETIONPENDING
;
38 void TalkResource::GetPermissionReply(
39 const ResourceMessageReplyParams
& params
) {
40 callback_
->Run(params
.result());