| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "media/capture/video/video_capture_device_descriptor.h" | 5 #include "media/capture/video/video_capture_device_descriptor.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "extensions/strings/grit/extensions_strings.h" |
| 9 #include "ui/base/l10n/l10n_util.h" |
| 8 | 10 |
| 9 namespace media { | 11 namespace media { |
| 10 | 12 |
| 11 VideoCaptureDeviceDescriptor::VideoCaptureDeviceDescriptor() | 13 VideoCaptureDeviceDescriptor::VideoCaptureDeviceDescriptor() |
| 12 : facing(VideoFacingMode::MEDIA_VIDEO_FACING_NONE), | 14 : facing(VideoFacingMode::MEDIA_VIDEO_FACING_NONE), |
| 13 capture_api(VideoCaptureApi::UNKNOWN), | 15 capture_api(VideoCaptureApi::UNKNOWN), |
| 14 transport_type(VideoCaptureTransportType::OTHER_TRANSPORT) {} | 16 transport_type(VideoCaptureTransportType::OTHER_TRANSPORT) {} |
| 15 | 17 |
| 16 VideoCaptureDeviceDescriptor::VideoCaptureDeviceDescriptor( | 18 VideoCaptureDeviceDescriptor::VideoCaptureDeviceDescriptor( |
| 17 const std::string& display_name, | 19 const std::string& display_name, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 return "Unknown API"; | 89 return "Unknown API"; |
| 88 } | 90 } |
| 89 } | 91 } |
| 90 | 92 |
| 91 std::string VideoCaptureDeviceDescriptor::GetNameAndModel() const { | 93 std::string VideoCaptureDeviceDescriptor::GetNameAndModel() const { |
| 92 if (model_id.empty()) | 94 if (model_id.empty()) |
| 93 return display_name; | 95 return display_name; |
| 94 return display_name + " (" + model_id + ")"; | 96 return display_name + " (" + model_id + ")"; |
| 95 } | 97 } |
| 96 | 98 |
| 99 std::string VideoCaptureDeviceDescriptor::GetHumanReadableName() const { |
| 100 std::string facing_info; |
| 101 switch (facing) { |
| 102 case MEDIA_VIDEO_FACING_USER: |
| 103 facing_info = l10n_util::GetStringUTF8(IDS_CAMERA_FACING_USER); |
| 104 break; |
| 105 case MEDIA_VIDEO_FACING_ENVIRONMENT: |
| 106 facing_info = l10n_util::GetStringUTF8(IDS_CAMERA_FACING_ENVIRONMENT); |
| 107 break; |
| 108 case MEDIA_VIDEO_FACING_NONE: |
| 109 case NUM_MEDIA_VIDEO_FACING_MODES: |
| 110 break; |
| 111 } |
| 112 |
| 113 if (facing_info.empty()) |
| 114 return GetNameAndModel(); |
| 115 return GetNameAndModel() + " (" + facing_info + ")"; |
| 116 } |
| 117 |
| 97 } // namespace media | 118 } // namespace media |
| OLD | NEW |