Index: ui/aura/env.cc |
diff --git a/ui/aura/env.cc b/ui/aura/env.cc |
index d4b5cdfe43d0d7914753efd2975cba71acaa66db..3a49c7cec6de1a60d773e235e9bd336154373980 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. |
@@ -170,6 +175,8 @@ void Env::Init() { |
// let the mus process initialize ozone instead. |
ui::OzonePlatform::InitializeForUI(); |
#endif |
+ if (RunningInHeadlessMode()) |
sky
2016/12/06 14:27:31
Would it make more sense for a headless PlatformEv
Sami
2016/12/07 11:51:26
Great idea! Done.
|
+ return; |
if (!ui::PlatformEventSource::GetInstance()) |
event_source_ = ui::PlatformEventSource::CreateDefault(); |
} |