Index: ui/aura/env.cc |
diff --git a/ui/aura/env.cc b/ui/aura/env.cc |
index d4b5cdfe43d0d7914753efd2975cba71acaa66db..5b7fe69a5a574aac949fed48f97321ce397ecbac 100644 |
--- a/ui/aura/env.cc |
+++ b/ui/aura/env.cc |
@@ -18,6 +18,7 @@ |
#include "ui/aura/window_port_local.h" |
#include "ui/events/event_target_iterator.h" |
#include "ui/events/platform/platform_event_source.h" |
+#include "ui/gfx/switches.h" |
#if defined(USE_OZONE) |
#include "ui/ozone/public/ozone_platform.h" |
@@ -37,6 +38,10 @@ bool RunningInsideMus() { |
"primordial-pipe-token"); |
} |
+bool RunningInHeadlessMode() { |
+ return base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kHeadless); |
+} |
+ |
} // namespace |
// Observes destruction and changes of the FocusClient for a window. |
@@ -162,7 +167,7 @@ Env::Env(Mode mode) |
} |
void Env::Init() { |
- if (RunningInsideMus()) |
+ if (RunningInsideMus() || RunningInHeadlessMode()) |
return; |
#if defined(USE_OZONE) |
// The ozone platform can provide its own event source. So initialize the |