Commit 35074422 authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

Renames WindowData to ClientWindow

In hopes of better describinging what this class is for.

BUG=none
TEST=none

Change-Id: I9611dfa0d74b3ef788381436e6f18cce167a41c9
Reviewed-on: https://chromium-review.googlesource.com/1050878
Commit-Queue: Scott Violet <sky@chromium.org>
Reviewed-by: default avatarMichael Wasserman <msw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#557089}
parent bbdc8049
...@@ -10,32 +10,30 @@ import("//services/service_manager/public/service_manifest.gni") ...@@ -10,32 +10,30 @@ import("//services/service_manager/public/service_manifest.gni")
import("//services/service_manager/public/tools/test/service_test.gni") import("//services/service_manager/public/tools/test/service_test.gni")
component("lib") { component("lib") {
public = [
"gpu_support.h",
"ids.h",
"window_service.h",
"window_service_client.h",
"window_service_client_binding.h",
"window_service_delegate.h",
"window_tree_factory.h",
]
sources = [ sources = [
"client_change.cc", "client_change.cc",
"client_change.h", "client_change.h",
"client_change_tracker.cc", "client_change_tracker.cc",
"client_change_tracker.h", "client_change_tracker.h",
# TODO: client_root should be internal and moved to a different target.
"client_root.cc", "client_root.cc",
"client_root.h", "client_root.h",
"gpu_support.h", "client_window.cc",
"ids.h", "client_window.h",
# TODO: window_data should be internal and moved to a different target.
"window_data.cc",
"window_data.h",
"window_host_frame_sink_client.cc", "window_host_frame_sink_client.cc",
"window_host_frame_sink_client.h", "window_host_frame_sink_client.h",
"window_service.cc", "window_service.cc",
"window_service.h",
"window_service_client.cc", "window_service_client.cc",
"window_service_client.h",
"window_service_client_binding.cc", "window_service_client_binding.cc",
"window_service_client_binding.h",
"window_service_delegate.h",
"window_tree_factory.cc", "window_tree_factory.cc",
"window_tree_factory.h",
] ]
public_deps = [ public_deps = [
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "services/ui/ws2/client_change.h" #include "services/ui/ws2/client_change.h"
#include "services/ui/ws2/client_change_tracker.h" #include "services/ui/ws2/client_change_tracker.h"
#include "services/ui/ws2/window_data.h" #include "services/ui/ws2/client_window.h"
#include "services/ui/ws2/window_service_client.h" #include "services/ui/ws2/window_service_client.h"
#include "ui/aura/mus/client_surface_embedder.h" #include "ui/aura/mus/client_surface_embedder.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
...@@ -21,7 +21,7 @@ ClientRoot::ClientRoot(WindowServiceClient* window_service_client, ...@@ -21,7 +21,7 @@ ClientRoot::ClientRoot(WindowServiceClient* window_service_client,
: window_service_client_(window_service_client), : window_service_client_(window_service_client),
window_(window), window_(window),
is_top_level_(is_top_level) { is_top_level_(is_top_level) {
WindowData::GetMayBeNull(window)->set_embedded_window_service_client( ClientWindow::GetMayBeNull(window)->set_embedded_window_service_client(
window_service_client); window_service_client);
window_->AddObserver(this); window_->AddObserver(this);
// TODO: wire up gfx::Insets() correctly below. See usage in // TODO: wire up gfx::Insets() correctly below. See usage in
...@@ -36,14 +36,14 @@ ClientRoot::ClientRoot(WindowServiceClient* window_service_client, ...@@ -36,14 +36,14 @@ ClientRoot::ClientRoot(WindowServiceClient* window_service_client,
} }
ClientRoot::~ClientRoot() { ClientRoot::~ClientRoot() {
WindowData::GetMayBeNull(window_)->set_embedded_window_service_client( ClientWindow::GetMayBeNull(window_)->set_embedded_window_service_client(
nullptr); nullptr);
window_->RemoveObserver(this); window_->RemoveObserver(this);
} }
void ClientRoot::FrameSinkIdChanged() { void ClientRoot::FrameSinkIdChanged() {
window_->SetEmbedFrameSinkId( window_->SetEmbedFrameSinkId(
WindowData::GetMayBeNull(window_)->frame_sink_id()); ClientWindow::GetMayBeNull(window_)->frame_sink_id());
UpdatePrimarySurfaceId(); UpdatePrimarySurfaceId();
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "services/ui/ws2/window_data.h" #include "services/ui/ws2/client_window.h"
#include "components/viz/host/host_frame_sink_manager.h" #include "components/viz/host/host_frame_sink_manager.h"
#include "services/ui/ws2/window_host_frame_sink_client.h" #include "services/ui/ws2/window_host_frame_sink_client.h"
...@@ -10,35 +10,35 @@ ...@@ -10,35 +10,35 @@
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/compositor/compositor.h" #include "ui/compositor/compositor.h"
DEFINE_UI_CLASS_PROPERTY_TYPE(ui::ws2::WindowData*); DEFINE_UI_CLASS_PROPERTY_TYPE(ui::ws2::ClientWindow*);
namespace ui { namespace ui {
namespace ws2 { namespace ws2 {
namespace { namespace {
DEFINE_OWNED_UI_CLASS_PROPERTY_KEY(ui::ws2::WindowData, DEFINE_OWNED_UI_CLASS_PROPERTY_KEY(ui::ws2::ClientWindow,
kWindowDataKey, kClientWindowKey,
nullptr); nullptr);
} // namespace } // namespace
WindowData::~WindowData() = default; ClientWindow::~ClientWindow() = default;
// static // static
WindowData* WindowData::Create(aura::Window* window, ClientWindow* ClientWindow::Create(aura::Window* window,
WindowServiceClient* client, WindowServiceClient* client,
const viz::FrameSinkId& frame_sink_id) { const viz::FrameSinkId& frame_sink_id) {
DCHECK(!GetMayBeNull(window)); DCHECK(!GetMayBeNull(window));
// Owned by |window|. // Owned by |window|.
WindowData* data = new WindowData(window, client, frame_sink_id); ClientWindow* client_window = new ClientWindow(window, client, frame_sink_id);
window->SetProperty(kWindowDataKey, data); window->SetProperty(kClientWindowKey, client_window);
return data; return client_window;
} }
// static // static
const WindowData* WindowData::GetMayBeNull(const aura::Window* window) { const ClientWindow* ClientWindow::GetMayBeNull(const aura::Window* window) {
return window->GetProperty(kWindowDataKey); return window->GetProperty(kClientWindowKey);
} }
void WindowData::SetFrameSinkId(const viz::FrameSinkId& frame_sink_id) { void ClientWindow::SetFrameSinkId(const viz::FrameSinkId& frame_sink_id) {
frame_sink_id_ = frame_sink_id; frame_sink_id_ = frame_sink_id;
viz::HostFrameSinkManager* host_frame_sink_manager = viz::HostFrameSinkManager* host_frame_sink_manager =
aura::Env::GetInstance() aura::Env::GetInstance()
...@@ -61,7 +61,7 @@ void WindowData::SetFrameSinkId(const viz::FrameSinkId& frame_sink_id) { ...@@ -61,7 +61,7 @@ void WindowData::SetFrameSinkId(const viz::FrameSinkId& frame_sink_id) {
window_host_frame_sink_client_->OnFrameSinkIdChanged(); window_host_frame_sink_client_->OnFrameSinkIdChanged();
} }
void WindowData::AttachCompositorFrameSink( void ClientWindow::AttachCompositorFrameSink(
viz::mojom::CompositorFrameSinkRequest compositor_frame_sink, viz::mojom::CompositorFrameSinkRequest compositor_frame_sink,
viz::mojom::CompositorFrameSinkClientPtr client) { viz::mojom::CompositorFrameSinkClientPtr client) {
viz::HostFrameSinkManager* host_frame_sink_manager = viz::HostFrameSinkManager* host_frame_sink_manager =
...@@ -72,7 +72,7 @@ void WindowData::AttachCompositorFrameSink( ...@@ -72,7 +72,7 @@ void WindowData::AttachCompositorFrameSink(
frame_sink_id_, std::move(compositor_frame_sink), std::move(client)); frame_sink_id_, std::move(compositor_frame_sink), std::move(client));
} }
WindowData::WindowData(aura::Window* window, ClientWindow::ClientWindow(aura::Window* window,
WindowServiceClient* client, WindowServiceClient* client,
const viz::FrameSinkId& frame_sink_id) const viz::FrameSinkId& frame_sink_id)
: window_(window), : window_(window),
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef SERVICES_UI_WS2_WINDOW_DATA_H_ #ifndef SERVICES_UI_WS2_CLIENT_WINDOW_H_
#define SERVICES_UI_WS2_WINDOW_DATA_H_ #define SERVICES_UI_WS2_CLIENT_WINDOW_H_
#include "base/component_export.h" #include "base/component_export.h"
#include "base/macros.h" #include "base/macros.h"
...@@ -22,24 +22,24 @@ class WindowHostFrameSinkClient; ...@@ -22,24 +22,24 @@ class WindowHostFrameSinkClient;
class WindowServiceClient; class WindowServiceClient;
// Tracks any state associated with an aura::Window for the WindowService. // Tracks any state associated with an aura::Window for the WindowService.
// WindowData is created for every window created at the request of a client, // ClientWindow is created for every window created at the request of a client,
// including the root window of ClientRoots. // including the root window of ClientRoots.
class COMPONENT_EXPORT(WINDOW_SERVICE) WindowData { class COMPONENT_EXPORT(WINDOW_SERVICE) ClientWindow {
public: public:
~WindowData(); ~ClientWindow();
// Creates a new WindowData. The lifetime of the WindowData is tied to that // Creates a new ClientWindow. The lifetime of the ClientWindow is tied to
// of the Window (the Window ends up owning the WindowData). // that of the Window (the Window ends up owning the ClientWindow).
static WindowData* Create(aura::Window* window, static ClientWindow* Create(aura::Window* window,
WindowServiceClient* client, WindowServiceClient* client,
const viz::FrameSinkId& frame_sink_id); const viz::FrameSinkId& frame_sink_id);
// Returns the WindowData associated with a window, null if not created yet. // Returns the ClientWindow associated with a window, null if not created yet.
static WindowData* GetMayBeNull(aura::Window* window) { static ClientWindow* GetMayBeNull(aura::Window* window) {
return const_cast<WindowData*>( return const_cast<ClientWindow*>(
GetMayBeNull(const_cast<const aura::Window*>(window))); GetMayBeNull(const_cast<const aura::Window*>(window)));
} }
static const WindowData* GetMayBeNull(const aura::Window* window); static const ClientWindow* GetMayBeNull(const aura::Window* window);
WindowServiceClient* owning_window_service_client() { WindowServiceClient* owning_window_service_client() {
return owning_window_service_client_; return owning_window_service_client_;
...@@ -66,7 +66,7 @@ class COMPONENT_EXPORT(WINDOW_SERVICE) WindowData { ...@@ -66,7 +66,7 @@ class COMPONENT_EXPORT(WINDOW_SERVICE) WindowData {
viz::mojom::CompositorFrameSinkClientPtr client); viz::mojom::CompositorFrameSinkClientPtr client);
private: private:
WindowData(aura::Window*, ClientWindow(aura::Window*,
WindowServiceClient* client, WindowServiceClient* client,
const viz::FrameSinkId& frame_sink_id); const viz::FrameSinkId& frame_sink_id);
...@@ -99,10 +99,10 @@ class COMPONENT_EXPORT(WINDOW_SERVICE) WindowData { ...@@ -99,10 +99,10 @@ class COMPONENT_EXPORT(WINDOW_SERVICE) WindowData {
// window. // window.
std::unique_ptr<WindowHostFrameSinkClient> window_host_frame_sink_client_; std::unique_ptr<WindowHostFrameSinkClient> window_host_frame_sink_client_;
DISALLOW_COPY_AND_ASSIGN(WindowData); DISALLOW_COPY_AND_ASSIGN(ClientWindow);
}; };
} // namespace ws2 } // namespace ws2
} // namespace ui } // namespace ui
#endif // SERVICES_UI_WS2_WINDOW_DATA_H_ #endif // SERVICES_UI_WS2_CLIENT_WINDOW_H_
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "services/ui/ws2/window_host_frame_sink_client.h" #include "services/ui/ws2/window_host_frame_sink_client.h"
#include "base/logging.h" #include "base/logging.h"
#include "services/ui/ws2/window_data.h"
#include "ui/aura/mus/client_surface_embedder.h" #include "ui/aura/mus/client_surface_embedder.h"
namespace ui { namespace ui {
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "services/ui/ws2/client_window.h"
#include "services/ui/ws2/gpu_support.h" #include "services/ui/ws2/gpu_support.h"
#include "services/ui/ws2/window_data.h"
#include "services/ui/ws2/window_service_client.h" #include "services/ui/ws2/window_service_client.h"
#include "services/ui/ws2/window_service_delegate.h" #include "services/ui/ws2/window_service_delegate.h"
#include "services/ui/ws2/window_tree_factory.h" #include "services/ui/ws2/window_tree_factory.h"
...@@ -26,16 +26,16 @@ WindowService::WindowService(WindowServiceDelegate* delegate, ...@@ -26,16 +26,16 @@ WindowService::WindowService(WindowServiceDelegate* delegate,
WindowService::~WindowService() {} WindowService::~WindowService() {}
WindowData* WindowService::GetWindowDataForWindowCreateIfNecessary( ClientWindow* WindowService::GetClientWindowForWindowCreateIfNecessary(
aura::Window* window) { aura::Window* window) {
WindowData* data = WindowData::GetMayBeNull(window); ClientWindow* client_window = ClientWindow::GetMayBeNull(window);
if (data) if (client_window)
return data; return client_window;
const viz::FrameSinkId frame_sink_id = const viz::FrameSinkId frame_sink_id =
ClientWindowId(kWindowServerClientId, next_window_id_++); ClientWindowId(kWindowServerClientId, next_window_id_++);
CHECK_NE(0u, next_window_id_); CHECK_NE(0u, next_window_id_);
return WindowData::Create(window, nullptr, frame_sink_id); return ClientWindow::Create(window, nullptr, frame_sink_id);
} }
std::unique_ptr<WindowServiceClient> WindowService::CreateWindowServiceClient( std::unique_ptr<WindowServiceClient> WindowService::CreateWindowServiceClient(
......
...@@ -29,8 +29,8 @@ class WindowTreeClient; ...@@ -29,8 +29,8 @@ class WindowTreeClient;
namespace ws2 { namespace ws2 {
class ClientWindow;
class GpuSupport; class GpuSupport;
class WindowData;
class WindowServiceClient; class WindowServiceClient;
class WindowServiceDelegate; class WindowServiceDelegate;
class WindowTreeFactory; class WindowTreeFactory;
...@@ -47,8 +47,8 @@ class COMPONENT_EXPORT(WINDOW_SERVICE) WindowService ...@@ -47,8 +47,8 @@ class COMPONENT_EXPORT(WINDOW_SERVICE) WindowService
std::unique_ptr<GpuSupport> gpu_support); std::unique_ptr<GpuSupport> gpu_support);
~WindowService() override; ~WindowService() override;
// Gets the WindowData for |window|, creating if necessary. // Gets the ClientWindow for |window|, creating if necessary.
WindowData* GetWindowDataForWindowCreateIfNecessary(aura::Window* window); ClientWindow* GetClientWindowForWindowCreateIfNecessary(aura::Window* window);
// Creates a new WindowServiceClient, caller must call one of the Init() // Creates a new WindowServiceClient, caller must call one of the Init()
// functions on the returned object. // functions on the returned object.
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include "services/ui/ws2/client_change.h" #include "services/ui/ws2/client_change.h"
#include "services/ui/ws2/client_change_tracker.h" #include "services/ui/ws2/client_change_tracker.h"
#include "services/ui/ws2/client_root.h" #include "services/ui/ws2/client_root.h"
#include "services/ui/ws2/window_data.h" #include "services/ui/ws2/client_window.h"
#include "services/ui/ws2/window_service.h" #include "services/ui/ws2/window_service.h"
#include "services/ui/ws2/window_service_client_binding.h" #include "services/ui/ws2/window_service_client_binding.h"
#include "services/ui/ws2/window_service_delegate.h" #include "services/ui/ws2/window_service_delegate.h"
...@@ -40,10 +40,10 @@ WindowServiceClient::WindowServiceClient(WindowService* window_service, ...@@ -40,10 +40,10 @@ WindowServiceClient::WindowServiceClient(WindowService* window_service,
void WindowServiceClient::InitForEmbed(aura::Window* root, void WindowServiceClient::InitForEmbed(aura::Window* root,
mojom::WindowTreePtr window_tree_ptr) { mojom::WindowTreePtr window_tree_ptr) {
// Force WindowData to be created for |root|. // Force ClientWindow to be created for |root|.
WindowData* window_data = ClientWindow* client_window =
window_service_->GetWindowDataForWindowCreateIfNecessary(root); window_service_->GetClientWindowForWindowCreateIfNecessary(root);
const ClientWindowId client_window_id = window_data->frame_sink_id(); const ClientWindowId client_window_id = client_window->frame_sink_id();
AddWindowToKnownWindows(root, client_window_id); AddWindowToKnownWindows(root, client_window_id);
CreateClientRoot(root, std::move(window_tree_ptr)); CreateClientRoot(root, std::move(window_tree_ptr));
...@@ -78,9 +78,9 @@ ClientRoot* WindowServiceClient::CreateClientRoot( ...@@ -78,9 +78,9 @@ ClientRoot* WindowServiceClient::CreateClientRoot(
mojom::WindowTreePtr window_tree) { mojom::WindowTreePtr window_tree) {
OnWillBecomeClientRootWindow(window); OnWillBecomeClientRootWindow(window);
WindowData* window_data = WindowData::GetMayBeNull(window); ClientWindow* client_window = ClientWindow::GetMayBeNull(window);
DCHECK(window_data); DCHECK(client_window);
const ClientWindowId client_window_id = window_data->frame_sink_id(); const ClientWindowId client_window_id = client_window->frame_sink_id();
const bool for_embed = window_tree.is_bound(); const bool for_embed = window_tree.is_bound();
...@@ -103,7 +103,7 @@ ClientRoot* WindowServiceClient::CreateClientRoot( ...@@ -103,7 +103,7 @@ ClientRoot* WindowServiceClient::CreateClientRoot(
// Reset the frame sink id locally (after calling OnEmbed()). This is // Reset the frame sink id locally (after calling OnEmbed()). This is
// needed so that the id used by the client matches the id used locally. // needed so that the id used by the client matches the id used locally.
window_data->SetFrameSinkId(ClientWindowId(client_id_, 0)); client_window->SetFrameSinkId(ClientWindowId(client_id_, 0));
} }
// TODO(sky): centralize FrameSinkId management. // TODO(sky): centralize FrameSinkId management.
...@@ -114,7 +114,7 @@ ClientRoot* WindowServiceClient::CreateClientRoot( ...@@ -114,7 +114,7 @@ ClientRoot* WindowServiceClient::CreateClientRoot(
// TODO(sky): centralize FrameSinkId management. // TODO(sky): centralize FrameSinkId management.
window_tree_client_->OnFrameSinkIdAllocated( window_tree_client_->OnFrameSinkIdAllocated(
ClientWindowIdToTransportId(client_window_id), ClientWindowIdToTransportId(client_window_id),
window_data->frame_sink_id()); client_window->frame_sink_id());
} }
return client_root; return client_root;
...@@ -159,16 +159,16 @@ void WindowServiceClient::DeleteClientRoot(ClientRoot* client_root, ...@@ -159,16 +159,16 @@ void WindowServiceClient::DeleteClientRoot(ClientRoot* client_root,
if (reason == DeleteClientRootReason::kUnembed) { if (reason == DeleteClientRootReason::kUnembed) {
// Notify the owner of the window it no longer has a client embedded in it. // Notify the owner of the window it no longer has a client embedded in it.
WindowData* window_data = WindowData::GetMayBeNull(window); ClientWindow* client_window = ClientWindow::GetMayBeNull(window);
if (window_data->owning_window_service_client() && if (client_window->owning_window_service_client() &&
window_data->owning_window_service_client() != this) { client_window->owning_window_service_client() != this) {
// ClientRoots always trigger creation of a WindowData, so |window_data| // ClientRoots always trigger creation of a ClientWindow, so
// must exist at this point. // |client_window| must exist at this point.
DCHECK(window_data); DCHECK(client_window);
window_data->owning_window_service_client() client_window->owning_window_service_client()
->window_tree_client_->OnEmbeddedAppDisconnected( ->window_tree_client_->OnEmbeddedAppDisconnected(
window_data->owning_window_service_client()->TransportIdForWindow( client_window->owning_window_service_client()
window)); ->TransportIdForWindow(window));
} }
} }
} }
...@@ -215,10 +215,10 @@ bool WindowServiceClient::IsWindowKnown(aura::Window* window) const { ...@@ -215,10 +215,10 @@ bool WindowServiceClient::IsWindowKnown(aura::Window* window) const {
bool WindowServiceClient::IsWindowRootOfAnotherClient( bool WindowServiceClient::IsWindowRootOfAnotherClient(
aura::Window* window) const { aura::Window* window) const {
WindowData* window_data = WindowData::GetMayBeNull(window); ClientWindow* client_window = ClientWindow::GetMayBeNull(window);
return window_data && return client_window &&
window_data->embedded_window_service_client() != nullptr && client_window->embedded_window_service_client() != nullptr &&
window_data->embedded_window_service_client() != this; client_window->embedded_window_service_client() != this;
} }
aura::Window* WindowServiceClient::AddClientCreatedWindow( aura::Window* WindowServiceClient::AddClientCreatedWindow(
...@@ -226,7 +226,7 @@ aura::Window* WindowServiceClient::AddClientCreatedWindow( ...@@ -226,7 +226,7 @@ aura::Window* WindowServiceClient::AddClientCreatedWindow(
std::unique_ptr<aura::Window> window_ptr) { std::unique_ptr<aura::Window> window_ptr) {
aura::Window* window = window_ptr.get(); aura::Window* window = window_ptr.get();
client_created_windows_.insert(std::move(window_ptr)); client_created_windows_.insert(std::move(window_ptr));
WindowData::Create(window, this, id); ClientWindow::Create(window, this, id);
AddWindowToKnownWindows(window, id); AddWindowToKnownWindows(window, id);
return window; return window;
} }
...@@ -320,31 +320,31 @@ mojom::WindowDataPtr WindowServiceClient::WindowToWindowData( ...@@ -320,31 +320,31 @@ mojom::WindowDataPtr WindowServiceClient::WindowToWindowData(
parent = nullptr; parent = nullptr;
if (!IsWindowKnown(transient_parent)) if (!IsWindowKnown(transient_parent))
transient_parent = nullptr; transient_parent = nullptr;
mojom::WindowDataPtr window_data(mojom::WindowData::New()); mojom::WindowDataPtr client_window(mojom::WindowData::New());
window_data->parent_id = client_window->parent_id =
parent ? TransportIdForWindow(parent) : kInvalidTransportId; parent ? TransportIdForWindow(parent) : kInvalidTransportId;
window_data->window_id = client_window->window_id =
window ? TransportIdForWindow(window) : kInvalidTransportId; window ? TransportIdForWindow(window) : kInvalidTransportId;
window_data->transient_parent_id = client_window->transient_parent_id =
transient_parent ? TransportIdForWindow(transient_parent) transient_parent ? TransportIdForWindow(transient_parent)
: kInvalidTransportId; : kInvalidTransportId;
window_data->bounds = window->bounds(); client_window->bounds = window->bounds();
// TODO: use property mapping. // TODO: use property mapping.
window_data->visible = window->TargetVisibility(); client_window->visible = window->TargetVisibility();
return window_data; return client_window;
} }
void WindowServiceClient::OnWillBecomeClientRootWindow(aura::Window* window) { void WindowServiceClient::OnWillBecomeClientRootWindow(aura::Window* window) {
DCHECK(window); DCHECK(window);
// Only one client may be embedded in a window at a time. // Only one client may be embedded in a window at a time.
WindowData* window_data = ClientWindow* client_window =
window_service_->GetWindowDataForWindowCreateIfNecessary(window); window_service_->GetClientWindowForWindowCreateIfNecessary(window);
if (window_data->embedded_window_service_client()) { if (client_window->embedded_window_service_client()) {
window_data->embedded_window_service_client()->DeleteClientRootWithRoot( client_window->embedded_window_service_client()->DeleteClientRootWithRoot(
window); window);
DCHECK(!window_data->embedded_window_service_client()); DCHECK(!client_window->embedded_window_service_client());
} }
// Because a new client is being embedded all existing children are removed. // Because a new client is being embedded all existing children are removed.
...@@ -670,7 +670,7 @@ void WindowServiceClient::NewTopLevelWindow( ...@@ -670,7 +670,7 @@ void WindowServiceClient::NewTopLevelWindow(
top_level_ptr->set_owned_by_parent(false); top_level_ptr->set_owned_by_parent(false);
aura::Window* top_level = aura::Window* top_level =
AddClientCreatedWindow(client_window_id, std::move(top_level_ptr)); AddClientCreatedWindow(client_window_id, std::move(top_level_ptr));
WindowData::GetMayBeNull(top_level)->SetFrameSinkId(client_window_id); ClientWindow::GetMayBeNull(top_level)->SetFrameSinkId(client_window_id);
const int64_t display_id = const int64_t display_id =
display::Screen::GetScreen()->GetDisplayNearestWindow(top_level).id(); display::Screen::GetScreen()->GetDisplayNearestWindow(top_level).id();
// This passes null for the mojom::WindowTreePtr because the client has // This passes null for the mojom::WindowTreePtr because the client has
...@@ -775,18 +775,19 @@ void WindowServiceClient::AttachCompositorFrameSink( ...@@ -775,18 +775,19 @@ void WindowServiceClient::AttachCompositorFrameSink(
DVLOG(1) << "AttachCompositorFrameSink failed (invalid window id)"; DVLOG(1) << "AttachCompositorFrameSink failed (invalid window id)";
return; return;
} }
WindowData* window_data = WindowData::GetMayBeNull(window); ClientWindow* client_window = ClientWindow::GetMayBeNull(window);
// If this isn't called on the root, then only allow it if there is not // If this isn't called on the root, then only allow it if there is not
// another client embedded in the window. // another client embedded in the window.
const bool allow = IsClientRootWindow(window) || const bool allow =
IsClientRootWindow(window) ||
(IsClientCreatedWindow(window) && (IsClientCreatedWindow(window) &&
window_data->embedded_window_service_client() == nullptr); client_window->embedded_window_service_client() == nullptr);
if (!allow) { if (!allow) {
DVLOG(1) << "AttachCompositorFrameSink failed (policy disallowed)"; DVLOG(1) << "AttachCompositorFrameSink failed (policy disallowed)";
return; return;
} }
window_data->AttachCompositorFrameSink(std::move(compositor_frame_sink), client_window->AttachCompositorFrameSink(std::move(compositor_frame_sink),
std::move(client)); std::move(client));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment