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

Unified Diff: ash/host/ash_window_tree_host.cc

Issue 2821203002: cros: Adds ShellPort functions for simplified display mode (Closed)
Patch Set: Fix x11 build Created 3 years, 8 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_init_params.h » ('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 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
« no previous file with comments | « ash/host/ash_window_tree_host.h ('k') | ash/host/ash_window_tree_host_init_params.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698