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

Side by Side Diff: ui/display/util/x11/edid_parser_x11.cc

Issue 1636153002: Give user ability to file a feedback report from the display error notification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: oshima's comments Created 4 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 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/util/x11/edid_parser_x11.h" 5 #include "ui/display/util/x11/edid_parser_x11.h"
6 6
7 #include <X11/extensions/Xrandr.h> 7 #include <X11/extensions/Xrandr.h>
8 #include <X11/Xatom.h> 8 #include <X11/Xatom.h>
9 #include <X11/Xlib.h> 9 #include <X11/Xlib.h>
10 10
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 &nitems, 68 &nitems,
69 &bytes_after, 69 &bytes_after,
70 &prop); 70 &prop);
71 DCHECK_EQ(XA_INTEGER, actual_type); 71 DCHECK_EQ(XA_INTEGER, actual_type);
72 DCHECK_EQ(8, actual_format); 72 DCHECK_EQ(8, actual_format);
73 edid->assign(prop, prop + nitems); 73 edid->assign(prop, prop + nitems);
74 XFree(prop); 74 XFree(prop);
75 return true; 75 return true;
76 } 76 }
77 77
78 // Gets some useful data from the specified output device, such like
79 // manufacturer's ID, product code, and human readable name. Returns false if it
80 // fails to get those data and doesn't touch manufacturer ID/product code/name.
81 // nullptr can be passed for unwanted output parameters.
82 bool GetOutputDeviceData(XID output,
83 uint16_t* manufacturer_id,
84 std::string* human_readable_name) {
85 std::vector<uint8_t> edid;
86 if (!GetEDIDProperty(output, &edid))
87 return false;
88
89 return ParseOutputDeviceData(edid, manufacturer_id, nullptr,
90 human_readable_name, nullptr, nullptr);
91 }
92
93 } // namespace 78 } // namespace
94 79
95 bool GetDisplayId(XID output_id, 80 EDIDParserX11::EDIDParserX11(XID output_id)
96 uint8_t output_index, 81 : output_id_(output_id) {
97 int64_t* display_id_out) { 82 GetEDIDProperty(output_id_, &edid_);
98 std::vector<uint8_t> edid; 83 }
99 if (!GetEDIDProperty(output_id, &edid)) 84
85 EDIDParserX11::~EDIDParserX11() {
86 }
87
88 bool EDIDParserX11::GetDisplayId(uint8_t index, int64_t* out_display_id) const {
89 if (edid_.empty())
100 return false; 90 return false;
101 91
102 bool result = 92 return GetDisplayIdFromEDID(edid_, index, out_display_id, nullptr);
103 GetDisplayIdFromEDID(edid, output_index, display_id_out, nullptr);
104 return result;
105 } 93 }
106 94
107 std::string GetDisplayName(RROutput output) { 95 std::string EDIDParserX11::GetDisplayName() const {
108 std::string display_name; 96 std::string display_name;
109 GetOutputDeviceData(output, nullptr, &display_name); 97 ParseOutputDeviceData(edid_, nullptr, nullptr, &display_name, nullptr,
98 nullptr);
110 return display_name; 99 return display_name;
111 } 100 }
112 101
113 bool GetOutputOverscanFlag(RROutput output, bool* flag) { 102 bool EDIDParserX11::GetOutputOverscanFlag(bool* out_flag) const {
114 std::vector<uint8_t> edid; 103 if (edid_.empty())
115 if (!GetEDIDProperty(output, &edid))
116 return false; 104 return false;
117 105
118 bool found = ParseOutputOverscanFlag(edid, flag); 106 return ParseOutputOverscanFlag(edid_, out_flag);
119 return found;
120 } 107 }
121 108
122 } // namespace ui 109 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698