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 939f097d35648af36c2c33d1b4c972f8e1cb175b..31cdd01be556ab41b2d0eba6930a9594b9e28c57 100644 |
--- a/ash/host/ash_window_tree_host.cc |
+++ b/ash/host/ash_window_tree_host.cc |
@@ -6,6 +6,8 @@ |
#include "ash/host/ash_window_tree_host_init_params.h" |
#include "ash/host/ash_window_tree_host_unified.h" |
+#include "ash/shell_port.h" |
+#include "base/memory/ptr_util.h" |
#include "ui/aura/client/screen_position_client.h" |
#include "ui/aura/window_tree_host.h" |
#include "ui/events/event.h" |
@@ -21,6 +23,8 @@ namespace ash { |
AshWindowTreeHost::AshWindowTreeHost() : input_method_handler_(nullptr) {} |
+AshWindowTreeHost::~AshWindowTreeHost() = default; |
+ |
void AshWindowTreeHost::TranslateLocatedEvent(ui::LocatedEvent* event) { |
if (event->IsTouchEvent()) |
return; |
@@ -47,14 +51,22 @@ void AshWindowTreeHost::TranslateLocatedEvent(ui::LocatedEvent* event) { |
} |
// static |
-AshWindowTreeHost* AshWindowTreeHost::Create( |
+std::unique_ptr<AshWindowTreeHost> AshWindowTreeHost::Create( |
const AshWindowTreeHostInitParams& init_params) { |
- if (init_params.offscreen) |
- return new AshWindowTreeHostUnified(init_params.initial_bounds); |
+ std::unique_ptr<AshWindowTreeHost> ash_window_tree_host = |
+ ShellPort::Get()->CreateAshWindowTreeHost(init_params); |
+ if (ash_window_tree_host) |
+ return ash_window_tree_host; |
+ |
+ if (init_params.offscreen) { |
+ return base::MakeUnique<AshWindowTreeHostUnified>( |
+ init_params.initial_bounds); |
+ } |
#if defined(USE_OZONE) |
- return new AshWindowTreeHostPlatform(init_params.initial_bounds); |
+ return base::MakeUnique<AshWindowTreeHostPlatform>( |
+ init_params.initial_bounds); |
#elif defined(USE_X11) |
- return new AshWindowTreeHostX11(init_params.initial_bounds); |
+ return base::MakeUnique<AshWindowTreeHostX11>(init_params.initial_bounds); |
#else |
#error Unsupported platform. |
#endif |