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