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

Side by Side Diff: ui/gfx/icc_profile_x11.cc

Issue 1991953002: Implement a runtime headless mode for Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years 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
« no previous file with comments | « ui/base/ime/input_method_factory.cc ('k') | ui/gfx/switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <stddef.h> 5 #include <stddef.h>
6 6
7 extern "C" { 7 extern "C" {
8 #include <X11/Xatom.h> 8 #include <X11/Xatom.h>
9 #include <X11/Xlib.h> 9 #include <X11/Xlib.h>
10 } 10 }
11 11
12 #include "base/command_line.h"
12 #include "ui/gfx/icc_profile.h" 13 #include "ui/gfx/icc_profile.h"
13 14 #include "ui/gfx/switches.h"
14 #include "ui/gfx/x/x11_types.h" 15 #include "ui/gfx/x/x11_types.h"
15 16
16 namespace gfx { 17 namespace gfx {
17 18
18 // static 19 // static
19 ICCProfile ICCProfile::FromBestMonitor() { 20 ICCProfile ICCProfile::FromBestMonitor() {
20 ICCProfile icc_profile; 21 ICCProfile icc_profile;
22 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kHeadless))
23 return icc_profile;
21 Atom property = XInternAtom(GetXDisplay(), "_ICC_PROFILE", true); 24 Atom property = XInternAtom(GetXDisplay(), "_ICC_PROFILE", true);
22 if (property != None) { 25 if (property != None) {
23 Atom prop_type = None; 26 Atom prop_type = None;
24 int prop_format = 0; 27 int prop_format = 0;
25 unsigned long nitems = 0; 28 unsigned long nitems = 0;
26 unsigned long nbytes = 0; 29 unsigned long nbytes = 0;
27 char* property_data = NULL; 30 char* property_data = NULL;
28 if (XGetWindowProperty( 31 if (XGetWindowProperty(
29 GetXDisplay(), DefaultRootWindow(GetXDisplay()), property, 0, 32 GetXDisplay(), DefaultRootWindow(GetXDisplay()), property, 0,
30 0x1FFFFFFF /* MAXINT32 / 4 */, False, AnyPropertyType, &prop_type, 33 0x1FFFFFFF /* MAXINT32 / 4 */, False, AnyPropertyType, &prop_type,
31 &prop_format, &nitems, &nbytes, 34 &prop_format, &nitems, &nbytes,
32 reinterpret_cast<unsigned char**>(&property_data)) == Success) { 35 reinterpret_cast<unsigned char**>(&property_data)) == Success) {
33 icc_profile = FromData(property_data, nitems); 36 icc_profile = FromData(property_data, nitems);
34 XFree(property_data); 37 XFree(property_data);
35 } 38 }
36 } 39 }
37 return icc_profile; 40 return icc_profile;
38 } 41 }
39 42
40 } // namespace gfx 43 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/base/ime/input_method_factory.cc ('k') | ui/gfx/switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698