| 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_event_handler.h" | 5 #include "content/renderer/pepper/pepper_device_enumeration_event_handler.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ppapi/shared_impl/ppb_device_ref_shared.h" | 8 #include "ppapi/shared_impl/ppb_device_ref_shared.h" |
| 9 | 9 |
| 10 namespace content { | 10 namespace content { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 DCHECK(enumerate_callbacks_.empty()); | 31 DCHECK(enumerate_callbacks_.empty()); |
| 32 DCHECK(open_callbacks_.empty()); | 32 DCHECK(open_callbacks_.empty()); |
| 33 } | 33 } |
| 34 | 34 |
| 35 int PepperDeviceEnumerationEventHandler::RegisterEnumerateDevicesCallback( | 35 int PepperDeviceEnumerationEventHandler::RegisterEnumerateDevicesCallback( |
| 36 const webkit::ppapi::PluginDelegate::EnumerateDevicesCallback& callback) { | 36 const webkit::ppapi::PluginDelegate::EnumerateDevicesCallback& callback) { |
| 37 enumerate_callbacks_[next_id_] = callback; | 37 enumerate_callbacks_[next_id_] = callback; |
| 38 return next_id_++; | 38 return next_id_++; |
| 39 } | 39 } |
| 40 | 40 |
| 41 int PepperDeviceEnumerationEventHandler::UnregisterEnumerateDevicesCallback( |
| 42 int request_id) { |
| 43 enumerate_callbacks_.erase(request_id); |
| 44 return request_id; |
| 45 } |
| 46 |
| 41 int PepperDeviceEnumerationEventHandler::RegisterOpenDeviceCallback( | 47 int PepperDeviceEnumerationEventHandler::RegisterOpenDeviceCallback( |
| 42 const PepperPluginDelegateImpl::OpenDeviceCallback& callback) { | 48 const PepperPluginDelegateImpl::OpenDeviceCallback& callback) { |
| 43 open_callbacks_[next_id_] = callback; | 49 open_callbacks_[next_id_] = callback; |
| 44 return next_id_++; | 50 return next_id_++; |
| 45 } | 51 } |
| 46 | 52 |
| 47 void PepperDeviceEnumerationEventHandler::OnStreamGenerated( | 53 void PepperDeviceEnumerationEventHandler::OnStreamGenerated( |
| 48 int request_id, | 54 int request_id, |
| 49 const std::string& label, | 55 const std::string& label, |
| 50 const media_stream::StreamDeviceInfoArray& audio_device_array, | 56 const media_stream::StreamDeviceInfoArray& audio_device_array, |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 return; | 162 return; |
| 157 } | 163 } |
| 158 | 164 |
| 159 PepperPluginDelegateImpl::OpenDeviceCallback callback = iter->second; | 165 PepperPluginDelegateImpl::OpenDeviceCallback callback = iter->second; |
| 160 open_callbacks_.erase(iter); | 166 open_callbacks_.erase(iter); |
| 161 | 167 |
| 162 callback.Run(request_id, succeeded, label); | 168 callback.Run(request_id, succeeded, label); |
| 163 } | 169 } |
| 164 | 170 |
| 165 } // namespace content | 171 } // namespace content |
| OLD | NEW |