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

Side by Side Diff: ui/display/chromeos/x11/display_util_x11.cc

Issue 2127373006: Use base::StartWith() in more places when appropriate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, resolve conflict Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 "ui/display/chromeos/x11/display_util_x11.h" 5 #include "ui/display/chromeos/x11/display_util_x11.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/strings/string_util.h"
8 9
9 namespace ui { 10 namespace ui {
10 11
11 namespace { 12 namespace {
12 13
13 struct DisplayConnectionTypeMapping { 14 struct DisplayConnectionTypeMapping {
14 // Prefix of output name. 15 // Prefix of output name.
15 const char* name; 16 const char* name;
16 DisplayConnectionType type; 17 DisplayConnectionType type;
17 }; 18 };
18 19
19 const DisplayConnectionTypeMapping kDisplayConnectionTypeMapping[] = { 20 const DisplayConnectionTypeMapping kDisplayConnectionTypeMapping[] = {
20 {"LVDS", DISPLAY_CONNECTION_TYPE_INTERNAL}, 21 {"LVDS", DISPLAY_CONNECTION_TYPE_INTERNAL},
21 {"eDP", DISPLAY_CONNECTION_TYPE_INTERNAL}, 22 {"eDP", DISPLAY_CONNECTION_TYPE_INTERNAL},
22 {"DSI", DISPLAY_CONNECTION_TYPE_INTERNAL}, 23 {"DSI", DISPLAY_CONNECTION_TYPE_INTERNAL},
23 {"VGA", DISPLAY_CONNECTION_TYPE_VGA}, 24 {"VGA", DISPLAY_CONNECTION_TYPE_VGA},
24 {"HDMI", DISPLAY_CONNECTION_TYPE_HDMI}, 25 {"HDMI", DISPLAY_CONNECTION_TYPE_HDMI},
25 {"DVI", DISPLAY_CONNECTION_TYPE_DVI}, 26 {"DVI", DISPLAY_CONNECTION_TYPE_DVI},
26 {"DP", DISPLAY_CONNECTION_TYPE_DISPLAYPORT}}; 27 {"DP", DISPLAY_CONNECTION_TYPE_DISPLAYPORT}};
27 28
28 } // namespace 29 } // namespace
29 30
30 DisplayConnectionType GetDisplayConnectionTypeFromName( 31 DisplayConnectionType GetDisplayConnectionTypeFromName(
31 const std::string& name) { 32 const std::string& name) {
32 for (unsigned int i = 0; i < arraysize(kDisplayConnectionTypeMapping); ++i) { 33 for (unsigned int i = 0; i < arraysize(kDisplayConnectionTypeMapping); ++i) {
33 if (name.find(kDisplayConnectionTypeMapping[i].name) == 0) { 34 if (base::StartsWith(name, kDisplayConnectionTypeMapping[i].name,
35 base::CompareCase::SENSITIVE)) {
34 return kDisplayConnectionTypeMapping[i].type; 36 return kDisplayConnectionTypeMapping[i].type;
35 } 37 }
36 } 38 }
37 39
38 return DISPLAY_CONNECTION_TYPE_UNKNOWN; 40 return DISPLAY_CONNECTION_TYPE_UNKNOWN;
39 } 41 }
40 42
41 } // namespace ui 43 } // namespace ui
OLDNEW
« no previous file with comments | « tools/android/forwarder2/host_forwarder_main.cc ('k') | ui/message_center/views/notification_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698