| Index: services/ui/ws/display.cc
|
| diff --git a/services/ui/ws/display.cc b/services/ui/ws/display.cc
|
| index b3981b86032061140d6c25279a890a940e863eab..839656fd582a907aa6fedfb1b779e355dac9fd72 100644
|
| --- a/services/ui/ws/display.cc
|
| +++ b/services/ui/ws/display.cc
|
| @@ -26,6 +26,7 @@
|
| #include "services/ui/ws/window_server_delegate.h"
|
| #include "services/ui/ws/window_tree.h"
|
| #include "services/ui/ws/window_tree_binding.h"
|
| +#include "services/ui/ws/window_tree_host_factory.h"
|
| #include "ui/base/cursor/cursor.h"
|
|
|
| namespace ui {
|
| @@ -62,6 +63,9 @@ Display::~Display() {
|
|
|
| void Display::Init(const PlatformDisplayInitParams& init_params,
|
| std::unique_ptr<DisplayBinding> binding) {
|
| + in_external_window_mode_ =
|
| + window_server_->window_tree_host_factory() && binding;
|
| +
|
| binding_ = std::move(binding);
|
| display_manager()->AddDisplay(this);
|
|
|
| @@ -204,7 +208,26 @@ void Display::SetTitle(const std::string& title) {
|
| platform_display_->SetTitle(base::UTF8ToUTF16(title));
|
| }
|
|
|
| +void Display::InitDisplayRoot() {
|
| + DCHECK(in_external_window_mode_);
|
| + DCHECK(binding_);
|
| + DCHECK(window_server_->window_tree_host_factory());
|
| +
|
| + external_window_mode_display_root_ =
|
| + base::MakeUnique<WindowManagerDisplayRoot>(this);
|
| + window_manager_display_root_map_[service_manager::mojom::kRootUserID] =
|
| + external_window_mode_display_root_.get();
|
| +
|
| + ServerWindow* server_window = external_window_mode_display_root_->root();
|
| + WindowTree* window_tree =
|
| + window_server_->window_tree_host_factory()->window_tree();
|
| + window_tree->AddRoot(server_window);
|
| + window_tree->DoOnEmbed(nullptr /*mojom::WindowTreePtr*/, server_window);
|
| +}
|
| +
|
| void Display::InitWindowManagerDisplayRoots() {
|
| + // Tests can create ws::Display instances, directly by-passing
|
| + // WindowTreeHostFactory.
|
| if (binding_) {
|
| std::unique_ptr<WindowManagerDisplayRoot> display_root_ptr(
|
| new WindowManagerDisplayRoot(this));
|
| @@ -220,7 +243,6 @@ void Display::InitWindowManagerDisplayRoots() {
|
| } else {
|
| CreateWindowManagerDisplayRootsFromFactories();
|
| }
|
| - display_manager()->OnDisplayUpdate(this);
|
| }
|
|
|
| void Display::CreateWindowManagerDisplayRootsFromFactories() {
|
| @@ -274,7 +296,13 @@ ServerWindow* Display::GetRootWindow() {
|
|
|
| void Display::OnAcceleratedWidgetAvailable() {
|
| display_manager()->OnDisplayAcceleratedWidgetAvailable(this);
|
| - InitWindowManagerDisplayRoots();
|
| +
|
| + if (in_external_window_mode_)
|
| + InitDisplayRoot();
|
| + else
|
| + InitWindowManagerDisplayRoots();
|
| +
|
| + display_manager()->OnDisplayUpdate(this);
|
| }
|
|
|
| bool Display::IsInHighContrastMode() {
|
|
|