1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/display/chromeos/x11/display_util_x11.h"
7 #include "base/macros.h"
13 struct DisplayConnectionTypeMapping
{
14 // Prefix of output name.
16 DisplayConnectionType type
;
19 const DisplayConnectionTypeMapping kDisplayConnectionTypeMapping
[] = {
20 {"LVDS", DISPLAY_CONNECTION_TYPE_INTERNAL
},
21 {"eDP", DISPLAY_CONNECTION_TYPE_INTERNAL
},
22 {"DSI", DISPLAY_CONNECTION_TYPE_INTERNAL
},
23 {"VGA", DISPLAY_CONNECTION_TYPE_VGA
},
24 {"HDMI", DISPLAY_CONNECTION_TYPE_HDMI
},
25 {"DVI", DISPLAY_CONNECTION_TYPE_DVI
},
26 {"DP", DISPLAY_CONNECTION_TYPE_DISPLAYPORT
}};
30 DisplayConnectionType
GetDisplayConnectionTypeFromName(
31 const std::string
& name
) {
32 for (unsigned int i
= 0; i
< arraysize(kDisplayConnectionTypeMapping
); ++i
) {
33 if (name
.find(kDisplayConnectionTypeMapping
[i
].name
) == 0) {
34 return kDisplayConnectionTypeMapping
[i
].type
;
38 return DISPLAY_CONNECTION_TYPE_UNKNOWN
;