| Index: ui/display/display_util.cc
|
| diff --git a/ui/display/display_util.cc b/ui/display/display_util.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..3d6266896521d49982a9742213b8c4cafb76610e
|
| --- /dev/null
|
| +++ b/ui/display/display_util.cc
|
| @@ -0,0 +1,41 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "ui/display/display_util.h"
|
| +
|
| +#include "base/macros.h"
|
| +
|
| +namespace ui {
|
| +
|
| +namespace {
|
| +
|
| +struct OutputTypeMapping {
|
| + // Prefix of output name.
|
| + std::string name;
|
| + OutputType type;
|
| +};
|
| +
|
| +const OutputTypeMapping kOutputTypeMapping[] = {
|
| + {"LVDS", OUTPUT_TYPE_INTERNAL},
|
| + {"eDP", OUTPUT_TYPE_INTERNAL},
|
| + {"DSI", OUTPUT_TYPE_INTERNAL},
|
| + {"VGA", OUTPUT_TYPE_VGA},
|
| + {"HDMI", OUTPUT_TYPE_HDMI},
|
| + {"DVI", OUTPUT_TYPE_DVI},
|
| + {"DP", OUTPUT_TYPE_DISPLAYPORT}
|
| +};
|
| +
|
| +} // namespace
|
| +
|
| +OutputType GetOutputTypeFromName(const std::string& name) {
|
| + for (unsigned int i = 0; i < arraysize(kOutputTypeMapping); ++i) {
|
| + if (name.find(kOutputTypeMapping[i].name) == 0) {
|
| + return kOutputTypeMapping[i].type;
|
| + }
|
| + }
|
| +
|
| + return OUTPUT_TYPE_UNKNOWN;
|
| +}
|
| +
|
| +} // namespace ui
|
|
|