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

Side by Side Diff: chrome/browser/media/webrtc/window_icon_util_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 | « ash/host/ash_window_tree_host_x11.cc ('k') | ui/aura/test/ui_controls_factory_aurax11.cc » ('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 "chrome/browser/media/webrtc/window_icon_util.h" 5 #include "chrome/browser/media/webrtc/window_icon_util.h"
6 6
7 #include <X11/Xatom.h> 7 #include <X11/Xatom.h>
8 #include <X11/Xutil.h> 8 #include <X11/Xutil.h>
9 9
10 #include "ui/base/x/x11_util.h" 10 #include "ui/base/x/x11_util.h"
11 #include "ui/gfx/x/x11_atom_cache.h"
11 #include "ui/gfx/x/x11_error_tracker.h" 12 #include "ui/gfx/x/x11_error_tracker.h"
12 #include "ui/gfx/x/x11_types.h" 13 #include "ui/gfx/x/x11_types.h"
13 14
14 gfx::ImageSkia GetWindowIcon(content::DesktopMediaID id) { 15 gfx::ImageSkia GetWindowIcon(content::DesktopMediaID id) {
15 DCHECK(id.type == content::DesktopMediaID::TYPE_WINDOW); 16 DCHECK(id.type == content::DesktopMediaID::TYPE_WINDOW);
16 17
17 Display* display = gfx::GetXDisplay(); 18 Display* display = gfx::GetXDisplay();
18 Atom property = ui::GetAtom("_NET_WM_ICON"); 19 Atom property = gfx::GetAtom("_NET_WM_ICON");
19 Atom actual_type; 20 Atom actual_type;
20 int actual_format; 21 int actual_format;
21 unsigned long bytes_after; // NOLINT: type required by XGetWindowProperty 22 unsigned long bytes_after; // NOLINT: type required by XGetWindowProperty
22 unsigned long size; 23 unsigned long size;
23 long* data; 24 long* data;
24 25
25 // The |error_tracker| essentially provides an empty X error handler for 26 // The |error_tracker| essentially provides an empty X error handler for
26 // the call of XGetWindowProperty. The motivation is to guard against crash 27 // the call of XGetWindowProperty. The motivation is to guard against crash
27 // for any reason that XGetWindowProperty fails. For example, at the time that 28 // for any reason that XGetWindowProperty fails. For example, at the time that
28 // XGetWindowProperty is called, the window handler (a.k.a |id.id|) may 29 // XGetWindowProperty is called, the window handler (a.k.a |id.id|) may
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 for (long y = 0; y < height; ++y) { 67 for (long y = 0; y < height; ++y) {
67 for (long x = 0; x < width; ++x) { 68 for (long x = 0; x < width; ++x) {
68 pixels_data[result.rowBytesAsPixels() * y + x] = 69 pixels_data[result.rowBytesAsPixels() * y + x] =
69 static_cast<uint32_t>(data[start + width * y + x]); 70 static_cast<uint32_t>(data[start + width * y + x]);
70 } 71 }
71 } 72 }
72 73
73 XFree(data); 74 XFree(data);
74 return gfx::ImageSkia::CreateFrom1xBitmap(result); 75 return gfx::ImageSkia::CreateFrom1xBitmap(result);
75 } 76 }
OLDNEW
« no previous file with comments | « ash/host/ash_window_tree_host_x11.cc ('k') | ui/aura/test/ui_controls_factory_aurax11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698