| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 void PepperDeviceEnumerationEventHandler::OnDeviceOpenFailed(int request_id) { | 87 void PepperDeviceEnumerationEventHandler::OnDeviceOpenFailed(int request_id) { |
| 88 NotifyDeviceOpened(request_id, false, ""); | 88 NotifyDeviceOpened(request_id, false, ""); |
| 89 } | 89 } |
| 90 | 90 |
| 91 // static | 91 // static |
| 92 media_stream::MediaStreamType | 92 media_stream::MediaStreamType |
| 93 PepperDeviceEnumerationEventHandler::FromPepperDeviceType( | 93 PepperDeviceEnumerationEventHandler::FromPepperDeviceType( |
| 94 PP_DeviceType_Dev type) { | 94 PP_DeviceType_Dev type) { |
| 95 switch (type) { | 95 switch (type) { |
| 96 case PP_DEVICETYPE_DEV_INVALID: | 96 case PP_DEVICETYPE_DEV_INVALID: |
| 97 return MEDIA_STREAM_DEVICE_TYPE_NO_SERVICE; | 97 return MEDIA_NO_SERVICE; |
| 98 case PP_DEVICETYPE_DEV_AUDIOCAPTURE: | 98 case PP_DEVICETYPE_DEV_AUDIOCAPTURE: |
| 99 return MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE; | 99 return MEDIA_DEVICE_AUDIO_CAPTURE; |
| 100 case PP_DEVICETYPE_DEV_VIDEOCAPTURE: | 100 case PP_DEVICETYPE_DEV_VIDEOCAPTURE: |
| 101 return MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE; | 101 return MEDIA_DEVICE_VIDEO_CAPTURE; |
| 102 default: | 102 default: |
| 103 NOTREACHED(); | 103 NOTREACHED(); |
| 104 return MEDIA_STREAM_DEVICE_TYPE_NO_SERVICE; | 104 return MEDIA_NO_SERVICE; |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 | 107 |
| 108 // static | 108 // static |
| 109 PP_DeviceType_Dev PepperDeviceEnumerationEventHandler::FromMediaStreamType( | 109 PP_DeviceType_Dev PepperDeviceEnumerationEventHandler::FromMediaStreamType( |
| 110 media_stream::MediaStreamType type) { | 110 media_stream::MediaStreamType type) { |
| 111 switch (type) { | 111 switch (type) { |
| 112 case MEDIA_STREAM_DEVICE_TYPE_NO_SERVICE: | 112 case MEDIA_NO_SERVICE: |
| 113 return PP_DEVICETYPE_DEV_INVALID; | 113 return PP_DEVICETYPE_DEV_INVALID; |
| 114 case MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE: | 114 case MEDIA_DEVICE_AUDIO_CAPTURE: |
| 115 return PP_DEVICETYPE_DEV_AUDIOCAPTURE; | 115 return PP_DEVICETYPE_DEV_AUDIOCAPTURE; |
| 116 case MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE: | 116 case MEDIA_DEVICE_VIDEO_CAPTURE: |
| 117 return PP_DEVICETYPE_DEV_VIDEOCAPTURE; | 117 return PP_DEVICETYPE_DEV_VIDEOCAPTURE; |
| 118 default: | 118 default: |
| 119 NOTREACHED(); | 119 NOTREACHED(); |
| 120 return PP_DEVICETYPE_DEV_INVALID; | 120 return PP_DEVICETYPE_DEV_INVALID; |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 | 123 |
| 124 void PepperDeviceEnumerationEventHandler::NotifyDevicesEnumerated( | 124 void PepperDeviceEnumerationEventHandler::NotifyDevicesEnumerated( |
| 125 int request_id, | 125 int request_id, |
| 126 bool succeeded, | 126 bool succeeded, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 157 return; | 157 return; |
| 158 } | 158 } |
| 159 | 159 |
| 160 PepperPluginDelegateImpl::OpenDeviceCallback callback = iter->second; | 160 PepperPluginDelegateImpl::OpenDeviceCallback callback = iter->second; |
| 161 open_callbacks_.erase(iter); | 161 open_callbacks_.erase(iter); |
| 162 | 162 |
| 163 callback.Run(request_id, succeeded, label); | 163 callback.Run(request_id, succeeded, label); |
| 164 } | 164 } |
| 165 | 165 |
| 166 } // namespace content | 166 } // namespace content |
| OLD | NEW |