| 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 "content/renderer/pepper/pepper_device_enumeration_host_helper.h" | 5 #include "content/renderer/pepper/pepper_device_enumeration_host_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 bool return_value = false; | 108 bool return_value = false; |
| 109 *result = InternalHandleResourceMessage(msg, context, &return_value); | 109 *result = InternalHandleResourceMessage(msg, context, &return_value); |
| 110 return return_value; | 110 return return_value; |
| 111 } | 111 } |
| 112 | 112 |
| 113 int32_t PepperDeviceEnumerationHostHelper::InternalHandleResourceMessage( | 113 int32_t PepperDeviceEnumerationHostHelper::InternalHandleResourceMessage( |
| 114 const IPC::Message& msg, | 114 const IPC::Message& msg, |
| 115 HostMessageContext* context, | 115 HostMessageContext* context, |
| 116 bool* handled) { | 116 bool* handled) { |
| 117 *handled = true; | 117 *handled = true; |
| 118 IPC_BEGIN_MESSAGE_MAP(PepperDeviceEnumerationHostHelper, msg) | 118 PPAPI_BEGIN_MESSAGE_MAP(PepperDeviceEnumerationHostHelper, msg) |
| 119 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0( | 119 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0( |
| 120 PpapiHostMsg_DeviceEnumeration_EnumerateDevices, OnEnumerateDevices) | 120 PpapiHostMsg_DeviceEnumeration_EnumerateDevices, OnEnumerateDevices) |
| 121 PPAPI_DISPATCH_HOST_RESOURCE_CALL( | 121 PPAPI_DISPATCH_HOST_RESOURCE_CALL( |
| 122 PpapiHostMsg_DeviceEnumeration_MonitorDeviceChange, OnMonitorDeviceChange) | 122 PpapiHostMsg_DeviceEnumeration_MonitorDeviceChange, |
| 123 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0( | 123 OnMonitorDeviceChange) |
| 124 PpapiHostMsg_DeviceEnumeration_StopMonitoringDeviceChange, | 124 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0( |
| 125 OnStopMonitoringDeviceChange) | 125 PpapiHostMsg_DeviceEnumeration_StopMonitoringDeviceChange, |
| 126 IPC_END_MESSAGE_MAP() | 126 OnStopMonitoringDeviceChange) |
| 127 PPAPI_END_MESSAGE_MAP() |
| 127 | 128 |
| 128 *handled = false; | 129 *handled = false; |
| 129 return PP_ERROR_FAILED; | 130 return PP_ERROR_FAILED; |
| 130 } | 131 } |
| 131 | 132 |
| 132 int32_t PepperDeviceEnumerationHostHelper::OnEnumerateDevices( | 133 int32_t PepperDeviceEnumerationHostHelper::OnEnumerateDevices( |
| 133 HostMessageContext* context) { | 134 HostMessageContext* context) { |
| 134 if (enumerate_devices_context_.is_valid()) | 135 if (enumerate_devices_context_.is_valid()) |
| 135 return PP_ERROR_INPROGRESS; | 136 return PP_ERROR_INPROGRESS; |
| 136 | 137 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 uint32_t callback_id, | 182 uint32_t callback_id, |
| 182 int /* request_id */, | 183 int /* request_id */, |
| 183 const std::vector<ppapi::DeviceRefData>& devices) { | 184 const std::vector<ppapi::DeviceRefData>& devices) { |
| 184 resource_host_->host()->SendUnsolicitedReply( | 185 resource_host_->host()->SendUnsolicitedReply( |
| 185 resource_host_->pp_resource(), | 186 resource_host_->pp_resource(), |
| 186 PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(callback_id, | 187 PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(callback_id, |
| 187 devices)); | 188 devices)); |
| 188 } | 189 } |
| 189 | 190 |
| 190 } // namespace content | 191 } // namespace content |
| OLD | NEW |