Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2616)

Unified Diff: ash/host/ash_window_tree_host.cc

Issue 1641003002: [exp] ash: Ash in Mus. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tot-merge Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/host/ash_window_tree_host.h ('k') | ash/host/ash_window_tree_host_ozone.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+
+} // 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
« no previous file with comments | « ash/host/ash_window_tree_host.h ('k') | ash/host/ash_window_tree_host_ozone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698