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

Side by Side Diff: ppapi/proxy/flash_drm_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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/proxy/flash_device_id_resource.h" 5 #include "ppapi/proxy/flash_drm_resource.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "ppapi/c/pp_errors.h" 8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/proxy/dispatch_reply_message.h" 9 #include "ppapi/proxy/dispatch_reply_message.h"
10 #include "ppapi/proxy/ppapi_messages.h" 10 #include "ppapi/proxy/ppapi_messages.h"
11 #include "ppapi/shared_impl/var.h" 11 #include "ppapi/shared_impl/var.h"
12 12
13 namespace ppapi { 13 namespace ppapi {
14 namespace proxy { 14 namespace proxy {
15 15
16 FlashDeviceIDResource::FlashDeviceIDResource(Connection connection, 16 FlashDRMResource::FlashDRMResource(Connection connection,
17 PP_Instance instance) 17 PP_Instance instance)
18 : PluginResource(connection, instance), 18 : PluginResource(connection, instance) {
19 dest_(NULL) { 19 SendCreate(BROWSER, PpapiHostMsg_FlashDRM_Create());
20 SendCreate(BROWSER, PpapiHostMsg_FlashDeviceID_Create());
21 } 20 }
22 21
23 FlashDeviceIDResource::~FlashDeviceIDResource() { 22 FlashDRMResource::~FlashDRMResource() {
24 } 23 }
25 24
26 thunk::PPB_Flash_DeviceID_API* 25 thunk::PPB_Flash_DRM_API*
27 FlashDeviceIDResource::AsPPB_Flash_DeviceID_API() { 26 FlashDRMResource::AsPPB_Flash_DRM_API() {
yzshen1 2013/05/21 06:32:31 I guess we don't have to wrap now. (But I didn't a
raymes 2013/05/21 16:32:51 Done.
28 return this; 27 return this;
29 } 28 }
30 29
31 int32_t FlashDeviceIDResource::GetDeviceID( 30 int32_t FlashDRMResource::GetDeviceID(PP_Var* id,
32 PP_Var* id, 31 scoped_refptr<TrackedCallback> callback) {
33 scoped_refptr<TrackedCallback> callback) {
34 if (TrackedCallback::IsPending(callback_))
35 return PP_ERROR_INPROGRESS;
36 if (!id) 32 if (!id)
37 return PP_ERROR_BADARGUMENT; 33 return PP_ERROR_BADARGUMENT;
38 34
39 dest_ = id; 35 *id = PP_MakeUndefined();
40 callback_ = callback;
41 36
42 Call<PpapiPluginMsg_FlashDeviceID_GetDeviceIDReply>( 37 Call<PpapiPluginMsg_FlashDRM_GetDeviceIDReply>(
43 BROWSER, 38 BROWSER,
44 PpapiHostMsg_FlashDeviceID_GetDeviceID(), 39 PpapiHostMsg_FlashDRM_GetDeviceID(),
45 base::Bind(&FlashDeviceIDResource::OnPluginMsgGetDeviceIDReply, this)); 40 base::Bind(&FlashDRMResource::OnPluginMsgGetDeviceIDReply, this,
41 id, callback));
46 return PP_OK_COMPLETIONPENDING; 42 return PP_OK_COMPLETIONPENDING;
47 } 43 }
48 44
49 void FlashDeviceIDResource::OnPluginMsgGetDeviceIDReply( 45 void FlashDRMResource::OnPluginMsgGetDeviceIDReply(
46 PP_Var* dest,
47 scoped_refptr<TrackedCallback> callback,
50 const ResourceMessageReplyParams& params, 48 const ResourceMessageReplyParams& params,
51 const std::string& id) { 49 const std::string& id) {
52 if (params.result() == PP_OK) 50 if (params.result() == PP_OK)
yzshen1 2013/05/21 06:32:31 Please check whether callback is pending. If not,
raymes 2013/05/21 16:32:51 Done.
53 *dest_ = StringVar::StringToPPVar(id); 51 *dest = StringVar::StringToPPVar(id);
54 else 52 callback->Run(params.result());
55 *dest_ = PP_MakeUndefined();
56 dest_ = NULL;
57 callback_->Run(params.result());
58 } 53 }
59 54
60 } // namespace proxy 55 } // namespace proxy
61 } // namespace ppapi 56 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698