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

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
« no previous file with comments | « ppapi/proxy/flash_drm_resource.h ('k') | ppapi/proxy/interface_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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* FlashDRMResource::AsPPB_Flash_DRM_API() {
27 FlashDeviceIDResource::AsPPB_Flash_DeviceID_API() {
28 return this; 26 return this;
29 } 27 }
30 28
31 int32_t FlashDeviceIDResource::GetDeviceID( 29 int32_t FlashDRMResource::GetDeviceID(PP_Var* id,
32 PP_Var* id, 30 scoped_refptr<TrackedCallback> callback) {
33 scoped_refptr<TrackedCallback> callback) {
34 if (TrackedCallback::IsPending(callback_))
35 return PP_ERROR_INPROGRESS;
36 if (!id) 31 if (!id)
37 return PP_ERROR_BADARGUMENT; 32 return PP_ERROR_BADARGUMENT;
38 33
39 dest_ = id; 34 *id = PP_MakeUndefined();
40 callback_ = callback;
41 35
42 Call<PpapiPluginMsg_FlashDeviceID_GetDeviceIDReply>( 36 Call<PpapiPluginMsg_FlashDRM_GetDeviceIDReply>(
43 BROWSER, 37 BROWSER,
44 PpapiHostMsg_FlashDeviceID_GetDeviceID(), 38 PpapiHostMsg_FlashDRM_GetDeviceID(),
45 base::Bind(&FlashDeviceIDResource::OnPluginMsgGetDeviceIDReply, this)); 39 base::Bind(&FlashDRMResource::OnPluginMsgGetDeviceIDReply, this,
40 id, callback));
46 return PP_OK_COMPLETIONPENDING; 41 return PP_OK_COMPLETIONPENDING;
47 } 42 }
48 43
49 void FlashDeviceIDResource::OnPluginMsgGetDeviceIDReply( 44 void FlashDRMResource::OnPluginMsgGetDeviceIDReply(
45 PP_Var* dest,
46 scoped_refptr<TrackedCallback> callback,
50 const ResourceMessageReplyParams& params, 47 const ResourceMessageReplyParams& params,
51 const std::string& id) { 48 const std::string& id) {
52 if (params.result() == PP_OK) 49 if (TrackedCallback::IsPending(callback)) {
53 *dest_ = StringVar::StringToPPVar(id); 50 if (params.result() == PP_OK)
54 else 51 *dest = StringVar::StringToPPVar(id);
55 *dest_ = PP_MakeUndefined(); 52 callback->Run(params.result());
56 dest_ = NULL; 53 }
57 callback_->Run(params.result());
58 } 54 }
59 55
60 } // namespace proxy 56 } // namespace proxy
61 } // namespace ppapi 57 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/flash_drm_resource.h ('k') | ppapi/proxy/interface_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698