| 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.h" | 10 #include "base/message_loop.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 PpapiHostMsg_DeviceEnumeration_StopMonitoringDeviceChange, | 126 PpapiHostMsg_DeviceEnumeration_StopMonitoringDeviceChange, |
| 127 OnStopMonitoringDeviceChange) | 127 OnStopMonitoringDeviceChange) |
| 128 IPC_END_MESSAGE_MAP() | 128 IPC_END_MESSAGE_MAP() |
| 129 | 129 |
| 130 *handled = false; | 130 *handled = false; |
| 131 return PP_ERROR_FAILED; | 131 return PP_ERROR_FAILED; |
| 132 } | 132 } |
| 133 | 133 |
| 134 int32_t PepperDeviceEnumerationHostHelper::OnEnumerateDevices( | 134 int32_t PepperDeviceEnumerationHostHelper::OnEnumerateDevices( |
| 135 HostMessageContext* context) { | 135 HostMessageContext* context) { |
| 136 if (enumerate_devices_context_.get()) | 136 if (enumerate_devices_context_) |
| 137 return PP_ERROR_INPROGRESS; | 137 return PP_ERROR_INPROGRESS; |
| 138 | 138 |
| 139 enumerate_.reset(new ScopedRequest( | 139 enumerate_.reset(new ScopedRequest( |
| 140 this, | 140 this, |
| 141 base::Bind(&PepperDeviceEnumerationHostHelper::OnEnumerateDevicesComplete, | 141 base::Bind(&PepperDeviceEnumerationHostHelper::OnEnumerateDevicesComplete, |
| 142 base::Unretained(this)))); | 142 base::Unretained(this)))); |
| 143 if (!enumerate_->requested()) | 143 if (!enumerate_->requested()) |
| 144 return PP_ERROR_FAILED; | 144 return PP_ERROR_FAILED; |
| 145 | 145 |
| 146 enumerate_devices_context_.reset( | 146 enumerate_devices_context_.reset( |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 bool succeeded, | 188 bool succeeded, |
| 189 const std::vector<ppapi::DeviceRefData>& devices) { | 189 const std::vector<ppapi::DeviceRefData>& devices) { |
| 190 resource_host_->host()->SendUnsolicitedReply( | 190 resource_host_->host()->SendUnsolicitedReply( |
| 191 resource_host_->pp_resource(), | 191 resource_host_->pp_resource(), |
| 192 PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange( | 192 PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange( |
| 193 callback_id, | 193 callback_id, |
| 194 succeeded ? devices : std::vector<ppapi::DeviceRefData>())); | 194 succeeded ? devices : std::vector<ppapi::DeviceRefData>())); |
| 195 } | 195 } |
| 196 | 196 |
| 197 } // namespace content | 197 } // namespace content |
| OLD | NEW |