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

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

Issue 192483007: Move chromeos/display/* to ui/display/chromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Include display.gyp into ChromeOS builds only Created 6 years, 9 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 | Annotate | Revision Log
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 "chromeos/display/native_display_delegate_x11.h" 5 #include "ui/display/chromeos/x11/native_display_delegate_x11.h"
6 6
7 #include <X11/Xatom.h> 7 #include <X11/Xatom.h>
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 #include <X11/extensions/dpms.h> 9 #include <X11/extensions/dpms.h>
10 #include <X11/extensions/Xrandr.h> 10 #include <X11/extensions/Xrandr.h>
11 #include <X11/extensions/XInput2.h> 11 #include <X11/extensions/XInput2.h>
12 12
13 #include <utility> 13 #include <utility>
14 14
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
17 #include "base/message_loop/message_pump_x11.h" 17 #include "base/message_loop/message_pump_x11.h"
18 #include "base/x11/edid_parser_x11.h" 18 #include "base/x11/edid_parser_x11.h"
19 #include "base/x11/x11_error_tracker.h" 19 #include "base/x11/x11_error_tracker.h"
20 #include "chromeos/display/native_display_event_dispatcher_x11.h" 20 #include "ui/display/chromeos/native_display_observer.h"
21 #include "chromeos/display/native_display_observer.h" 21 #include "ui/display/chromeos/x11/display_util.h"
22 #include "chromeos/display/output_util.h" 22 #include "ui/display/chromeos/x11/native_display_event_dispatcher_x11.h"
23 23
24 namespace chromeos { 24 namespace ui {
25 25
26 namespace { 26 namespace {
27 27
28 // DPI measurements. 28 // DPI measurements.
29 const float kMmInInch = 25.4; 29 const float kMmInInch = 25.4;
30 const float kDpi96 = 96.0; 30 const float kDpi96 = 96.0;
31 const float kPixelsToMmScale = kMmInInch / kDpi96; 31 const float kPixelsToMmScale = kMmInInch / kDpi96;
32 32
33 // Prefixes of output name
34 const char kOutputName_VGA[] = "VGA";
35 const char kOutputName_HDMI[] = "HDMI";
36 const char kOutputName_DVI[] = "DVI";
37 const char kOutputName_DisplayPort[] = "DP";
38
39 const char kContentProtectionAtomName[] = "Content Protection"; 33 const char kContentProtectionAtomName[] = "Content Protection";
40 const char kProtectionUndesiredAtomName[] = "Undesired"; 34 const char kProtectionUndesiredAtomName[] = "Undesired";
41 const char kProtectionDesiredAtomName[] = "Desired"; 35 const char kProtectionDesiredAtomName[] = "Desired";
42 const char kProtectionEnabledAtomName[] = "Enabled"; 36 const char kProtectionEnabledAtomName[] = "Enabled";
43 37
44 bool IsInternalOutput(const XRROutputInfo* output_info) {
45 return IsInternalOutputName(std::string(output_info->name));
46 }
47
48 RRMode GetOutputNativeMode(const XRROutputInfo* output_info) { 38 RRMode GetOutputNativeMode(const XRROutputInfo* output_info) {
49 return output_info->nmode > 0 ? output_info->modes[0] : None; 39 return output_info->nmode > 0 ? output_info->modes[0] : None;
50 } 40 }
51 41
52 } // namespace 42 } // namespace
53 43
54 //////////////////////////////////////////////////////////////////////////////// 44 ////////////////////////////////////////////////////////////////////////////////
55 // NativeDisplayDelegateX11::HelperDelegateX11 45 // NativeDisplayDelegateX11::HelperDelegateX11
56 46
57 class NativeDisplayDelegateX11::HelperDelegateX11 47 class NativeDisplayDelegateX11::HelperDelegateX11
58 : public NativeDisplayDelegateX11::HelperDelegate { 48 : public NativeDisplayDelegateX11::HelperDelegate {
59 public: 49 public:
60 HelperDelegateX11(NativeDisplayDelegateX11* delegate) 50 HelperDelegateX11(NativeDisplayDelegateX11* delegate) : delegate_(delegate) {}
61 : delegate_(delegate) {}
62 virtual ~HelperDelegateX11() {} 51 virtual ~HelperDelegateX11() {}
63 52
64 // NativeDisplayDelegateX11::HelperDelegate overrides: 53 // NativeDisplayDelegateX11::HelperDelegate overrides:
65 virtual void UpdateXRandRConfiguration( 54 virtual void UpdateXRandRConfiguration(const base::NativeEvent& event)
66 const base::NativeEvent& event) OVERRIDE { 55 OVERRIDE {
67 XRRUpdateConfiguration(event); 56 XRRUpdateConfiguration(event);
68 } 57 }
69 virtual const std::vector<OutputConfigurator::OutputSnapshot>& 58 virtual const std::vector<OutputConfigurator::OutputSnapshot>&
70 GetCachedOutputs() const OVERRIDE { 59 GetCachedOutputs() const OVERRIDE {
71 return delegate_->cached_outputs_; 60 return delegate_->cached_outputs_;
72 } 61 }
73 virtual void NotifyDisplayObservers() OVERRIDE { 62 virtual void NotifyDisplayObservers() OVERRIDE {
74 FOR_EACH_OBSERVER(NativeDisplayObserver, 63 FOR_EACH_OBSERVER(
75 delegate_->observers_, 64 NativeDisplayObserver, delegate_->observers_, OnConfigurationChanged());
76 OnConfigurationChanged());
77 } 65 }
78 66
79 private: 67 private:
80 NativeDisplayDelegateX11* delegate_; 68 NativeDisplayDelegateX11* delegate_;
81 69
82 DISALLOW_COPY_AND_ASSIGN(HelperDelegateX11); 70 DISALLOW_COPY_AND_ASSIGN(HelperDelegateX11);
83 }; 71 };
84 72
85 //////////////////////////////////////////////////////////////////////////////// 73 ////////////////////////////////////////////////////////////////////////////////
86 // NativeDisplayDelegateX11::MessagePumpObserverX11 74 // NativeDisplayDelegateX11::MessagePumpObserverX11
87 75
88 class NativeDisplayDelegateX11::MessagePumpObserverX11 76 class NativeDisplayDelegateX11::MessagePumpObserverX11
89 : public base::MessagePumpObserver { 77 : public base::MessagePumpObserver {
90 public: 78 public:
91 MessagePumpObserverX11(HelperDelegate* delegate); 79 MessagePumpObserverX11(HelperDelegate* delegate);
92 virtual ~MessagePumpObserverX11(); 80 virtual ~MessagePumpObserverX11();
93 81
94 // base::MessagePumpObserver overrides: 82 // base::MessagePumpObserver overrides:
95 virtual base::EventStatus WillProcessEvent( 83 virtual base::EventStatus WillProcessEvent(const base::NativeEvent& event)
96 const base::NativeEvent& event) OVERRIDE; 84 OVERRIDE;
97 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE; 85 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE;
98 86
99 private: 87 private:
100 HelperDelegate* delegate_; // Not owned. 88 HelperDelegate* delegate_; // Not owned.
101 89
102 DISALLOW_COPY_AND_ASSIGN(MessagePumpObserverX11); 90 DISALLOW_COPY_AND_ASSIGN(MessagePumpObserverX11);
103 }; 91 };
104 92
105 NativeDisplayDelegateX11::MessagePumpObserverX11::MessagePumpObserverX11( 93 NativeDisplayDelegateX11::MessagePumpObserverX11::MessagePumpObserverX11(
106 HelperDelegate* delegate) : delegate_(delegate) {} 94 HelperDelegate* delegate)
95 : delegate_(delegate) {}
107 96
108 NativeDisplayDelegateX11::MessagePumpObserverX11::~MessagePumpObserverX11() {} 97 NativeDisplayDelegateX11::MessagePumpObserverX11::~MessagePumpObserverX11() {}
109 98
110 base::EventStatus 99 base::EventStatus
111 NativeDisplayDelegateX11::MessagePumpObserverX11::WillProcessEvent( 100 NativeDisplayDelegateX11::MessagePumpObserverX11::WillProcessEvent(
112 const base::NativeEvent& event) { 101 const base::NativeEvent& event) {
113 // XI_HierarchyChanged events are special. There is no window associated with 102 // XI_HierarchyChanged events are special. There is no window associated with
114 // these events. So process them directly from here. 103 // these events. So process them directly from here.
115 if (event->type == GenericEvent && 104 if (event->type == GenericEvent &&
116 event->xgeneric.evtype == XI_HierarchyChanged) { 105 event->xgeneric.evtype == XI_HierarchyChanged) {
117 VLOG(1) << "Received XI_HierarchyChanged event"; 106 VLOG(1) << "Received XI_HierarchyChanged event";
118 // Defer configuring outputs to not stall event processing. 107 // Defer configuring outputs to not stall event processing.
119 // This also takes care of same event being received twice. 108 // This also takes care of same event being received twice.
120 delegate_->NotifyDisplayObservers(); 109 delegate_->NotifyDisplayObservers();
121 } 110 }
122 111
123 return base::EVENT_CONTINUE; 112 return base::EVENT_CONTINUE;
124 } 113 }
125 114
126 void NativeDisplayDelegateX11::MessagePumpObserverX11::DidProcessEvent( 115 void NativeDisplayDelegateX11::MessagePumpObserverX11::DidProcessEvent(
127 const base::NativeEvent& event) { 116 const base::NativeEvent& event) {}
128 }
129 117
130 //////////////////////////////////////////////////////////////////////////////// 118 ////////////////////////////////////////////////////////////////////////////////
131 // NativeDisplayDelegateX11 implementation: 119 // NativeDisplayDelegateX11 implementation:
132 120
133 NativeDisplayDelegateX11::NativeDisplayDelegateX11() 121 NativeDisplayDelegateX11::NativeDisplayDelegateX11()
134 : display_(base::MessagePumpX11::GetDefaultXDisplay()), 122 : display_(base::MessagePumpX11::GetDefaultXDisplay()),
135 window_(DefaultRootWindow(display_)), 123 window_(DefaultRootWindow(display_)),
136 screen_(NULL) {} 124 screen_(NULL) {}
137 125
138 NativeDisplayDelegateX11::~NativeDisplayDelegateX11() { 126 NativeDisplayDelegateX11::~NativeDisplayDelegateX11() {
139 base::MessagePumpX11::Current()->RemoveDispatcherForRootWindow( 127 base::MessagePumpX11::Current()->RemoveDispatcherForRootWindow(
140 message_pump_dispatcher_.get()); 128 message_pump_dispatcher_.get());
141 base::MessagePumpX11::Current()->RemoveObserver(message_pump_observer_.get()); 129 base::MessagePumpX11::Current()->RemoveObserver(message_pump_observer_.get());
142 } 130 }
143 131
144 void NativeDisplayDelegateX11::Initialize() { 132 void NativeDisplayDelegateX11::Initialize() {
145 int error_base_ignored = 0; 133 int error_base_ignored = 0;
146 int xrandr_event_base = 0; 134 int xrandr_event_base = 0;
147 XRRQueryExtension(display_, &xrandr_event_base, &error_base_ignored); 135 XRRQueryExtension(display_, &xrandr_event_base, &error_base_ignored);
148 136
149 helper_delegate_.reset(new HelperDelegateX11(this)); 137 helper_delegate_.reset(new HelperDelegateX11(this));
150 message_pump_dispatcher_.reset(new NativeDisplayEventDispatcherX11( 138 message_pump_dispatcher_.reset(new NativeDisplayEventDispatcherX11(
151 helper_delegate_.get(), xrandr_event_base)); 139 helper_delegate_.get(), xrandr_event_base));
152 message_pump_observer_.reset(new MessagePumpObserverX11( 140 message_pump_observer_.reset(
153 helper_delegate_.get())); 141 new MessagePumpObserverX11(helper_delegate_.get()));
154 142
155 base::MessagePumpX11::Current()->AddDispatcherForRootWindow( 143 base::MessagePumpX11::Current()->AddDispatcherForRootWindow(
156 message_pump_dispatcher_.get()); 144 message_pump_dispatcher_.get());
157 // We can't do this with a root window listener because XI_HierarchyChanged 145 // We can't do this with a root window listener because XI_HierarchyChanged
158 // messages don't have a target window. 146 // messages don't have a target window.
159 base::MessagePumpX11::Current()->AddObserver(message_pump_observer_.get()); 147 base::MessagePumpX11::Current()->AddObserver(message_pump_observer_.get());
160 } 148 }
161 149
162 void NativeDisplayDelegateX11::GrabServer() { 150 void NativeDisplayDelegateX11::GrabServer() {
163 CHECK(!screen_) << "Server already grabbed"; 151 CHECK(!screen_) << "Server already grabbed";
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 << " current_mode=" << output.current_mode; 205 << " current_mode=" << output.current_mode;
218 cached_outputs_.push_back(output); 206 cached_outputs_.push_back(output);
219 } 207 }
220 XRRFreeOutputInfo(output_info); 208 XRRFreeOutputInfo(output_info);
221 } 209 }
222 210
223 return cached_outputs_; 211 return cached_outputs_;
224 } 212 }
225 213
226 void NativeDisplayDelegateX11::AddMode( 214 void NativeDisplayDelegateX11::AddMode(
227 const OutputConfigurator::OutputSnapshot& output, RRMode mode) { 215 const OutputConfigurator::OutputSnapshot& output,
216 RRMode mode) {
228 CHECK(screen_) << "Server not grabbed"; 217 CHECK(screen_) << "Server not grabbed";
229 VLOG(1) << "AddOutputMode: output=" << output.output << " mode=" << mode; 218 VLOG(1) << "AddOutputMode: output=" << output.output << " mode=" << mode;
230 XRRAddOutputMode(display_, output.output, mode); 219 XRRAddOutputMode(display_, output.output, mode);
231 } 220 }
232 221
233 bool NativeDisplayDelegateX11::Configure( 222 bool NativeDisplayDelegateX11::Configure(
234 const OutputConfigurator::OutputSnapshot& output, 223 const OutputConfigurator::OutputSnapshot& output,
235 RRMode mode, 224 RRMode mode,
236 int x, 225 int x,
237 int y) { 226 int y) {
238 return ConfigureCrtc(output.crtc, mode, output.output, x, y); 227 return ConfigureCrtc(output.crtc, mode, output.output, x, y);
239 } 228 }
240 229
241 bool NativeDisplayDelegateX11::ConfigureCrtc( 230 bool NativeDisplayDelegateX11::ConfigureCrtc(RRCrtc crtc,
242 RRCrtc crtc, 231 RRMode mode,
243 RRMode mode, 232 RROutput output,
244 RROutput output, 233 int x,
245 int x, 234 int y) {
246 int y) {
247 CHECK(screen_) << "Server not grabbed"; 235 CHECK(screen_) << "Server not grabbed";
248 VLOG(1) << "ConfigureCrtc: crtc=" << crtc << " mode=" << mode 236 VLOG(1) << "ConfigureCrtc: crtc=" << crtc << " mode=" << mode
249 << " output=" << output << " x=" << x << " y=" << y; 237 << " output=" << output << " x=" << x << " y=" << y;
250 // Xrandr.h is full of lies. XRRSetCrtcConfig() is defined as returning a 238 // Xrandr.h is full of lies. XRRSetCrtcConfig() is defined as returning a
251 // Status, which is typically 0 for failure and 1 for success. In 239 // Status, which is typically 0 for failure and 1 for success. In
252 // actuality it returns a RRCONFIGSTATUS, which uses 0 for success. 240 // actuality it returns a RRCONFIGSTATUS, which uses 0 for success.
253 return XRRSetCrtcConfig(display_, 241 return XRRSetCrtcConfig(display_,
254 screen_, 242 screen_,
255 crtc, 243 crtc,
256 CurrentTime, 244 CurrentTime,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 RROutput id, 300 RROutput id,
313 XRROutputInfo* info, 301 XRROutputInfo* info,
314 RRCrtc* last_used_crtc, 302 RRCrtc* last_used_crtc,
315 int index) { 303 int index) {
316 OutputConfigurator::OutputSnapshot output; 304 OutputConfigurator::OutputSnapshot output;
317 output.output = id; 305 output.output = id;
318 output.width_mm = info->mm_width; 306 output.width_mm = info->mm_width;
319 output.height_mm = info->mm_height; 307 output.height_mm = info->mm_height;
320 output.has_display_id = base::GetDisplayId(id, index, &output.display_id); 308 output.has_display_id = base::GetDisplayId(id, index, &output.display_id);
321 output.index = index; 309 output.index = index;
322 bool is_internal = IsInternalOutput(info); 310 output.type = GetOutputTypeFromName(info->name);
311
312 if (output.type == OUTPUT_TYPE_UNKNOWN)
313 LOG(ERROR) << "Unknown link type: " << info->name;
323 314
324 // Use the index as a valid display ID even if the internal 315 // Use the index as a valid display ID even if the internal
325 // display doesn't have valid EDID because the index 316 // display doesn't have valid EDID because the index
326 // will never change. 317 // will never change.
327 if (!output.has_display_id && is_internal) 318 if (!output.has_display_id && output.type == OUTPUT_TYPE_INTERNAL)
328 output.has_display_id = true; 319 output.has_display_id = true;
329 320
330 if (info->crtc) { 321 if (info->crtc) {
331 XRRCrtcInfo* crtc_info = XRRGetCrtcInfo(display_, screen_, info->crtc); 322 XRRCrtcInfo* crtc_info = XRRGetCrtcInfo(display_, screen_, info->crtc);
332 output.current_mode = crtc_info->mode; 323 output.current_mode = crtc_info->mode;
333 output.x = crtc_info->x; 324 output.x = crtc_info->x;
334 output.y = crtc_info->y; 325 output.y = crtc_info->y;
335 XRRFreeCrtcInfo(crtc_info); 326 XRRFreeCrtcInfo(crtc_info);
336 } 327 }
337 328
(...skipping 12 matching lines...) Expand all
350 341
351 for (int i = 0; i < info->nmode; ++i) { 342 for (int i = 0; i < info->nmode; ++i) {
352 const RRMode mode = info->modes[i]; 343 const RRMode mode = info->modes[i];
353 OutputConfigurator::ModeInfo mode_info; 344 OutputConfigurator::ModeInfo mode_info;
354 if (InitModeInfo(mode, &mode_info)) 345 if (InitModeInfo(mode, &mode_info))
355 output.mode_infos.insert(std::make_pair(mode, mode_info)); 346 output.mode_infos.insert(std::make_pair(mode, mode_info));
356 else 347 else
357 LOG(WARNING) << "Unable to find XRRModeInfo for mode " << mode; 348 LOG(WARNING) << "Unable to find XRRModeInfo for mode " << mode;
358 } 349 }
359 350
360 std::string name(info->name);
361 if (is_internal) {
362 output.type = ui::OUTPUT_TYPE_INTERNAL;
363 } else if (name.find(kOutputName_VGA) == 0) {
364 output.type = ui::OUTPUT_TYPE_VGA;
365 } else if (name.find(kOutputName_HDMI) == 0) {
366 output.type = ui::OUTPUT_TYPE_HDMI;
367 } else if (name.find(kOutputName_DVI) == 0) {
368 output.type = ui::OUTPUT_TYPE_DVI;
369 } else if (name.find(kOutputName_DisplayPort) == 0) {
370 output.type = ui::OUTPUT_TYPE_DISPLAYPORT;
371 } else {
372 LOG(ERROR) << "Unknown link type: " << name;
373 output.type = ui::OUTPUT_TYPE_UNKNOWN;
374 }
375
376 return output; 351 return output;
377 } 352 }
378 353
379 bool NativeDisplayDelegateX11::GetHDCPState( 354 bool NativeDisplayDelegateX11::GetHDCPState(
380 const OutputConfigurator::OutputSnapshot& output, ui::HDCPState* state) { 355 const OutputConfigurator::OutputSnapshot& output,
356 HDCPState* state) {
381 unsigned char* values = NULL; 357 unsigned char* values = NULL;
382 int actual_format = 0; 358 int actual_format = 0;
383 unsigned long nitems = 0; 359 unsigned long nitems = 0;
384 unsigned long bytes_after = 0; 360 unsigned long bytes_after = 0;
385 Atom actual_type = None; 361 Atom actual_type = None;
386 int success = 0; 362 int success = 0;
387 // TODO(kcwu): Use X11AtomCache to save round trip time of XInternAtom. 363 // TODO(kcwu): Use X11AtomCache to save round trip time of XInternAtom.
388 Atom prop = XInternAtom(display_, kContentProtectionAtomName, False); 364 Atom prop = XInternAtom(display_, kContentProtectionAtomName, False);
389 365
390 bool ok = true; 366 bool ok = true;
(...skipping 13 matching lines...) Expand all
404 &bytes_after, 380 &bytes_after,
405 &values); 381 &values);
406 if (actual_type == None) { 382 if (actual_type == None) {
407 LOG(ERROR) << "Property '" << kContentProtectionAtomName 383 LOG(ERROR) << "Property '" << kContentProtectionAtomName
408 << "' does not exist"; 384 << "' does not exist";
409 ok = false; 385 ok = false;
410 } else if (success == Success && actual_type == XA_ATOM && 386 } else if (success == Success && actual_type == XA_ATOM &&
411 actual_format == 32 && nitems == 1) { 387 actual_format == 32 && nitems == 1) {
412 Atom value = reinterpret_cast<Atom*>(values)[0]; 388 Atom value = reinterpret_cast<Atom*>(values)[0];
413 if (value == XInternAtom(display_, kProtectionUndesiredAtomName, False)) { 389 if (value == XInternAtom(display_, kProtectionUndesiredAtomName, False)) {
414 *state = ui::HDCP_STATE_UNDESIRED; 390 *state = HDCP_STATE_UNDESIRED;
415 } else if (value == 391 } else if (value ==
416 XInternAtom(display_, kProtectionDesiredAtomName, False)) { 392 XInternAtom(display_, kProtectionDesiredAtomName, False)) {
417 *state = ui::HDCP_STATE_DESIRED; 393 *state = HDCP_STATE_DESIRED;
418 } else if (value == 394 } else if (value ==
419 XInternAtom(display_, kProtectionEnabledAtomName, False)) { 395 XInternAtom(display_, kProtectionEnabledAtomName, False)) {
420 *state = ui::HDCP_STATE_ENABLED; 396 *state = HDCP_STATE_ENABLED;
421 } else { 397 } else {
422 LOG(ERROR) << "Unknown " << kContentProtectionAtomName 398 LOG(ERROR) << "Unknown " << kContentProtectionAtomName
423 << " value: " << value; 399 << " value: " << value;
424 ok = false; 400 ok = false;
425 } 401 }
426 } else { 402 } else {
427 LOG(ERROR) << "XRRGetOutputProperty failed"; 403 LOG(ERROR) << "XRRGetOutputProperty failed";
428 ok = false; 404 ok = false;
429 } 405 }
430 if (values) 406 if (values)
431 XFree(values); 407 XFree(values);
432 408
433 VLOG(3) << "HDCP state: " << ok << "," << *state; 409 VLOG(3) << "HDCP state: " << ok << "," << *state;
434 return ok; 410 return ok;
435 } 411 }
436 412
437 bool NativeDisplayDelegateX11::SetHDCPState( 413 bool NativeDisplayDelegateX11::SetHDCPState(
438 const OutputConfigurator::OutputSnapshot& output, ui::HDCPState state) { 414 const OutputConfigurator::OutputSnapshot& output,
415 HDCPState state) {
439 Atom name = XInternAtom(display_, kContentProtectionAtomName, False); 416 Atom name = XInternAtom(display_, kContentProtectionAtomName, False);
440 Atom value = None; 417 Atom value = None;
441 switch (state) { 418 switch (state) {
442 case ui::HDCP_STATE_UNDESIRED: 419 case HDCP_STATE_UNDESIRED:
443 value = XInternAtom(display_, kProtectionUndesiredAtomName, False); 420 value = XInternAtom(display_, kProtectionUndesiredAtomName, False);
444 break; 421 break;
445 case ui::HDCP_STATE_DESIRED: 422 case HDCP_STATE_DESIRED:
446 value = XInternAtom(display_, kProtectionDesiredAtomName, False); 423 value = XInternAtom(display_, kProtectionDesiredAtomName, False);
447 break; 424 break;
448 default: 425 default:
449 NOTREACHED() << "Invalid HDCP state: " << state; 426 NOTREACHED() << "Invalid HDCP state: " << state;
450 return false; 427 return false;
451 } 428 }
452 base::X11ErrorTracker err_tracker; 429 base::X11ErrorTracker err_tracker;
453 unsigned char* data = reinterpret_cast<unsigned char*>(&value); 430 unsigned char* data = reinterpret_cast<unsigned char*>(&value);
454 XRRChangeOutputProperty( 431 XRRChangeOutputProperty(
455 display_, output.output, name, XA_ATOM, 32, PropModeReplace, data, 1); 432 display_, output.output, name, XA_ATOM, 32, PropModeReplace, data, 1);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 } 538 }
562 539
563 void NativeDisplayDelegateX11::AddObserver(NativeDisplayObserver* observer) { 540 void NativeDisplayDelegateX11::AddObserver(NativeDisplayObserver* observer) {
564 observers_.AddObserver(observer); 541 observers_.AddObserver(observer);
565 } 542 }
566 543
567 void NativeDisplayDelegateX11::RemoveObserver(NativeDisplayObserver* observer) { 544 void NativeDisplayDelegateX11::RemoveObserver(NativeDisplayObserver* observer) {
568 observers_.RemoveObserver(observer); 545 observers_.RemoveObserver(observer);
569 } 546 }
570 547
571 } // namespace chromeos 548 } // namespace ui
OLDNEW
« no previous file with comments | « ui/display/chromeos/x11/native_display_delegate_x11.h ('k') | ui/display/chromeos/x11/native_display_event_dispatcher_x11.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698