summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/gtk/browser_window_gtk.cc6
-rw-r--r--chrome/common/x11_util.cc4
-rw-r--r--chrome/common/x11_util.h2
3 files changed, 11 insertions, 1 deletions
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc
index e4f7155..ccfc556 100644
--- a/chrome/browser/gtk/browser_window_gtk.cc
+++ b/chrome/browser/gtk/browser_window_gtk.cc
@@ -1194,8 +1194,12 @@ GtkWindow* BrowserWindowGtk::GetBrowserWindowForXID(XID xid) {
// static
void BrowserWindowGtk::RegisterUserPrefs(PrefService* prefs) {
bool custom_frame_default = false;
- if (!prefs->HasPrefPath(prefs::kUseCustomChromeFrame))
+ // Avoid checking the window manager if we're not connected to an X server (as
+ // is the case in Valgrind tests).
+ if (x11_util::XDisplayExists() &&
+ !prefs->HasPrefPath(prefs::kUseCustomChromeFrame)) {
custom_frame_default = GetCustomFramePrefDefault();
+ }
prefs->RegisterBooleanPref(
prefs::kUseCustomChromeFrame, custom_frame_default);
}
diff --git a/chrome/common/x11_util.cc b/chrome/common/x11_util.cc
index 3af0115..1305fe1 100644
--- a/chrome/common/x11_util.cc
+++ b/chrome/common/x11_util.cc
@@ -26,6 +26,10 @@
namespace x11_util {
+bool XDisplayExists() {
+ return (gdk_display_get_default() != NULL);
+}
+
Display* GetXDisplay() {
static Display* display = NULL;
diff --git a/chrome/common/x11_util.h b/chrome/common/x11_util.h
index d9bcbb5..09b1c2b 100644
--- a/chrome/common/x11_util.h
+++ b/chrome/common/x11_util.h
@@ -34,6 +34,8 @@ namespace x11_util {
// These functions cache their results.
+// Check if there's an open connection to an X server.
+bool XDisplayExists();
// Return an X11 connection for the current, primary display.
Display* GetXDisplay();
// Return true iff the connection supports X shared memory