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

Side by Side Diff: ppapi/proxy/flash_device_id_resource.cc

Issue 15491006: Rename PPB_Flash_DeviceID interface to PPB_Flash_DRM (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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/flash_device_id_resource.h"
6
7 #include "base/bind.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/proxy/dispatch_reply_message.h"
10 #include "ppapi/proxy/ppapi_messages.h"
11 #include "ppapi/shared_impl/var.h"
12
13 namespace ppapi {
14 namespace proxy {
15
16 FlashDeviceIDResource::FlashDeviceIDResource(Connection connection,
17 PP_Instance instance)
18 : PluginResource(connection, instance),
19 dest_(NULL) {
20 SendCreate(BROWSER, PpapiHostMsg_FlashDeviceID_Create());
21 }
22
23 FlashDeviceIDResource::~FlashDeviceIDResource() {
24 }
25
26 thunk::PPB_Flash_DeviceID_API*
27 FlashDeviceIDResource::AsPPB_Flash_DeviceID_API() {
28 return this;
29 }
30
31 int32_t FlashDeviceIDResource::GetDeviceID(
32 PP_Var* id,
33 scoped_refptr<TrackedCallback> callback) {
34 if (TrackedCallback::IsPending(callback_))
35 return PP_ERROR_INPROGRESS;
36 if (!id)
37 return PP_ERROR_BADARGUMENT;
38
39 dest_ = id;
40 callback_ = callback;
41
42 Call<PpapiPluginMsg_FlashDeviceID_GetDeviceIDReply>(
43 BROWSER,
44 PpapiHostMsg_FlashDeviceID_GetDeviceID(),
45 base::Bind(&FlashDeviceIDResource::OnPluginMsgGetDeviceIDReply, this));
46 return PP_OK_COMPLETIONPENDING;
47 }
48
49 void FlashDeviceIDResource::OnPluginMsgGetDeviceIDReply(
50 const ResourceMessageReplyParams& params,
51 const std::string& id) {
52 if (params.result() == PP_OK)
53 *dest_ = StringVar::StringToPPVar(id);
54 else
55 *dest_ = PP_MakeUndefined();
56 dest_ = NULL;
57 callback_->Run(params.result());
58 }
59
60 } // namespace proxy
61 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698