Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Unified Diff: ui/display/display_util.cc

Issue 187073002: Refactoring display configuration state to allow generic state objects (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« ui/display/display_util.h ('K') | « ui/display/display_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« ui/display/display_util.h ('K') | « ui/display/display_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698