Chromium Code Reviews| Index: ash/host/ash_window_tree_host.cc |
| diff --git a/ash/host/ash_window_tree_host.cc b/ash/host/ash_window_tree_host.cc |
| index 6f18204aa2f9b854c31bdacb658cbd1dee4e1d74..1cb761ff40c48eeaee45aa2c2921cada547a9b8d 100644 |
| --- a/ash/host/ash_window_tree_host.cc |
| +++ b/ash/host/ash_window_tree_host.cc |
| @@ -4,13 +4,31 @@ |
| #include "ash/host/ash_window_tree_host.h" |
| +#include "ash/host/ash_window_tree_host_init_params.h" |
| +#include "ash/host/ash_window_tree_host_unified.h" |
| #include "ui/aura/client/screen_position_client.h" |
| #include "ui/aura/window_tree_host.h" |
| #include "ui/events/event.h" |
| #include "ui/gfx/geometry/rect.h" |
| +#if defined(USE_OZONE) |
| +#include "ash/host/ash_window_tree_host_ozone.h" |
| +#elif defined(USE_X11) |
| +#include "ash/host/ash_window_tree_host_x11.h" |
| +#elif defined(OS_WIN) |
| +#include "ash/host/ash_window_tree_host_win.h" |
| +#else |
| +#error Unsupported platform. |
| +#endif |
| + |
| namespace ash { |
| +namespace { |
| + |
| +AshWindowTreeHost::Factory g_factory; |
|
sky
2016/02/03 22:43:48
nit: g_factory is file local, so no 'g_'
sadrul
2016/02/04 00:03:42
Acknowledged.
|
| + |
| +} // namespace |
| + |
| AshWindowTreeHost::AshWindowTreeHost() : input_method_handler_(nullptr) { |
| } |
| @@ -39,4 +57,26 @@ void AshWindowTreeHost::TranslateLocatedEvent(ui::LocatedEvent* event) { |
| } |
| } |
| +// static |
| +AshWindowTreeHost* AshWindowTreeHost::Create( |
| + const AshWindowTreeHostInitParams& init_params) { |
| + if (!g_factory.is_null()) |
| + return g_factory.Run(init_params); |
| + if (init_params.offscreen) |
| + return new AshWindowTreeHostUnified(init_params.initial_bounds); |
| +#if defined(USE_OZONE) |
| + return new AshWindowTreeHostOzone(init_params.initial_bounds); |
| +#elif defined(USE_X11) |
| + return new AshWindowTreeHostX11(init_params.initial_bounds); |
| +#elif defined(OS_WIN) |
| + return new AshWindowTreeHostWin(init_params.initial_bounds); |
| +#endif |
| + NOTREACHED(); |
| + return nullptr; |
| +} |
| + |
| +void AshWindowTreeHost::SetFactory(const Factory& factory) { |
| + g_factory = factory; |
| +} |
| + |
| } // namespace ash |