OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #include "ppapi/proxy/talk_resource.h" |
| 6 |
| 7 #include "ppapi/proxy/ppapi_messages.h" |
| 8 |
| 9 namespace ppapi { |
| 10 namespace proxy { |
| 11 |
| 12 TalkResource::TalkResource(Connection connection, PP_Instance instance) |
| 13 : PluginResource(connection, instance) { |
| 14 } |
| 15 |
| 16 TalkResource::~TalkResource() { |
| 17 } |
| 18 |
| 19 thunk::PPB_Talk_Private_API* TalkResource::AsPPB_Talk_Private_API() { |
| 20 return this; |
| 21 } |
| 22 |
| 23 int32_t TalkResource::GetPermission(scoped_refptr<TrackedCallback> callback) { |
| 24 if (TrackedCallback::IsPending(callback_)) |
| 25 return PP_ERROR_INPROGRESS; |
| 26 callback_ = callback; |
| 27 |
| 28 if (!sent_create_to_browser()) |
| 29 SendCreate(BROWSER, PpapiHostMsg_Talk_Create()); |
| 30 |
| 31 Call<PpapiPluginMsg_Talk_GetPermissionReply>( |
| 32 BROWSER, |
| 33 PpapiHostMsg_Talk_GetPermission(), |
| 34 base::Bind(&TalkResource::GetPermissionReply, base::Unretained(this))); |
| 35 return PP_OK_COMPLETIONPENDING; |
| 36 } |
| 37 |
| 38 void TalkResource::GetPermissionReply( |
| 39 const ResourceMessageReplyParams& params) { |
| 40 callback_->Run(params.result()); |
| 41 } |
| 42 |
| 43 } // namespace proxy |
| 44 } // namespace ppapi |
OLD | NEW |