Home | History | Annotate | Download | only in x11
      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.
      4 
      5 #include "ui/display/chromeos/x11/display_util_x11.h"
      6 
      7 #include "base/macros.h"
      8 
      9 namespace ui {
     10 
     11 namespace {
     12 
     13 struct DisplayConnectionTypeMapping {
     14   // Prefix of output name.
     15   const char* name;
     16   DisplayConnectionType type;
     17 };
     18 
     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}};
     27 
     28 }  // namespace
     29 
     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;
     35     }
     36   }
     37 
     38   return DISPLAY_CONNECTION_TYPE_UNKNOWN;
     39 }
     40 
     41 }  // namespace ui
     42