OLD | NEW |
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_drm_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/file_ref_resource.h" | 10 #include "ppapi/proxy/file_ref_resource.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 *file_ref = 0; | 64 *file_ref = 0; |
65 | 65 |
66 Call<PpapiPluginMsg_FlashDRM_GetVoucherFileReply>( | 66 Call<PpapiPluginMsg_FlashDRM_GetVoucherFileReply>( |
67 RENDERER, | 67 RENDERER, |
68 PpapiHostMsg_FlashDRM_GetVoucherFile(), | 68 PpapiHostMsg_FlashDRM_GetVoucherFile(), |
69 base::Bind(&FlashDRMResource::OnPluginMsgGetVoucherFileReply, this, | 69 base::Bind(&FlashDRMResource::OnPluginMsgGetVoucherFileReply, this, |
70 file_ref, callback)); | 70 file_ref, callback)); |
71 return PP_OK_COMPLETIONPENDING; | 71 return PP_OK_COMPLETIONPENDING; |
72 } | 72 } |
73 | 73 |
| 74 int32_t FlashDRMResource::MonitorIsExternal( |
| 75 PP_Bool* is_external, |
| 76 scoped_refptr<TrackedCallback> callback) { |
| 77 if (!is_external) |
| 78 return PP_ERROR_BADARGUMENT; |
| 79 |
| 80 *is_external = PP_FALSE; |
| 81 |
| 82 Call<PpapiPluginMsg_FlashDRM_MonitorIsExternalReply>( |
| 83 BROWSER, |
| 84 PpapiHostMsg_FlashDRM_MonitorIsExternal(), |
| 85 base::Bind(&FlashDRMResource::OnPluginMsgMonitorIsExternalReply, this, |
| 86 is_external, callback)); |
| 87 return PP_OK_COMPLETIONPENDING; |
| 88 } |
| 89 |
74 void FlashDRMResource::OnPluginMsgGetDeviceIDReply( | 90 void FlashDRMResource::OnPluginMsgGetDeviceIDReply( |
75 PP_Var* dest, | 91 PP_Var* dest, |
76 scoped_refptr<TrackedCallback> callback, | 92 scoped_refptr<TrackedCallback> callback, |
77 const ResourceMessageReplyParams& params, | 93 const ResourceMessageReplyParams& params, |
78 const std::string& id) { | 94 const std::string& id) { |
79 if (TrackedCallback::IsPending(callback)) { | 95 if (TrackedCallback::IsPending(callback)) { |
80 if (params.result() == PP_OK) | 96 if (params.result() == PP_OK) |
81 *dest = StringVar::StringToPPVar(id); | 97 *dest = StringVar::StringToPPVar(id); |
82 callback->Run(params.result()); | 98 callback->Run(params.result()); |
83 } | 99 } |
84 } | 100 } |
85 | 101 |
86 void FlashDRMResource::OnPluginMsgGetVoucherFileReply( | 102 void FlashDRMResource::OnPluginMsgGetVoucherFileReply( |
87 PP_Resource* dest, | 103 PP_Resource* dest, |
88 scoped_refptr<TrackedCallback> callback, | 104 scoped_refptr<TrackedCallback> callback, |
89 const ResourceMessageReplyParams& params, | 105 const ResourceMessageReplyParams& params, |
90 const FileRefCreateInfo& file_info) { | 106 const FileRefCreateInfo& file_info) { |
91 if (TrackedCallback::IsPending(callback)) { | 107 if (TrackedCallback::IsPending(callback)) { |
92 if (params.result() == PP_OK) { | 108 if (params.result() == PP_OK) { |
93 *dest = FileRefResource::CreateFileRef( | 109 *dest = FileRefResource::CreateFileRef( |
94 connection(), | 110 connection(), |
95 pp_instance(), | 111 pp_instance(), |
96 file_info); | 112 file_info); |
97 } | 113 } |
98 callback->Run(params.result()); | 114 callback->Run(params.result()); |
99 } | 115 } |
100 } | 116 } |
101 | 117 |
| 118 void FlashDRMResource::OnPluginMsgMonitorIsExternalReply( |
| 119 PP_Bool* dest, |
| 120 scoped_refptr<TrackedCallback> callback, |
| 121 const ResourceMessageReplyParams& params, |
| 122 PP_Bool is_external) { |
| 123 if (TrackedCallback::IsPending(callback)) { |
| 124 if (params.result() == PP_OK) |
| 125 *dest = is_external; |
| 126 callback->Run(params.result()); |
| 127 } |
| 128 } |
| 129 |
102 } // namespace proxy | 130 } // namespace proxy |
103 } // namespace ppapi | 131 } // namespace ppapi |
OLD | NEW |