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

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

Issue 2924343002: Move ui::GetAtom to gfx::GetAtom (Closed)
Patch Set: fix CrOs build Created 3 years, 6 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
« no previous file with comments | « ui/events/platform/x11/x11_hotplug_event_handler.cc ('k') | ui/gfx/x/x11_atom_cache.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 "base/command_line.h"
13 #include "ui/gfx/icc_profile.h" 13 #include "ui/gfx/icc_profile.h"
14 #include "ui/gfx/switches.h" 14 #include "ui/gfx/switches.h"
15 #include "ui/gfx/x/x11_atom_cache.h" 15 #include "ui/gfx/x/x11_atom_cache.h"
16 #include "ui/gfx/x/x11_types.h" 16 #include "ui/gfx/x/x11_types.h"
17 17
18 namespace gfx { 18 namespace gfx {
19 19
20 // static 20 // static
21 ICCProfile ICCProfile::FromBestMonitor() { 21 ICCProfile ICCProfile::FromBestMonitor() {
22 if (HasForcedProfile()) 22 if (HasForcedProfile())
23 return GetForcedProfile(); 23 return GetForcedProfile();
24 24
25 ICCProfile icc_profile; 25 ICCProfile icc_profile;
26 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kHeadless)) 26 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kHeadless))
27 return icc_profile; 27 return icc_profile;
28 Atom property = ui::X11AtomCache::GetInstance()->GetAtom("_ICC_PROFILE"); 28 Atom property = GetAtom("_ICC_PROFILE");
29 if (property != None) { 29 if (property != None) {
30 Atom prop_type = None; 30 Atom prop_type = None;
31 int prop_format = 0; 31 int prop_format = 0;
32 unsigned long nitems = 0; 32 unsigned long nitems = 0;
33 unsigned long nbytes = 0; 33 unsigned long nbytes = 0;
34 char* property_data = NULL; 34 char* property_data = NULL;
35 if (XGetWindowProperty( 35 if (XGetWindowProperty(
36 GetXDisplay(), DefaultRootWindow(GetXDisplay()), property, 0, 36 GetXDisplay(), DefaultRootWindow(GetXDisplay()), property, 0,
37 0x1FFFFFFF /* MAXINT32 / 4 */, False, AnyPropertyType, &prop_type, 37 0x1FFFFFFF /* MAXINT32 / 4 */, False, AnyPropertyType, &prop_type,
38 &prop_format, &nitems, &nbytes, 38 &prop_format, &nitems, &nbytes,
39 reinterpret_cast<unsigned char**>(&property_data)) == Success) { 39 reinterpret_cast<unsigned char**>(&property_data)) == Success) {
40 icc_profile = FromData(property_data, nitems); 40 icc_profile = FromData(property_data, nitems);
41 XFree(property_data); 41 XFree(property_data);
42 } 42 }
43 } 43 }
44 return icc_profile; 44 return icc_profile;
45 } 45 }
46 46
47 } // namespace gfx 47 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/events/platform/x11/x11_hotplug_event_handler.cc ('k') | ui/gfx/x/x11_atom_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698