Commit 39a00688 authored by Maksim Sadym's avatar Maksim Sadym Committed by Commit Bot

Fix IdleDetector crash on headless mode

Bug: 1113202
Change-Id: I63ad3e451b5421b2d4398731405d6b151e558506
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2339354Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Auto-Submit: Maksim Sadym <sadym@chromium.org>
Cr-Commit-Position: refs/heads/master@{#795213}
parent 9340e246
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
#include "ui/base/idle/screensaver_window_finder_x11.h" #include "ui/base/idle/screensaver_window_finder_x11.h"
#include "base/command_line.h"
#include "ui/base/x/x11_util.h" #include "ui/base/x/x11_util.h"
#include "ui/gfx/switches.h"
#include "ui/gfx/x/connection.h" #include "ui/gfx/x/connection.h"
#include "ui/gfx/x/screensaver.h" #include "ui/gfx/x/screensaver.h"
#include "ui/gfx/x/x11.h" #include "ui/gfx/x/x11.h"
...@@ -16,6 +18,10 @@ namespace ui { ...@@ -16,6 +18,10 @@ namespace ui {
ScreensaverWindowFinder::ScreensaverWindowFinder() : exists_(false) {} ScreensaverWindowFinder::ScreensaverWindowFinder() : exists_(false) {}
bool ScreensaverWindowFinder::ScreensaverWindowExists() { bool ScreensaverWindowFinder::ScreensaverWindowExists() {
// Avoid calling into potentially missing X11 APIs in headless mode.
if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kHeadless))
return false;
auto* connection = x11::Connection::Get(); auto* connection = x11::Connection::Get();
// Let the server know the client version before making any requests. // Let the server know the client version before making any requests.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment