Refactor android test results logging.
[chromium-blink-merge.git] / ppapi / proxy / talk_resource.cc
blob557e30640400bf81bb4bdd2b6845376120c4677d
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"
9 namespace ppapi {
10 namespace proxy {
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() {
20 return this;
23 int32_t TalkResource::GetPermission(scoped_refptr<TrackedCallback> callback) {
24 if (TrackedCallback::IsPending(callback_))
25 return PP_ERROR_INPROGRESS;
26 callback_ = callback;
28 if (!sent_create_to_browser())
29 SendCreate(BROWSER, PpapiHostMsg_Talk_Create());
31 Call<PpapiPluginMsg_Talk_GetPermissionReply>(
32 BROWSER,
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());
43 } // namespace proxy
44 } // namespace ppapi