Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Unified Diff: ppapi/proxy/talk_resource.cc

Issue 11359147: Convert the Pepper Talk API to use the new resource system. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/proxy/talk_resource.h ('k') | ppapi/thunk/interfaces_ppb_private.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/talk_resource.cc
diff --git a/ppapi/proxy/talk_resource.cc b/ppapi/proxy/talk_resource.cc
new file mode 100644
index 0000000000000000000000000000000000000000..557e30640400bf81bb4bdd2b6845376120c4677d
--- /dev/null
+++ b/ppapi/proxy/talk_resource.cc
@@ -0,0 +1,44 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/proxy/talk_resource.h"
+
+#include "ppapi/proxy/ppapi_messages.h"
+
+namespace ppapi {
+namespace proxy {
+
+TalkResource::TalkResource(Connection connection, PP_Instance instance)
+ : PluginResource(connection, instance) {
+}
+
+TalkResource::~TalkResource() {
+}
+
+thunk::PPB_Talk_Private_API* TalkResource::AsPPB_Talk_Private_API() {
+ return this;
+}
+
+int32_t TalkResource::GetPermission(scoped_refptr<TrackedCallback> callback) {
+ if (TrackedCallback::IsPending(callback_))
+ return PP_ERROR_INPROGRESS;
+ callback_ = callback;
+
+ if (!sent_create_to_browser())
+ SendCreate(BROWSER, PpapiHostMsg_Talk_Create());
+
+ Call<PpapiPluginMsg_Talk_GetPermissionReply>(
+ BROWSER,
+ PpapiHostMsg_Talk_GetPermission(),
+ base::Bind(&TalkResource::GetPermissionReply, base::Unretained(this)));
+ return PP_OK_COMPLETIONPENDING;
+}
+
+void TalkResource::GetPermissionReply(
+ const ResourceMessageReplyParams& params) {
+ callback_->Run(params.result());
+}
+
+} // namespace proxy
+} // namespace ppapi
« no previous file with comments | « ppapi/proxy/talk_resource.h ('k') | ppapi/thunk/interfaces_ppb_private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698