| 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 "chrome/browser/renderer_host/pepper/pepper_flash_drm_host.h" | 5 #include "chrome/browser/renderer_host/pepper/pepper_flash_drm_host.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <Windows.h> | 8 #include <Windows.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 } | 137 } |
| 138 | 138 |
| 139 int32_t PepperFlashDRMHost::OnResourceMessageReceived( | 139 int32_t PepperFlashDRMHost::OnResourceMessageReceived( |
| 140 const IPC::Message& msg, | 140 const IPC::Message& msg, |
| 141 ppapi::host::HostMessageContext* context) { | 141 ppapi::host::HostMessageContext* context) { |
| 142 IPC_BEGIN_MESSAGE_MAP(PepperFlashDRMHost, msg) | 142 IPC_BEGIN_MESSAGE_MAP(PepperFlashDRMHost, msg) |
| 143 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_FlashDRM_GetDeviceID, | 143 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_FlashDRM_GetDeviceID, |
| 144 OnHostMsgGetDeviceID) | 144 OnHostMsgGetDeviceID) |
| 145 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_FlashDRM_GetHmonitor, | 145 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_FlashDRM_GetHmonitor, |
| 146 OnHostMsgGetHmonitor) | 146 OnHostMsgGetHmonitor) |
| 147 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_FlashDRM_MonitorIsExternal, |
| 148 OnHostMsgMonitorIsExternal) |
| 147 IPC_END_MESSAGE_MAP() | 149 IPC_END_MESSAGE_MAP() |
| 148 return PP_ERROR_FAILED; | 150 return PP_ERROR_FAILED; |
| 149 } | 151 } |
| 150 | 152 |
| 151 int32_t PepperFlashDRMHost::OnHostMsgGetDeviceID( | 153 int32_t PepperFlashDRMHost::OnHostMsgGetDeviceID( |
| 152 ppapi::host::HostMessageContext* context) { | 154 ppapi::host::HostMessageContext* context) { |
| 153 if (!fetcher_->Start(base::Bind(&PepperFlashDRMHost::GotDeviceID, | 155 if (!fetcher_->Start(base::Bind(&PepperFlashDRMHost::GotDeviceID, |
| 154 weak_factory_.GetWeakPtr(), | 156 weak_factory_.GetWeakPtr(), |
| 155 context->MakeReplyMessageContext()))) { | 157 context->MakeReplyMessageContext()))) { |
| 156 return PP_ERROR_INPROGRESS; | 158 return PP_ERROR_INPROGRESS; |
| 157 } | 159 } |
| 158 return PP_OK_COMPLETIONPENDING; | 160 return PP_OK_COMPLETIONPENDING; |
| 159 } | 161 } |
| 160 | 162 |
| 161 int32_t PepperFlashDRMHost::OnHostMsgGetHmonitor( | 163 int32_t PepperFlashDRMHost::OnHostMsgGetHmonitor( |
| 162 ppapi::host::HostMessageContext* context) { | 164 ppapi::host::HostMessageContext* context) { |
| 163 int64_t monitor_id = monitor_finder_->GetMonitor(); | 165 int64_t monitor_id = monitor_finder_->GetMonitor(); |
| 164 if (monitor_id) { | 166 if (monitor_id) { |
| 165 context->reply_msg = PpapiPluginMsg_FlashDRM_GetHmonitorReply(monitor_id); | 167 context->reply_msg = PpapiPluginMsg_FlashDRM_GetHmonitorReply(monitor_id); |
| 166 return PP_OK; | 168 return PP_OK; |
| 167 } else { | 169 } else { |
| 168 return PP_ERROR_FAILED; | 170 return PP_ERROR_FAILED; |
| 169 } | 171 } |
| 170 } | 172 } |
| 171 | 173 |
| 174 int32_t PepperFlashDRMHost::OnHostMsgMonitorIsExternal( |
| 175 ppapi::host::HostMessageContext* context) { |
| 176 int64_t monitor_id = monitor_finder_->GetMonitor(); |
| 177 if (monitor_id) { |
| 178 // TODO() get information about whether monitor is external. |
| 179 context->reply_msg = |
| 180 PpapiPluginMsg_FlashDRM_MonitorIsExternalReply(PP_FALSE); |
| 181 return PP_OK; |
| 182 } else { |
| 183 return PP_ERROR_FAILED; |
| 184 } |
| 185 } |
| 186 |
| 172 void PepperFlashDRMHost::GotDeviceID( | 187 void PepperFlashDRMHost::GotDeviceID( |
| 173 ppapi::host::ReplyMessageContext reply_context, | 188 ppapi::host::ReplyMessageContext reply_context, |
| 174 const std::string& id, | 189 const std::string& id, |
| 175 int32_t result) { | 190 int32_t result) { |
| 176 if (id.empty() && result == PP_OK) { | 191 if (id.empty() && result == PP_OK) { |
| 177 NOTREACHED(); | 192 NOTREACHED(); |
| 178 result = PP_ERROR_FAILED; | 193 result = PP_ERROR_FAILED; |
| 179 } | 194 } |
| 180 reply_context.params.set_result(result); | 195 reply_context.params.set_result(result); |
| 181 host()->SendReply(reply_context, | 196 host()->SendReply(reply_context, |
| 182 PpapiPluginMsg_FlashDRM_GetDeviceIDReply(id)); | 197 PpapiPluginMsg_FlashDRM_GetDeviceIDReply(id)); |
| 183 } | 198 } |
| 184 | 199 |
| 185 } // namespace chrome | 200 } // namespace chrome |
| OLD | NEW |