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

Unified Diff: chrome/browser/media/window_icon_util_x11.cc

Issue 2270543003: Display Window Icon In Picker UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add file Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media/window_icon_util_x11.cc
diff --git a/chrome/browser/media/window_icon_util_x11.cc b/chrome/browser/media/window_icon_util_x11.cc
index 36462dc229d131d6adbc58c1fadb4b26427e3624..6af2fa23e3d75bc653234ca90d07ac87c92b0f5a 100644
--- a/chrome/browser/media/window_icon_util_x11.cc
+++ b/chrome/browser/media/window_icon_util_x11.cc
@@ -9,6 +9,10 @@
#include "ui/gfx/x/x11_types.h"
+int ErrorHandler(Display* display, XErrorEvent* event) {
msw 2016/08/24 17:01:28 Why is this needed? Can you add an explanatory com
qiangchen 2016/08/24 18:03:30 Done.
+ return 0;
+}
+
gfx::ImageSkia GetWindowIcon(content::DesktopMediaID id) {
DCHECK(id.type == content::DesktopMediaID::TYPE_WINDOW);
@@ -20,6 +24,7 @@ gfx::ImageSkia GetWindowIcon(content::DesktopMediaID id) {
unsigned long size;
long* data;
+ XSetErrorHandler(&ErrorHandler);
int status = XGetWindowProperty(display, id.id, property, 0L, ~0L, False,
AnyPropertyType, &actual_type, &actual_format,
&size, &bytes_after,
@@ -27,6 +32,7 @@ gfx::ImageSkia GetWindowIcon(content::DesktopMediaID id) {
if (status != Success) {
return gfx::ImageSkia();
}
+ XSetErrorHandler(nullptr);
msw 2016/08/24 17:01:28 Cache the old handler and restore it afterwards, l
qiangchen 2016/08/24 18:03:30 Is this quite useful here? The error handler is ju
msw 2016/08/24 18:13:56 My thought is that there may be some pre-existing
qiangchen 2016/08/24 18:59:13 Done.
// The format of |data| is concatenation of sections like
// [width, height, pixel data of size width * height], and the total bytes

Powered by Google App Engine
This is Rietveld 408576698