summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/mus/mus_app.cc12
-rw-r--r--components/mus/mus_app.h4
-rw-r--r--components/mus/ws/BUILD.gn8
-rw-r--r--components/mus/ws/access_policy.h2
-rw-r--r--components/mus/ws/access_policy_delegate.h4
-rw-r--r--components/mus/ws/connection_manager.cc101
-rw-r--r--components/mus/ws/connection_manager.h69
-rw-r--r--components/mus/ws/connection_manager_delegate.h10
-rw-r--r--components/mus/ws/default_access_policy.cc6
-rw-r--r--components/mus/ws/display.cc92
-rw-r--r--components/mus/ws/display.h4
-rw-r--r--components/mus/ws/display_binding.cc6
-rw-r--r--components/mus/ws/display_binding.h6
-rw-r--r--components/mus/ws/display_unittest.cc32
-rw-r--r--components/mus/ws/ids.h10
-rw-r--r--components/mus/ws/operation.cc6
-rw-r--r--components/mus/ws/operation.h24
-rw-r--r--components/mus/ws/test_utils.cc24
-rw-r--r--components/mus/ws/test_utils.h30
-rw-r--r--components/mus/ws/window_manager_access_policy.cc2
-rw-r--r--components/mus/ws/window_manager_factory_service.cc2
-rw-r--r--components/mus/ws/window_manager_state.h8
-rw-r--r--components/mus/ws/window_tree.cc (renamed from components/mus/ws/window_tree_impl.cc)387
-rw-r--r--components/mus/ws/window_tree.h (renamed from components/mus/ws/window_tree_impl.h)91
-rw-r--r--components/mus/ws/window_tree_apptest.cc680
-rw-r--r--components/mus/ws/window_tree_binding.cc (renamed from components/mus/ws/client_connection.cc)28
-rw-r--r--components/mus/ws/window_tree_binding.h (renamed from components/mus/ws/client_connection.h)46
-rw-r--r--components/mus/ws/window_tree_factory.cc17
-rw-r--r--components/mus/ws/window_tree_unittest.cc255
29 files changed, 942 insertions, 1024 deletions
diff --git a/components/mus/mus_app.cc b/components/mus/mus_app.cc
index 43b878b..1b42c95 100644
--- a/components/mus/mus_app.cc
+++ b/components/mus/mus_app.cc
@@ -12,12 +12,12 @@
#include "build/build_config.h"
#include "components/mus/common/args.h"
#include "components/mus/gles2/gpu_impl.h"
-#include "components/mus/ws/client_connection.h"
#include "components/mus/ws/connection_manager.h"
#include "components/mus/ws/display.h"
#include "components/mus/ws/display_binding.h"
+#include "components/mus/ws/window_tree.h"
+#include "components/mus/ws/window_tree_binding.h"
#include "components/mus/ws/window_tree_factory.h"
-#include "components/mus/ws/window_tree_impl.h"
#include "components/resource_provider/public/cpp/resource_loader.h"
#include "mojo/public/c/system/main.h"
#include "mojo/services/tracing/public/cpp/tracing_impl.h"
@@ -161,13 +161,13 @@ void MandolineUIServicesApp::OnNoMoreRootConnections() {
base::MessageLoop::current()->QuitWhenIdle();
}
-scoped_ptr<ws::ClientConnection>
-MandolineUIServicesApp::CreateClientConnectionForEmbedAtWindow(
+scoped_ptr<ws::WindowTreeBinding>
+MandolineUIServicesApp::CreateWindowTreeBindingForEmbedAtWindow(
ws::ConnectionManager* connection_manager,
- ws::WindowTreeImpl* tree,
+ ws::WindowTree* tree,
mojom::WindowTreeRequest tree_request,
mojom::WindowTreeClientPtr client) {
- return make_scoped_ptr(new ws::DefaultClientConnection(
+ return make_scoped_ptr(new ws::DefaultWindowTreeBinding(
tree, connection_manager, std::move(tree_request), std::move(client)));
}
diff --git a/components/mus/mus_app.h b/components/mus/mus_app.h
index c6d791d..2e2193f 100644
--- a/components/mus/mus_app.h
+++ b/components/mus/mus_app.h
@@ -70,9 +70,9 @@ class MandolineUIServicesApp
// ConnectionManagerDelegate:
void OnFirstDisplayReady() override;
void OnNoMoreRootConnections() override;
- scoped_ptr<ws::ClientConnection> CreateClientConnectionForEmbedAtWindow(
+ scoped_ptr<ws::WindowTreeBinding> CreateWindowTreeBindingForEmbedAtWindow(
ws::ConnectionManager* connection_manager,
- ws::WindowTreeImpl* tree,
+ ws::WindowTree* tree,
mojom::WindowTreeRequest tree_request,
mojom::WindowTreeClientPtr client) override;
void CreateDefaultDisplays() override;
diff --git a/components/mus/ws/BUILD.gn b/components/mus/ws/BUILD.gn
index 53201a3..7632904 100644
--- a/components/mus/ws/BUILD.gn
+++ b/components/mus/ws/BUILD.gn
@@ -11,8 +11,6 @@ source_set("lib") {
sources = [
"access_policy.h",
"access_policy_delegate.h",
- "client_connection.cc",
- "client_connection.h",
"connection_manager.cc",
"connection_manager.h",
"connection_manager_delegate.cc",
@@ -65,10 +63,12 @@ source_set("lib") {
"window_manager_factory_service.h",
"window_manager_state.cc",
"window_manager_state.h",
+ "window_tree.cc",
+ "window_tree.h",
+ "window_tree_binding.cc",
+ "window_tree_binding.h",
"window_tree_factory.cc",
"window_tree_factory.h",
- "window_tree_impl.cc",
- "window_tree_impl.h",
]
deps = [
diff --git a/components/mus/ws/access_policy.h b/components/mus/ws/access_policy.h
index ef1178f..81e2d3b 100644
--- a/components/mus/ws/access_policy.h
+++ b/components/mus/ws/access_policy.h
@@ -16,7 +16,7 @@ namespace ws {
class ServerWindow;
-// AccessPolicy is used by WindowTreeImpl to determine what a connection is
+// AccessPolicy is used by WindowTree to determine what the WindowTree is
// allowed to do.
class AccessPolicy {
public:
diff --git a/components/mus/ws/access_policy_delegate.h b/components/mus/ws/access_policy_delegate.h
index 39c32c7..9b049fb 100644
--- a/components/mus/ws/access_policy_delegate.h
+++ b/components/mus/ws/access_policy_delegate.h
@@ -19,7 +19,7 @@ class ServerWindow;
// Delegate used by the AccessPolicy implementations to get state.
class AccessPolicyDelegate {
public:
- // Returns true if the connection has |window| as one of its roots.
+ // Returns true if the tree has |window| as one of its roots.
virtual bool HasRootForAccessPolicy(const ServerWindow* window) const = 0;
// Returns true if |window| has been exposed to the client.
@@ -27,7 +27,7 @@ class AccessPolicyDelegate {
const ServerWindow* window) const = 0;
// Returns true if Embed(window) has been invoked on |window|.
- virtual bool IsWindowRootOfAnotherConnectionForAccessPolicy(
+ virtual bool IsWindowRootOfAnotherTreeForAccessPolicy(
const ServerWindow* window) const = 0;
// Returns true if SetEmbedRoot() was invoked and |window| is a descendant of
diff --git a/components/mus/ws/connection_manager.cc b/components/mus/ws/connection_manager.cc
index 888ddd0..0bd3a35 100644
--- a/components/mus/ws/connection_manager.cc
+++ b/components/mus/ws/connection_manager.cc
@@ -6,7 +6,6 @@
#include "base/logging.h"
#include "base/stl_util.h"
-#include "components/mus/ws/client_connection.h"
#include "components/mus/ws/connection_manager_delegate.h"
#include "components/mus/ws/display_binding.h"
#include "components/mus/ws/operation.h"
@@ -14,7 +13,8 @@
#include "components/mus/ws/window_coordinate_conversions.h"
#include "components/mus/ws/window_manager_factory_service.h"
#include "components/mus/ws/window_manager_state.h"
-#include "components/mus/ws/window_tree_impl.h"
+#include "components/mus/ws/window_tree.h"
+#include "components/mus/ws/window_tree_binding.h"
#include "mojo/converters/geometry/geometry_type_converters.h"
#include "mojo/converters/input_events/input_events_type_converters.h"
#include "mojo/converters/surfaces/surfaces_type_converters.h"
@@ -95,59 +95,55 @@ uint16_t ConnectionManager::GetAndAdvanceNextRootId() {
return id;
}
-WindowTreeImpl* ConnectionManager::EmbedAtWindow(
+WindowTree* ConnectionManager::EmbedAtWindow(
ServerWindow* root,
uint32_t policy_bitmask,
mojom::WindowTreeClientPtr client) {
- scoped_ptr<WindowTreeImpl> tree_ptr(
- new ws::WindowTreeImpl(this, root, policy_bitmask));
- WindowTreeImpl* tree = tree_ptr.get();
+ scoped_ptr<WindowTree> tree_ptr(
+ new ws::WindowTree(this, root, policy_bitmask));
+ WindowTree* tree = tree_ptr.get();
mojom::WindowTreePtr window_tree_ptr;
- scoped_ptr<ClientConnection> client_connection =
- delegate_->CreateClientConnectionForEmbedAtWindow(
+ scoped_ptr<WindowTreeBinding> binding =
+ delegate_->CreateWindowTreeBindingForEmbedAtWindow(
this, tree, GetProxy(&window_tree_ptr), std::move(client));
- AddTree(std::move(tree_ptr), std::move(client_connection),
- std::move(window_tree_ptr));
- OnConnectionMessagedClient(tree->id());
+ AddTree(std::move(tree_ptr), std::move(binding), std::move(window_tree_ptr));
+ OnTreeMessagedClient(tree->id());
return tree;
}
-WindowTreeImpl* ConnectionManager::AddTree(
- scoped_ptr<WindowTreeImpl> tree_impl_ptr,
- scoped_ptr<ClientConnection> connection,
- mojom::WindowTreePtr tree_ptr) {
+WindowTree* ConnectionManager::AddTree(scoped_ptr<WindowTree> tree_impl_ptr,
+ scoped_ptr<WindowTreeBinding> binding,
+ mojom::WindowTreePtr tree_ptr) {
CHECK_EQ(0u, tree_map_.count(tree_impl_ptr->id()));
- WindowTreeImpl* tree = tree_impl_ptr.get();
+ WindowTree* tree = tree_impl_ptr.get();
tree_map_[tree->id()] = std::move(tree_impl_ptr);
- tree->Init(std::move(connection), std::move(tree_ptr));
+ tree->Init(std::move(binding), std::move(tree_ptr));
return tree;
}
-WindowTreeImpl* ConnectionManager::CreateTreeForWindowManager(
+WindowTree* ConnectionManager::CreateTreeForWindowManager(
Display* display,
mojom::WindowManagerFactory* factory,
ServerWindow* root) {
mojom::DisplayPtr display_ptr = DisplayToMojomDisplay(display);
mojom::WindowTreeClientPtr tree_client;
factory->CreateWindowManager(std::move(display_ptr), GetProxy(&tree_client));
- scoped_ptr<ws::WindowTreeImpl> tree_ptr(new ws::WindowTreeImpl(
+ scoped_ptr<ws::WindowTree> tree_ptr(new ws::WindowTree(
this, root, mojom::WindowTree::kAccessPolicyEmbedRoot));
- ws::WindowTreeImpl* tree = tree_ptr.get();
- scoped_ptr<ws::DefaultClientConnection> connection(
- new ws::DefaultClientConnection(tree_ptr.get(), this,
- std::move(tree_client)));
- mojom::WindowTreePtr window_tree_ptr =
- connection->CreateInterfacePtrAndBind();
- AddTree(std::move(tree_ptr), std::move(connection),
- std::move(window_tree_ptr));
+ ws::WindowTree* tree = tree_ptr.get();
+ scoped_ptr<ws::DefaultWindowTreeBinding> binding(
+ new ws::DefaultWindowTreeBinding(tree_ptr.get(), this,
+ std::move(tree_client)));
+ mojom::WindowTreePtr window_tree_ptr = binding->CreateInterfacePtrAndBind();
+ AddTree(std::move(tree_ptr), std::move(binding), std::move(window_tree_ptr));
tree->ConfigureWindowManager();
return tree;
}
-void ConnectionManager::DestroyTree(WindowTreeImpl* tree) {
- scoped_ptr<WindowTreeImpl> tree_ptr;
+void ConnectionManager::DestroyTree(WindowTree* tree) {
+ scoped_ptr<WindowTree> tree_ptr;
{
auto iter = tree_map_.find(tree->id());
DCHECK(iter != tree_map_.end());
@@ -180,7 +176,7 @@ void ConnectionManager::DestroyTree(WindowTreeImpl* tree) {
in_flight_wm_change_map_.erase(id);
}
-WindowTreeImpl* ConnectionManager::GetConnection(
+WindowTree* ConnectionManager::GetTreeWithId(
ConnectionSpecificId connection_id) {
auto iter = tree_map_.find(connection_id);
return iter == tree_map_.end() ? nullptr : iter->second.get();
@@ -195,8 +191,8 @@ ServerWindow* ConnectionManager::GetWindow(const WindowId& id) {
return window;
}
}
- WindowTreeImpl* service = GetConnection(id.connection_id);
- return service ? service->GetWindow(id) : nullptr;
+ WindowTree* tree = GetTreeWithId(id.connection_id);
+ return tree ? tree->GetWindow(id) : nullptr;
}
void ConnectionManager::SchedulePaint(const ServerWindow* window,
@@ -217,14 +213,13 @@ void ConnectionManager::OnDisplayAcceleratedWidgetAvailable(Display* display) {
delegate_->OnFirstDisplayReady();
}
-void ConnectionManager::OnConnectionMessagedClient(ConnectionSpecificId id) {
+void ConnectionManager::OnTreeMessagedClient(ConnectionSpecificId id) {
if (current_operation_)
- current_operation_->MarkConnectionAsMessaged(id);
+ current_operation_->MarkTreeAsMessaged(id);
}
-bool ConnectionManager::DidConnectionMessageClient(
- ConnectionSpecificId id) const {
- return current_operation_ && current_operation_->DidMessageConnection(id);
+bool ConnectionManager::DidTreeMessageClient(ConnectionSpecificId id) const {
+ return current_operation_ && current_operation_->DidMessageTree(id);
}
mojom::ViewportMetricsPtr ConnectionManager::GetViewportMetricsForWindow(
@@ -241,7 +236,7 @@ mojom::ViewportMetricsPtr ConnectionManager::GetViewportMetricsForWindow(
return metrics;
}
-const WindowTreeImpl* ConnectionManager::GetConnectionWithRoot(
+const WindowTree* ConnectionManager::GetTreeWithRoot(
const ServerWindow* window) const {
if (!window)
return nullptr;
@@ -321,7 +316,7 @@ void ConnectionManager::OnFirstWindowManagerFactorySet() {
}
uint32_t ConnectionManager::GenerateWindowManagerChangeId(
- WindowTreeImpl* source,
+ WindowTree* source,
uint32_t client_change_id) {
const uint32_t wm_change_id = next_wm_change_id_++;
in_flight_wm_change_map_[wm_change_id] = {source->id(), client_change_id};
@@ -337,12 +332,12 @@ void ConnectionManager::WindowManagerChangeCompleted(
return;
}
- WindowTreeImpl* connection = GetConnection(change.connection_id);
- connection->OnChangeCompleted(change.client_change_id, success);
+ WindowTree* tree = GetTreeWithId(change.connection_id);
+ tree->OnChangeCompleted(change.client_change_id, success);
}
void ConnectionManager::WindowManagerCreatedTopLevelWindow(
- WindowTreeImpl* wm_connection,
+ WindowTree* wm_tree,
uint32_t window_manager_change_id,
const ServerWindow* window) {
InFlightWindowManagerChange change;
@@ -355,18 +350,18 @@ void ConnectionManager::WindowManagerCreatedTopLevelWindow(
return;
}
- WindowTreeImpl* connection = GetConnection(change.connection_id);
+ WindowTree* tree = GetTreeWithId(change.connection_id);
// The window manager should have created the window already, and it should
// be ready for embedding.
- if (!connection->IsWaitingForNewTopLevelWindow(window_manager_change_id) ||
- !window || window->id().connection_id != wm_connection->id() ||
- !window->children().empty() || GetConnectionWithRoot(window)) {
+ if (!tree->IsWaitingForNewTopLevelWindow(window_manager_change_id) ||
+ !window || window->id().connection_id != wm_tree->id() ||
+ !window->children().empty() || GetTreeWithRoot(window)) {
WindowManagerSentBogusMessage();
return;
}
- connection->OnWindowManagerCreatedTopLevelWindow(
- window_manager_change_id, change.client_change_id, window);
+ tree->OnWindowManagerCreatedTopLevelWindow(window_manager_change_id,
+ change.client_change_id, window);
}
mojom::DisplayPtr ConnectionManager::DisplayToMojomDisplay(Display* display) {
@@ -600,7 +595,7 @@ ServerWindow* ConnectionManager::FindWindowForSurface(
const ServerWindow* ancestor,
mojom::SurfaceType surface_type,
const ClientWindowId& client_window_id) {
- WindowTreeImpl* window_tree;
+ WindowTree* window_tree;
if (ancestor->id().connection_id == kInvalidConnectionId) {
WindowManagerAndDisplay wm_and_display =
GetWindowManagerAndDisplay(ancestor);
@@ -608,15 +603,15 @@ ServerWindow* ConnectionManager::FindWindowForSurface(
? wm_and_display.window_manager_state->tree()
: nullptr;
} else {
- window_tree = GetConnection(ancestor->id().connection_id);
+ window_tree = GetTreeWithId(ancestor->id().connection_id);
}
if (!window_tree)
return nullptr;
if (surface_type == mojom::SurfaceType::DEFAULT) {
// At embed points the default surface comes from the embedded app.
- WindowTreeImpl* connection_with_root = GetConnectionWithRoot(ancestor);
- if (connection_with_root)
- window_tree = connection_with_root;
+ WindowTree* tree_with_root = GetTreeWithRoot(ancestor);
+ if (tree_with_root)
+ window_tree = tree_with_root;
}
return window_tree->GetWindowByClientId(client_window_id);
}
diff --git a/components/mus/ws/connection_manager.h b/components/mus/ws/connection_manager.h
index cbe7f8b..b341bcd 100644
--- a/components/mus/ws/connection_manager.h
+++ b/components/mus/ws/connection_manager.h
@@ -35,11 +35,11 @@
namespace mus {
namespace ws {
-class ClientConnection;
class ConnectionManagerDelegate;
class ServerWindow;
class WindowManagerState;
-class WindowTreeImpl;
+class WindowTree;
+class WindowTreeBinding;
struct WindowManagerAndDisplay {
WindowManagerAndDisplay() : window_manager_state(nullptr), display(nullptr) {}
@@ -56,7 +56,7 @@ struct WindowManagerAndDisplayConst {
};
// ConnectionManager manages the set of connections to the window server (all
-// the WindowTreeImpls) as well as providing the root of the hierarchy.
+// the WindowTrees) as well as providing the root of the hierarchy.
//
// TODO(sky): this class is doing too much. Refactor to make responsibilities
// clearer.
@@ -83,7 +83,7 @@ class ConnectionManager : public ServerWindowDelegate,
const WindowId& id,
const std::map<std::string, std::vector<uint8_t>>& properties);
- // Returns the id for the next WindowTreeImpl.
+ // Returns the id for the next WindowTree.
ConnectionSpecificId GetAndAdvanceNextConnectionId();
// Returns the id for the next root window (both for the root of a Display
@@ -92,24 +92,23 @@ class ConnectionManager : public ServerWindowDelegate,
// See description of WindowTree::Embed() for details. This assumes
// |transport_window_id| is valid.
- WindowTreeImpl* EmbedAtWindow(ServerWindow* root,
- uint32_t policy_bitmask,
- mojom::WindowTreeClientPtr client);
+ WindowTree* EmbedAtWindow(ServerWindow* root,
+ uint32_t policy_bitmask,
+ mojom::WindowTreeClientPtr client);
// Adds |tree_impl_ptr| to the set of known trees. Use DestroyTree() to
// destroy the tree.
- WindowTreeImpl* AddTree(scoped_ptr<WindowTreeImpl> tree_impl_ptr,
- scoped_ptr<ClientConnection> connection,
- mojom::WindowTreePtr tree_ptr);
- WindowTreeImpl* CreateTreeForWindowManager(
- Display* display,
- mojom::WindowManagerFactory* factory,
- ServerWindow* root);
- // Invoked when a WindowTreeImpl's connection encounters an error.
- void DestroyTree(WindowTreeImpl* tree);
+ WindowTree* AddTree(scoped_ptr<WindowTree> tree_impl_ptr,
+ scoped_ptr<WindowTreeBinding> binding,
+ mojom::WindowTreePtr tree_ptr);
+ WindowTree* CreateTreeForWindowManager(Display* display,
+ mojom::WindowManagerFactory* factory,
+ ServerWindow* root);
+ // Invoked when a WindowTree's connection encounters an error.
+ void DestroyTree(WindowTree* tree);
// Returns the connection by id.
- WindowTreeImpl* GetConnection(ConnectionSpecificId connection_id);
+ WindowTree* GetTreeWithId(ConnectionSpecificId connection_id);
size_t num_trees() const { return tree_map_.size(); }
@@ -132,23 +131,22 @@ class ConnectionManager : public ServerWindowDelegate,
// Invoked when a connection messages a client about the change. This is used
// to avoid sending ServerChangeIdAdvanced() unnecessarily.
- void OnConnectionMessagedClient(ConnectionSpecificId id);
+ void OnTreeMessagedClient(ConnectionSpecificId id);
- // Returns true if OnConnectionMessagedClient() was invoked for id.
- bool DidConnectionMessageClient(ConnectionSpecificId id) const;
+ // Returns true if OnTreeMessagedClient() was invoked for id.
+ bool DidTreeMessageClient(ConnectionSpecificId id) const;
// Returns the metrics of the viewport where the provided |window| is
// displayed.
mojom::ViewportMetricsPtr GetViewportMetricsForWindow(
const ServerWindow* window);
- // Returns the WindowTreeImpl that has |id| as a root.
- WindowTreeImpl* GetConnectionWithRoot(const ServerWindow* window) {
- return const_cast<WindowTreeImpl*>(
- const_cast<const ConnectionManager*>(this)
- ->GetConnectionWithRoot(window));
+ // Returns the WindowTree that has |id| as a root.
+ WindowTree* GetTreeWithRoot(const ServerWindow* window) {
+ return const_cast<WindowTree*>(
+ const_cast<const ConnectionManager*>(this)->GetTreeWithRoot(window));
}
- const WindowTreeImpl* GetConnectionWithRoot(const ServerWindow* window) const;
+ const WindowTree* GetTreeWithRoot(const ServerWindow* window) const;
// Returns the Display that contains |window|, or null if |window| is not
// attached to a display.
@@ -177,7 +175,7 @@ class ConnectionManager : public ServerWindowDelegate,
// |source| and |client_change_id|. When the window manager replies
// WindowManagerChangeCompleted() is called to obtain the original source
// and client supplied change_id that initiated the called.
- uint32_t GenerateWindowManagerChangeId(WindowTreeImpl* source,
+ uint32_t GenerateWindowManagerChangeId(WindowTree* source,
uint32_t client_change_id);
// Called when a response from the window manager is obtained. Calls to
@@ -185,7 +183,7 @@ class ConnectionManager : public ServerWindowDelegate,
// supplied by the client.
void WindowManagerChangeCompleted(uint32_t window_manager_change_id,
bool success);
- void WindowManagerCreatedTopLevelWindow(WindowTreeImpl* wm_connection,
+ void WindowManagerCreatedTopLevelWindow(WindowTree* wm_tree,
uint32_t window_manager_change_id,
const ServerWindow* window);
@@ -196,7 +194,7 @@ class ConnectionManager : public ServerWindowDelegate,
// Returns the Display for |display|.
mojom::DisplayPtr DisplayToMojomDisplay(Display* display);
- // These functions trivially delegate to all WindowTreeImpls, which in
+ // These functions trivially delegate to all WindowTrees, which in
// term notify their clients.
void ProcessWindowBoundsChanged(const ServerWindow* window,
const gfx::Rect& old_bounds,
@@ -226,8 +224,7 @@ class ConnectionManager : public ServerWindowDelegate,
private:
friend class Operation;
- using WindowTreeMap =
- std::map<ConnectionSpecificId, scoped_ptr<WindowTreeImpl>>;
+ using WindowTreeMap = std::map<ConnectionSpecificId, scoped_ptr<WindowTree>>;
struct InFlightWindowManagerChange {
// Identifies the client that initiated the change.
@@ -256,9 +253,9 @@ class ConnectionManager : public ServerWindowDelegate,
void FinishOperation();
// Returns true if the specified connection issued the current operation.
- bool IsOperationSource(ConnectionSpecificId connection_id) const {
+ bool IsOperationSource(ConnectionSpecificId tree_id) const {
return current_operation_ &&
- current_operation_->source_connection_id() == connection_id;
+ current_operation_->source_tree_id() == tree_id;
}
// Run in response to events which may cause us to change the native cursor.
@@ -323,13 +320,13 @@ class ConnectionManager : public ServerWindowDelegate,
// State for rendering into a Surface.
scoped_refptr<mus::SurfacesState> surfaces_state_;
- // ID to use for next WindowTreeImpl.
+ // ID to use for next WindowTree.
ConnectionSpecificId next_connection_id_;
// ID to use for next root node.
uint16_t next_root_id_;
- // Set of WindowTreeImpls.
+ // Set of WindowTrees.
WindowTreeMap tree_map_;
// Displays are initially added to |pending_displays_|. When the display is
@@ -339,7 +336,7 @@ class ConnectionManager : public ServerWindowDelegate,
std::set<Display*> displays_;
// If non-null then we're processing a client operation. The Operation is
- // not owned by us (it's created on the stack by WindowTreeImpl).
+ // not owned by us (it's created on the stack by WindowTree).
Operation* current_operation_;
bool in_destructor_;
diff --git a/components/mus/ws/connection_manager_delegate.h b/components/mus/ws/connection_manager_delegate.h
index 100b18c..ce4fad4 100644
--- a/components/mus/ws/connection_manager_delegate.h
+++ b/components/mus/ws/connection_manager_delegate.h
@@ -24,11 +24,11 @@ class WindowTree;
namespace ws {
-class ClientConnection;
class ConnectionManager;
class Display;
class ServerWindow;
-class WindowTreeImpl;
+class WindowTree;
+class WindowTreeBinding;
class ConnectionManagerDelegate {
public:
@@ -37,11 +37,11 @@ class ConnectionManagerDelegate {
virtual void OnNoMoreRootConnections() = 0;
- // Creates a ClientConnection in response to Embed() calls on the
+ // Creates a WindowTreeBinding in response to Embed() calls on the
// ConnectionManager.
- virtual scoped_ptr<ClientConnection> CreateClientConnectionForEmbedAtWindow(
+ virtual scoped_ptr<WindowTreeBinding> CreateWindowTreeBindingForEmbedAtWindow(
ws::ConnectionManager* connection_manager,
- ws::WindowTreeImpl* tree,
+ ws::WindowTree* tree,
mojom::WindowTreeRequest tree_request,
mojom::WindowTreeClientPtr client) = 0;
diff --git a/components/mus/ws/default_access_policy.cc b/components/mus/ws/default_access_policy.cc
index 615b8dc..d55c860 100644
--- a/components/mus/ws/default_access_policy.cc
+++ b/components/mus/ws/default_access_policy.cc
@@ -31,7 +31,7 @@ bool DefaultAccessPolicy::CanAddWindow(const ServerWindow* parent,
return WasCreatedByThisConnection(child) &&
(delegate_->HasRootForAccessPolicy(parent) ||
(WasCreatedByThisConnection(parent) &&
- !delegate_->IsWindowRootOfAnotherConnectionForAccessPolicy(parent)));
+ !delegate_->IsWindowRootOfAnotherTreeForAccessPolicy(parent)));
}
bool DefaultAccessPolicy::CanAddTransientWindow(
@@ -72,7 +72,7 @@ bool DefaultAccessPolicy::CanGetWindowTree(const ServerWindow* window) const {
bool DefaultAccessPolicy::CanDescendIntoWindowForWindowTree(
const ServerWindow* window) const {
return (WasCreatedByThisConnection(window) &&
- !delegate_->IsWindowRootOfAnotherConnectionForAccessPolicy(window)) ||
+ !delegate_->IsWindowRootOfAnotherTreeForAccessPolicy(window)) ||
delegate_->HasRootForAccessPolicy(window) ||
delegate_->IsDescendantOfEmbedRoot(window);
}
@@ -102,7 +102,7 @@ bool DefaultAccessPolicy::CanSetWindowSurface(
// Once a window embeds another app, the embedder app is no longer able to
// call SetWindowSurfaceId() - this ability is transferred to the embedded
// app.
- if (delegate_->IsWindowRootOfAnotherConnectionForAccessPolicy(window))
+ if (delegate_->IsWindowRootOfAnotherTreeForAccessPolicy(window))
return false;
return WasCreatedByThisConnection(window) ||
delegate_->HasRootForAccessPolicy(window);
diff --git a/components/mus/ws/display.cc b/components/mus/ws/display.cc
index d519669..52d140f5 100644
--- a/components/mus/ws/display.cc
+++ b/components/mus/ws/display.cc
@@ -7,7 +7,6 @@
#include "base/debug/debugger.h"
#include "base/strings/utf_string_conversions.h"
#include "components/mus/common/types.h"
-#include "components/mus/ws/client_connection.h"
#include "components/mus/ws/connection_manager.h"
#include "components/mus/ws/connection_manager_delegate.h"
#include "components/mus/ws/display_binding.h"
@@ -15,7 +14,8 @@
#include "components/mus/ws/platform_display.h"
#include "components/mus/ws/window_manager_factory_service.h"
#include "components/mus/ws/window_manager_state.h"
-#include "components/mus/ws/window_tree_impl.h"
+#include "components/mus/ws/window_tree.h"
+#include "components/mus/ws/window_tree_binding.h"
#include "mojo/common/common_type_converters.h"
#include "mojo/converters/geometry/geometry_type_converters.h"
#include "mojo/converters/input_events/input_events_type_converters.h"
@@ -245,7 +245,7 @@ void Display::SetImeVisibility(ServerWindow* window, bool visible) {
platform_display_->SetImeVisibility(visible);
}
-void Display::OnWindowTreeConnectionError(WindowTreeImpl* tree) {
+void Display::OnWindowTreeConnectionError(WindowTree* tree) {
for (auto it = window_manager_state_map_.begin();
it != window_manager_state_map_.end(); ++it) {
if (it->second->tree() == tree) {
@@ -360,13 +360,13 @@ void Display::DispatchInputEventToWindowImpl(ServerWindow* target,
// If the event is in the non-client area the event goes to the owner of
// the window. Otherwise if the window is an embed root, forward to the
// embedded window.
- WindowTreeImpl* connection =
+ WindowTree* tree =
in_nonclient_area
- ? connection_manager_->GetConnection(target->id().connection_id)
- : connection_manager_->GetConnectionWithRoot(target);
- if (!connection) {
+ ? connection_manager_->GetTreeWithId(target->id().connection_id)
+ : connection_manager_->GetTreeWithRoot(target);
+ if (!tree) {
DCHECK(!in_nonclient_area);
- connection = connection_manager_->GetConnection(target->id().connection_id);
+ tree = connection_manager_->GetTreeWithId(target->id().connection_id);
}
// TOOD(sad): Adjust this delay, possibly make this dynamic.
@@ -376,8 +376,8 @@ void Display::DispatchInputEventToWindowImpl(ServerWindow* target,
event_ack_timer_.Start(FROM_HERE, max_delay, this,
&Display::OnEventAckTimeout);
- tree_awaiting_input_ack_ = connection;
- connection->DispatchInputEvent(target, mojom::Event::From(event));
+ tree_awaiting_input_ack_ = tree;
+ tree->DispatchInputEvent(target, mojom::Event::From(event));
}
void Display::CreateWindowManagerStatesFromRegistry() {
@@ -497,58 +497,56 @@ void Display::OnFocusChanged(FocusControllerChangeSource change_source,
// . the connection with |new_focused_window| as its root.
// Some of these connections may be the same. The following takes care to
// notify each only once.
- WindowTreeImpl* owning_connection_old = nullptr;
- WindowTreeImpl* embedded_connection_old = nullptr;
+ WindowTree* owning_tree_old = nullptr;
+ WindowTree* embedded_tree_old = nullptr;
if (old_focused_window) {
- owning_connection_old = connection_manager_->GetConnection(
+ owning_tree_old = connection_manager_->GetTreeWithId(
old_focused_window->id().connection_id);
- if (owning_connection_old) {
- owning_connection_old->ProcessFocusChanged(old_focused_window,
- new_focused_window);
+ if (owning_tree_old) {
+ owning_tree_old->ProcessFocusChanged(old_focused_window,
+ new_focused_window);
}
- embedded_connection_old =
- connection_manager_->GetConnectionWithRoot(old_focused_window);
- if (embedded_connection_old) {
- DCHECK_NE(owning_connection_old, embedded_connection_old);
- embedded_connection_old->ProcessFocusChanged(old_focused_window,
- new_focused_window);
+ embedded_tree_old =
+ connection_manager_->GetTreeWithRoot(old_focused_window);
+ if (embedded_tree_old) {
+ DCHECK_NE(owning_tree_old, embedded_tree_old);
+ embedded_tree_old->ProcessFocusChanged(old_focused_window,
+ new_focused_window);
}
}
- WindowTreeImpl* owning_connection_new = nullptr;
- WindowTreeImpl* embedded_connection_new = nullptr;
+ WindowTree* owning_tree_new = nullptr;
+ WindowTree* embedded_tree_new = nullptr;
if (new_focused_window) {
- owning_connection_new = connection_manager_->GetConnection(
+ owning_tree_new = connection_manager_->GetTreeWithId(
new_focused_window->id().connection_id);
- if (owning_connection_new &&
- owning_connection_new != owning_connection_old &&
- owning_connection_new != embedded_connection_old) {
- owning_connection_new->ProcessFocusChanged(old_focused_window,
- new_focused_window);
+ if (owning_tree_new && owning_tree_new != owning_tree_old &&
+ owning_tree_new != embedded_tree_old) {
+ owning_tree_new->ProcessFocusChanged(old_focused_window,
+ new_focused_window);
}
- embedded_connection_new =
- connection_manager_->GetConnectionWithRoot(new_focused_window);
- if (embedded_connection_new &&
- embedded_connection_new != owning_connection_old &&
- embedded_connection_new != embedded_connection_old) {
- DCHECK_NE(owning_connection_new, embedded_connection_new);
- embedded_connection_new->ProcessFocusChanged(old_focused_window,
- new_focused_window);
+ embedded_tree_new =
+ connection_manager_->GetTreeWithRoot(new_focused_window);
+ if (embedded_tree_new && embedded_tree_new != owning_tree_old &&
+ embedded_tree_new != embedded_tree_old) {
+ DCHECK_NE(owning_tree_new, embedded_tree_new);
+ embedded_tree_new->ProcessFocusChanged(old_focused_window,
+ new_focused_window);
}
}
// WindowManagers are always notified of focus changes.
- WindowTreeImpl* wms_tree_with_old_focused_window = nullptr;
+ WindowTree* wms_tree_with_old_focused_window = nullptr;
if (old_focused_window) {
WindowManagerState* wms =
connection_manager_->GetWindowManagerAndDisplay(old_focused_window)
.window_manager_state;
wms_tree_with_old_focused_window = wms ? wms->tree() : nullptr;
if (wms_tree_with_old_focused_window &&
- wms_tree_with_old_focused_window != owning_connection_old &&
- wms_tree_with_old_focused_window != embedded_connection_old &&
- wms_tree_with_old_focused_window != owning_connection_new &&
- wms_tree_with_old_focused_window != embedded_connection_new) {
+ wms_tree_with_old_focused_window != owning_tree_old &&
+ wms_tree_with_old_focused_window != embedded_tree_old &&
+ wms_tree_with_old_focused_window != owning_tree_new &&
+ wms_tree_with_old_focused_window != embedded_tree_new) {
wms_tree_with_old_focused_window->ProcessFocusChanged(old_focused_window,
new_focused_window);
}
@@ -557,12 +555,10 @@ void Display::OnFocusChanged(FocusControllerChangeSource change_source,
WindowManagerState* wms =
connection_manager_->GetWindowManagerAndDisplay(new_focused_window)
.window_manager_state;
- WindowTreeImpl* wms_tree = wms ? wms->tree() : nullptr;
+ WindowTree* wms_tree = wms ? wms->tree() : nullptr;
if (wms_tree && wms_tree != wms_tree_with_old_focused_window &&
- wms_tree != owning_connection_old &&
- wms_tree != embedded_connection_old &&
- wms_tree != owning_connection_new &&
- wms_tree != embedded_connection_new) {
+ wms_tree != owning_tree_old && wms_tree != embedded_tree_old &&
+ wms_tree != owning_tree_new && wms_tree != embedded_tree_new) {
wms_tree->ProcessFocusChanged(old_focused_window, new_focused_window);
}
}
diff --git a/components/mus/ws/display.h b/components/mus/ws/display.h
index 237ee09..6fa03ea 100644
--- a/components/mus/ws/display.h
+++ b/components/mus/ws/display.h
@@ -34,7 +34,7 @@ class ConnectionManager;
class DisplayBinding;
class FocusController;
class WindowManagerState;
-class WindowTreeImpl;
+class WindowTree;
namespace test {
class DisplayTestApi;
@@ -138,7 +138,7 @@ class Display : public PlatformDisplayDelegate,
// Called just before |tree| is destroyed after its connection encounters an
// error.
- void OnWindowTreeConnectionError(WindowTreeImpl* tree);
+ void OnWindowTreeConnectionError(WindowTree* tree);
// Called when a client updates a cursor. This will update the cursor on the
// native display if the cursor is currently under |window|.
diff --git a/components/mus/ws/display_binding.cc b/components/mus/ws/display_binding.cc
index 98c5aee..4226da5 100644
--- a/components/mus/ws/display_binding.cc
+++ b/components/mus/ws/display_binding.cc
@@ -6,7 +6,7 @@
#include "components/mus/ws/connection_manager.h"
#include "components/mus/ws/display.h"
-#include "components/mus/ws/window_tree_impl.h"
+#include "components/mus/ws/window_tree.h"
namespace mus {
namespace ws {
@@ -21,8 +21,8 @@ DisplayBindingImpl::DisplayBindingImpl(mojom::WindowTreeHostRequest request,
DisplayBindingImpl::~DisplayBindingImpl() {}
-WindowTreeImpl* DisplayBindingImpl::CreateWindowTree(ServerWindow* root) {
- WindowTreeImpl* tree = connection_manager_->EmbedAtWindow(
+WindowTree* DisplayBindingImpl::CreateWindowTree(ServerWindow* root) {
+ WindowTree* tree = connection_manager_->EmbedAtWindow(
root, mojom::WindowTree::kAccessPolicyEmbedRoot, std::move(client_));
tree->ConfigureWindowManager();
return tree;
diff --git a/components/mus/ws/display_binding.h b/components/mus/ws/display_binding.h
index d1ad7d5..9ee1f51f31 100644
--- a/components/mus/ws/display_binding.h
+++ b/components/mus/ws/display_binding.h
@@ -16,7 +16,7 @@ namespace ws {
class ConnectionManager;
class ServerWindow;
-class WindowTreeImpl;
+class WindowTree;
// DisplayBinding manages the binding between a Display and it's mojo clients.
// DisplayBinding is used when a Display is created via a
@@ -27,7 +27,7 @@ class DisplayBinding {
public:
virtual ~DisplayBinding() {}
- virtual WindowTreeImpl* CreateWindowTree(ServerWindow* root) = 0;
+ virtual WindowTree* CreateWindowTree(ServerWindow* root) = 0;
};
// Live implementation of DisplayBinding.
@@ -41,7 +41,7 @@ class DisplayBindingImpl : public DisplayBinding {
private:
// DisplayBinding:
- WindowTreeImpl* CreateWindowTree(ServerWindow* root) override;
+ WindowTree* CreateWindowTree(ServerWindow* root) override;
ConnectionManager* connection_manager_;
mojo::Binding<mojom::WindowTreeHost> binding_;
diff --git a/components/mus/ws/display_unittest.cc b/components/mus/ws/display_unittest.cc
index 9896548..ef83016 100644
--- a/components/mus/ws/display_unittest.cc
+++ b/components/mus/ws/display_unittest.cc
@@ -12,7 +12,6 @@
#include "components/mus/common/util.h"
#include "components/mus/public/interfaces/window_tree.mojom.h"
#include "components/mus/surfaces/surfaces_state.h"
-#include "components/mus/ws/client_connection.h"
#include "components/mus/ws/connection_manager.h"
#include "components/mus/ws/connection_manager_delegate.h"
#include "components/mus/ws/ids.h"
@@ -21,7 +20,8 @@
#include "components/mus/ws/server_window.h"
#include "components/mus/ws/test_utils.h"
#include "components/mus/ws/window_manager_state.h"
-#include "components/mus/ws/window_tree_impl.h"
+#include "components/mus/ws/window_tree.h"
+#include "components/mus/ws/window_tree_binding.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/rect.h"
@@ -53,34 +53,6 @@ class DisplayTest : public testing::Test {
DisplayTest() : cursor_id_(0), platform_display_factory_(&cursor_id_) {}
~DisplayTest() override {}
- // WindowTreeImpl for the window manager.
- WindowTreeImpl* wm_connection() {
- return connection_manager_->GetConnection(1);
- }
-
- TestWindowTreeClient* last_window_tree_client() {
- return connection_manager_delegate_.last_client();
- }
-
- TestClientConnection* last_client_connection() {
- return connection_manager_delegate_.last_connection();
- }
-
- ConnectionManager* connection_manager() { return connection_manager_.get(); }
-
- ServerWindow* GetWindowById(const WindowId& id) {
- return connection_manager_->GetWindow(id);
- }
-
- mus::mojom::Cursor cursor_id() {
- return static_cast<mus::mojom::Cursor>(cursor_id_);
- }
-
- void set_window_manager_internal(WindowTreeImpl* connection,
- mojom::WindowManager* wm_internal) {
- WindowTreeTestApi(connection).set_window_manager_internal(wm_internal);
- }
-
protected:
// testing::Test:
void SetUp() override {
diff --git a/components/mus/ws/ids.h b/components/mus/ws/ids.h
index c976b89..45671cf 100644
--- a/components/mus/ws/ids.h
+++ b/components/mus/ws/ids.h
@@ -17,22 +17,22 @@
namespace mus {
namespace ws {
-// Connection id is used to indicate no connection. That is, no WindowTreeImpl
+// Connection id is used to indicate no connection. That is, no WindowTree
// ever gets this id.
const ConnectionSpecificId kInvalidConnectionId = 0;
// Every window has a unique id associated with it (WindowId). The id is a
// combination of the id assigned to the connection (the high order bits) and
-// a unique id for the window. Each client (WindowTreeImpl) refers to the
-// window by an id assigned by the client (ClientWindowId). To facilitate this
-// WindowTreeImpl maintains a mapping between WindowId and ClientWindowId.
+// a unique id for the window. Each client (WindowTree) refers to the window
+// by an id assigned by the client (ClientWindowId). To facilitate this
+// WindowTree maintains a mapping between WindowId and ClientWindowId.
//
// This model works when the client initiates creation of windows, which is
// the typical use case. Embed roots and the WindowManager are special, they
// get access to windows created by other connections. These clients see the
// id assigned on the server. Such clients have to take care that they only
// create windows using their connection id. To do otherwise could result in
-// multiple windows having the same ClientWindowId. WindowTreeImpl enforces
+// multiple windows having the same ClientWindowId. WindowTree enforces
// that embed roots use the connection id in creating the window id to avoid
// possible conflicts.
struct WindowId {
diff --git a/components/mus/ws/operation.cc b/components/mus/ws/operation.cc
index f302f26..47a17eec 100644
--- a/components/mus/ws/operation.cc
+++ b/components/mus/ws/operation.cc
@@ -5,16 +5,16 @@
#include "components/mus/ws/operation.h"
#include "components/mus/ws/connection_manager.h"
-#include "components/mus/ws/window_tree_impl.h"
+#include "components/mus/ws/window_tree.h"
namespace mus {
namespace ws {
-Operation::Operation(WindowTreeImpl* connection,
+Operation::Operation(WindowTree* tree,
ConnectionManager* connection_manager,
OperationType operation_type)
: connection_manager_(connection_manager),
- source_connection_id_(connection->id()),
+ source_tree_id_(tree->id()),
operation_type_(operation_type) {
DCHECK(operation_type != OperationType::NONE);
// Tell the connection manager about the operation currently in flight.
diff --git a/components/mus/ws/operation.h b/components/mus/ws/operation.h
index 3ab7f6a..363d35b 100644
--- a/components/mus/ws/operation.h
+++ b/components/mus/ws/operation.h
@@ -14,7 +14,7 @@ namespace mus {
namespace ws {
class ConnectionManager;
-class WindowTreeImpl;
+class WindowTree;
enum class OperationType {
NONE,
@@ -39,34 +39,32 @@ enum class OperationType {
// by suboperations in the window server.
class Operation {
public:
- Operation(WindowTreeImpl* connection,
+ Operation(WindowTree* tree,
ConnectionManager* connection_manager,
OperationType operation_type);
~Operation();
- ConnectionSpecificId source_connection_id() const {
- return source_connection_id_;
- }
+ ConnectionSpecificId source_tree_id() const { return source_tree_id_; }
const OperationType& type() const { return operation_type_; }
- // Marks the connection with the specified id as having been sent a message
+ // Marks the tree with the specified id as having been sent a message
// during the course of |this| operation.
- void MarkConnectionAsMessaged(ConnectionSpecificId connection_id) {
- message_ids_.insert(connection_id);
+ void MarkTreeAsMessaged(ConnectionSpecificId tree_id) {
+ message_ids_.insert(tree_id);
}
- // Returns true if MarkConnectionAsMessaged(connection_id) was invoked.
- bool DidMessageConnection(ConnectionSpecificId connection_id) const {
- return message_ids_.count(connection_id) > 0;
+ // Returns true if MarkTreeAsMessaged(tree_id) was invoked.
+ bool DidMessageTree(ConnectionSpecificId tree_id) const {
+ return message_ids_.count(tree_id) > 0;
}
private:
ConnectionManager* const connection_manager_;
- const ConnectionSpecificId source_connection_id_;
+ const ConnectionSpecificId source_tree_id_;
const OperationType operation_type_;
- // See description of MarkConnectionAsMessaged/DidMessageConnection.
+ // See description of MarkTreeAsMessaged/DidMessageTree.
std::set<ConnectionSpecificId> message_ids_;
DISALLOW_COPY_AND_ASSIGN(Operation);
diff --git a/components/mus/ws/test_utils.cc b/components/mus/ws/test_utils.cc
index 08c94e7..e6d1644 100644
--- a/components/mus/ws/test_utils.cc
+++ b/components/mus/ws/test_utils.cc
@@ -96,7 +96,7 @@ PlatformDisplay* TestPlatformDisplayFactory::CreatePlatformDisplay(
// WindowTreeTestApi ---------------------------------------------------------
-WindowTreeTestApi::WindowTreeTestApi(WindowTreeImpl* tree) : tree_(tree) {}
+WindowTreeTestApi::WindowTreeTestApi(WindowTree* tree) : tree_(tree) {}
WindowTreeTestApi::~WindowTreeTestApi() {}
// DisplayTestApi ------------------------------------------------------------
@@ -229,16 +229,16 @@ void TestWindowTreeClient::RequestClose(uint32_t window_id) {}
void TestWindowTreeClient::GetWindowManager(
mojo::AssociatedInterfaceRequest<mojom::WindowManager> internal) {}
-// TestClientConnection --------------------------------------------------------
+// TestWindowTreeBinding ------------------------------------------------------
-TestClientConnection::TestClientConnection() : ClientConnection(&client_) {}
-TestClientConnection::~TestClientConnection() {}
+TestWindowTreeBinding::TestWindowTreeBinding() : WindowTreeBinding(&client_) {}
+TestWindowTreeBinding::~TestWindowTreeBinding() {}
-mojom::WindowManager* TestClientConnection::GetWindowManager() {
+mojom::WindowManager* TestWindowTreeBinding::GetWindowManager() {
NOTREACHED();
return nullptr;
}
-void TestClientConnection::SetIncomingMethodCallProcessingPaused(bool paused) {
+void TestWindowTreeBinding::SetIncomingMethodCallProcessingPaused(bool paused) {
is_paused_ = paused;
}
@@ -251,15 +251,15 @@ void TestConnectionManagerDelegate::OnNoMoreRootConnections() {
got_on_no_more_connections_ = true;
}
-scoped_ptr<ClientConnection>
-TestConnectionManagerDelegate::CreateClientConnectionForEmbedAtWindow(
+scoped_ptr<WindowTreeBinding>
+TestConnectionManagerDelegate::CreateWindowTreeBindingForEmbedAtWindow(
ws::ConnectionManager* connection_manager,
- ws::WindowTreeImpl* tree,
+ ws::WindowTree* tree,
mojom::WindowTreeRequest tree_request,
mojom::WindowTreeClientPtr client) {
- scoped_ptr<TestClientConnection> connection(new TestClientConnection);
- last_connection_ = connection.get();
- return std::move(connection);
+ scoped_ptr<TestWindowTreeBinding> binding(new TestWindowTreeBinding);
+ last_binding_ = binding.get();
+ return std::move(binding);
}
void TestConnectionManagerDelegate::CreateDefaultDisplays() {
diff --git a/components/mus/ws/test_utils.h b/components/mus/ws/test_utils.h
index b83f970..b3b5223 100644
--- a/components/mus/ws/test_utils.h
+++ b/components/mus/ws/test_utils.h
@@ -8,14 +8,14 @@
#include <stdint.h>
#include "components/mus/public/interfaces/window_tree.mojom.h"
-#include "components/mus/ws/client_connection.h"
#include "components/mus/ws/connection_manager_delegate.h"
#include "components/mus/ws/display.h"
#include "components/mus/ws/platform_display.h"
#include "components/mus/ws/platform_display_factory.h"
#include "components/mus/ws/test_change_tracker.h"
#include "components/mus/ws/window_manager_factory_registry.h"
-#include "components/mus/ws/window_tree_impl.h"
+#include "components/mus/ws/window_tree.h"
+#include "components/mus/ws/window_tree_binding.h"
namespace mus {
namespace ws {
@@ -40,7 +40,7 @@ class WindowManagerFactoryRegistryTestApi {
class WindowTreeTestApi {
public:
- WindowTreeTestApi(WindowTreeImpl* tree);
+ WindowTreeTestApi(WindowTree* tree);
~WindowTreeTestApi();
void set_window_manager_internal(mojom::WindowManager* wm_internal) {
@@ -48,7 +48,7 @@ class WindowTreeTestApi {
}
private:
- WindowTreeImpl* tree_;
+ WindowTree* tree_;
DISALLOW_COPY_AND_ASSIGN(WindowTreeTestApi);
};
@@ -169,17 +169,17 @@ class TestWindowTreeClient : public mus::mojom::WindowTreeClient {
// -----------------------------------------------------------------------------
-// ClientConnection implementation that vends TestWindowTreeClient.
-class TestClientConnection : public ClientConnection {
+// WindowTreeBinding implementation that vends TestWindowTreeBinding.
+class TestWindowTreeBinding : public WindowTreeBinding {
public:
- TestClientConnection();
- ~TestClientConnection() override;
+ TestWindowTreeBinding();
+ ~TestWindowTreeBinding() override;
TestWindowTreeClient* client() { return &client_; }
bool is_paused() const { return is_paused_; }
- // ClientConnection:
+ // WindowTreeBinding:
mojom::WindowManager* GetWindowManager() override;
void SetIncomingMethodCallProcessingPaused(bool paused) override;
@@ -187,7 +187,7 @@ class TestClientConnection : public ClientConnection {
TestWindowTreeClient client_;
bool is_paused_ = false;
- DISALLOW_COPY_AND_ASSIGN(TestClientConnection);
+ DISALLOW_COPY_AND_ASSIGN(TestWindowTreeBinding);
};
// -----------------------------------------------------------------------------
@@ -207,9 +207,9 @@ class TestConnectionManagerDelegate : public ConnectionManagerDelegate {
}
TestWindowTreeClient* last_client() {
- return last_connection_ ? last_connection_->client() : nullptr;
+ return last_binding_ ? last_binding_->client() : nullptr;
}
- TestClientConnection* last_connection() { return last_connection_; }
+ TestWindowTreeBinding* last_binding() { return last_binding_; }
bool got_on_no_more_connections() const {
return got_on_no_more_connections_;
@@ -217,9 +217,9 @@ class TestConnectionManagerDelegate : public ConnectionManagerDelegate {
// ConnectionManagerDelegate:
void OnNoMoreRootConnections() override;
- scoped_ptr<ClientConnection> CreateClientConnectionForEmbedAtWindow(
+ scoped_ptr<WindowTreeBinding> CreateWindowTreeBindingForEmbedAtWindow(
ws::ConnectionManager* connection_manager,
- ws::WindowTreeImpl* tree,
+ ws::WindowTree* tree,
mojom::WindowTreeRequest tree_request,
mojom::WindowTreeClientPtr client) override;
void CreateDefaultDisplays() override;
@@ -228,7 +228,7 @@ class TestConnectionManagerDelegate : public ConnectionManagerDelegate {
// If CreateDefaultDisplays() this is the number of Displays that are
// created. The default is 0, which results in a DCHECK.
int num_displays_to_create_ = 0;
- TestClientConnection* last_connection_ = nullptr;
+ TestWindowTreeBinding* last_binding_ = nullptr;
Display* display_ = nullptr;
ConnectionManager* connection_manager_ = nullptr;
bool got_on_no_more_connections_ = false;
diff --git a/components/mus/ws/window_manager_access_policy.cc b/components/mus/ws/window_manager_access_policy.cc
index ccc5868..e31bac5 100644
--- a/components/mus/ws/window_manager_access_policy.cc
+++ b/components/mus/ws/window_manager_access_policy.cc
@@ -84,7 +84,7 @@ bool WindowManagerAccessPolicy::CanSetWindowSurface(
if (surface_type == mojom::SurfaceType::UNDERLAY)
return window->id().connection_id == connection_id_;
- if (delegate_->IsWindowRootOfAnotherConnectionForAccessPolicy(window))
+ if (delegate_->IsWindowRootOfAnotherTreeForAccessPolicy(window))
return false;
return window->id().connection_id == connection_id_ ||
(delegate_->HasRootForAccessPolicy(window));
diff --git a/components/mus/ws/window_manager_factory_service.cc b/components/mus/ws/window_manager_factory_service.cc
index cc489fa..a9a522f 100644
--- a/components/mus/ws/window_manager_factory_service.cc
+++ b/components/mus/ws/window_manager_factory_service.cc
@@ -5,7 +5,7 @@
#include "components/mus/ws/window_manager_factory_service.h"
#include "components/mus/ws/connection_manager.h"
-#include "components/mus/ws/window_tree_impl.h"
+#include "components/mus/ws/window_tree.h"
namespace mus {
namespace ws {
diff --git a/components/mus/ws/window_manager_state.h b/components/mus/ws/window_manager_state.h
index 291d037..0d9077d 100644
--- a/components/mus/ws/window_manager_state.h
+++ b/components/mus/ws/window_manager_state.h
@@ -14,7 +14,7 @@ namespace ws {
class Display;
class ServerWindow;
-class WindowTreeImpl;
+class WindowTree;
// Manages the state associated with a connection to a WindowManager for
// a specific user.
@@ -30,8 +30,8 @@ class WindowManagerState {
ServerWindow* root() { return root_.get(); }
const ServerWindow* root() const { return root_.get(); }
- WindowTreeImpl* tree() { return tree_; }
- const WindowTreeImpl* tree() const { return tree_; }
+ WindowTree* tree() { return tree_; }
+ const WindowTree* tree() const { return tree_; }
private:
friend class Display;
@@ -45,7 +45,7 @@ class WindowManagerState {
const bool is_user_id_valid_;
const uint32_t user_id_;
scoped_ptr<ServerWindow> root_;
- WindowTreeImpl* tree_ = nullptr;
+ WindowTree* tree_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(WindowManagerState);
};
diff --git a/components/mus/ws/window_tree_impl.cc b/components/mus/ws/window_tree.cc
index 64fba9d..7e1c405 100644
--- a/components/mus/ws/window_tree_impl.cc
+++ b/components/mus/ws/window_tree.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/mus/ws/window_tree_impl.h"
+#include "components/mus/ws/window_tree.h"
#include <stddef.h>
#include <utility>
@@ -10,7 +10,6 @@
#include "base/bind.h"
#include "base/macros.h"
#include "base/stl_util.h"
-#include "components/mus/ws/client_connection.h"
#include "components/mus/ws/connection_manager.h"
#include "components/mus/ws/default_access_policy.h"
#include "components/mus/ws/display.h"
@@ -21,6 +20,7 @@
#include "components/mus/ws/server_window_observer.h"
#include "components/mus/ws/window_manager_access_policy.h"
#include "components/mus/ws/window_manager_state.h"
+#include "components/mus/ws/window_tree_binding.h"
#include "mojo/converters/geometry/geometry_type_converters.h"
#include "mojo/converters/ime/ime_type_converters.h"
#include "mojo/converters/input_events/input_events_type_converters.h"
@@ -64,9 +64,9 @@ class TargetedEvent : public ServerWindowObserver {
DISALLOW_COPY_AND_ASSIGN(TargetedEvent);
};
-WindowTreeImpl::WindowTreeImpl(ConnectionManager* connection_manager,
- ServerWindow* root,
- uint32_t policy_bitmask)
+WindowTree::WindowTree(ConnectionManager* connection_manager,
+ ServerWindow* root,
+ uint32_t policy_bitmask)
: connection_manager_(connection_manager),
id_(connection_manager_->GetAndAdvanceNextConnectionId()),
next_window_id_(1),
@@ -86,14 +86,14 @@ WindowTreeImpl::WindowTreeImpl(ConnectionManager* connection_manager,
}
}
-WindowTreeImpl::~WindowTreeImpl() {
+WindowTree::~WindowTree() {
DestroyWindows();
}
-void WindowTreeImpl::Init(scoped_ptr<ClientConnection> client_connection,
- mojom::WindowTreePtr tree) {
- DCHECK(!client_connection_);
- client_connection_ = std::move(client_connection);
+void WindowTree::Init(scoped_ptr<WindowTreeBinding> binding,
+ mojom::WindowTreePtr tree) {
+ DCHECK(!binding_);
+ binding_ = std::move(binding);
if (roots_.empty())
return;
@@ -117,12 +117,12 @@ void WindowTreeImpl::Init(scoped_ptr<ClientConnection> client_connection,
: WindowTree::kAccessPolicyDefault);
}
-void WindowTreeImpl::ConfigureWindowManager() {
+void WindowTree::ConfigureWindowManager() {
DCHECK(!window_manager_internal_);
- window_manager_internal_ = client_connection_->GetWindowManager();
+ window_manager_internal_ = binding_->GetWindowManager();
}
-const ServerWindow* WindowTreeImpl::GetWindow(const WindowId& id) const {
+const ServerWindow* WindowTree::GetWindow(const WindowId& id) const {
if (id_ == id.connection_id) {
auto iter = created_window_map_.find(id);
return iter == created_window_map_.end() ? nullptr : iter->second;
@@ -130,8 +130,8 @@ const ServerWindow* WindowTreeImpl::GetWindow(const WindowId& id) const {
return connection_manager_->GetWindow(id);
}
-bool WindowTreeImpl::IsWindowKnown(const ServerWindow* window,
- ClientWindowId* id) const {
+bool WindowTree::IsWindowKnown(const ServerWindow* window,
+ ClientWindowId* id) const {
if (!window)
return false;
auto iter = window_id_to_client_id_map_.find(window->id());
@@ -142,47 +142,45 @@ bool WindowTreeImpl::IsWindowKnown(const ServerWindow* window,
return true;
}
-bool WindowTreeImpl::HasRoot(const ServerWindow* window) const {
+bool WindowTree::HasRoot(const ServerWindow* window) const {
return roots_.count(window) > 0;
}
-const ServerWindow* WindowTreeImpl::GetWindowByClientId(
+const ServerWindow* WindowTree::GetWindowByClientId(
const ClientWindowId& id) const {
auto iter = client_id_to_window_id_map_.find(id);
return iter == client_id_to_window_id_map_.end() ? nullptr
: GetWindow(iter->second);
}
-const Display* WindowTreeImpl::GetDisplay(const ServerWindow* window) const {
+const Display* WindowTree::GetDisplay(const ServerWindow* window) const {
return window ? connection_manager_->GetDisplayContaining(window) : nullptr;
}
-void WindowTreeImpl::OnWindowDestroyingTreeImpl(WindowTreeImpl* connection) {
- // Notify our client if |connection| was embedded in any of our views.
- for (const auto* connection_root : connection->roots_) {
- const bool owns_connection_root =
- connection_root->id().connection_id == id_;
- if (owns_connection_root ||
- (is_embed_root_ && IsWindowKnown(connection_root))) {
+void WindowTree::OnWindowDestroyingTreeImpl(WindowTree* tree) {
+ // Notify our client if |tree| was embedded in any of our views.
+ for (const auto* tree_root : tree->roots_) {
+ const bool owns_tree_root = tree_root->id().connection_id == id_;
+ if (owns_tree_root || (is_embed_root_ && IsWindowKnown(tree_root))) {
client()->OnEmbeddedAppDisconnected(
- ClientWindowIdForWindow(connection_root).id);
+ ClientWindowIdForWindow(tree_root).id);
}
}
}
-void WindowTreeImpl::OnWillDestroyDisplay(Display* display) {
+void WindowTree::OnWillDestroyDisplay(Display* display) {
if (event_source_display_ == display)
event_source_display_ = nullptr;
}
-void WindowTreeImpl::NotifyChangeCompleted(
+void WindowTree::NotifyChangeCompleted(
uint32_t change_id,
mojom::WindowManagerErrorCode error_code) {
client()->OnChangeCompleted(
change_id, error_code == mojom::WindowManagerErrorCode::SUCCESS);
}
-bool WindowTreeImpl::NewWindow(
+bool WindowTree::NewWindow(
const ClientWindowId& client_window_id,
const std::map<std::string, std::vector<uint8_t>>& properties) {
if (!IsValidIdForNewWindow(client_window_id))
@@ -197,8 +195,8 @@ bool WindowTreeImpl::NewWindow(
return true;
}
-bool WindowTreeImpl::AddWindow(const ClientWindowId& parent_id,
- const ClientWindowId& child_id) {
+bool WindowTree::AddWindow(const ClientWindowId& parent_id,
+ const ClientWindowId& child_id) {
ServerWindow* parent = GetWindowByClientId(parent_id);
ServerWindow* child = GetWindowByClientId(child_id);
if (parent && child && child->parent() != parent &&
@@ -210,9 +208,8 @@ bool WindowTreeImpl::AddWindow(const ClientWindowId& parent_id,
return false;
}
-bool WindowTreeImpl::AddTransientWindow(
- const ClientWindowId& window_id,
- const ClientWindowId& transient_window_id) {
+bool WindowTree::AddTransientWindow(const ClientWindowId& window_id,
+ const ClientWindowId& transient_window_id) {
ServerWindow* window = GetWindowByClientId(window_id);
ServerWindow* transient_window = GetWindowByClientId(transient_window_id);
if (window && transient_window && !transient_window->Contains(window) &&
@@ -225,7 +222,7 @@ bool WindowTreeImpl::AddTransientWindow(
return false;
}
-std::vector<const ServerWindow*> WindowTreeImpl::GetWindowTree(
+std::vector<const ServerWindow*> WindowTree::GetWindowTree(
const ClientWindowId& window_id) const {
const ServerWindow* window = GetWindowByClientId(window_id);
std::vector<const ServerWindow*> windows;
@@ -234,8 +231,8 @@ std::vector<const ServerWindow*> WindowTreeImpl::GetWindowTree(
return windows;
}
-bool WindowTreeImpl::SetWindowVisibility(const ClientWindowId& window_id,
- bool visible) {
+bool WindowTree::SetWindowVisibility(const ClientWindowId& window_id,
+ bool visible) {
ServerWindow* window = GetWindowByClientId(window_id);
if (!window || window->visible() == visible ||
!access_policy_->CanChangeWindowVisibility(window)) {
@@ -246,24 +243,24 @@ bool WindowTreeImpl::SetWindowVisibility(const ClientWindowId& window_id,
return true;
}
-bool WindowTreeImpl::Embed(const ClientWindowId& window_id,
- mojom::WindowTreeClientPtr client,
- uint32_t policy_bitmask,
- ConnectionSpecificId* connection_id) {
+bool WindowTree::Embed(const ClientWindowId& window_id,
+ mojom::WindowTreeClientPtr client,
+ uint32_t policy_bitmask,
+ ConnectionSpecificId* connection_id) {
*connection_id = kInvalidConnectionId;
if (!client || !CanEmbed(window_id, policy_bitmask))
return false;
ServerWindow* window = GetWindowByClientId(window_id);
PrepareForEmbed(window);
- WindowTreeImpl* new_connection = connection_manager_->EmbedAtWindow(
+ WindowTree* new_tree = connection_manager_->EmbedAtWindow(
window, policy_bitmask, std::move(client));
if (is_embed_root_)
- *connection_id = new_connection->id();
+ *connection_id = new_tree->id();
return true;
}
-void WindowTreeImpl::DispatchInputEvent(ServerWindow* target,
- mojom::EventPtr event) {
+void WindowTree::DispatchInputEvent(ServerWindow* target,
+ mojom::EventPtr event) {
if (event_ack_id_) {
// This is currently waiting for an event ack. Add it to the queue.
event_queue_.push(
@@ -285,19 +282,19 @@ void WindowTreeImpl::DispatchInputEvent(ServerWindow* target,
DispatchInputEventImpl(target, std::move(event));
}
-bool WindowTreeImpl::IsWaitingForNewTopLevelWindow(uint32_t wm_change_id) {
+bool WindowTree::IsWaitingForNewTopLevelWindow(uint32_t wm_change_id) {
return waiting_for_top_level_window_info_ &&
waiting_for_top_level_window_info_->wm_change_id == wm_change_id;
}
-void WindowTreeImpl::OnWindowManagerCreatedTopLevelWindow(
+void WindowTree::OnWindowManagerCreatedTopLevelWindow(
uint32_t wm_change_id,
uint32_t client_change_id,
const ServerWindow* window) {
DCHECK(IsWaitingForNewTopLevelWindow(wm_change_id));
scoped_ptr<WaitingForTopLevelWindowInfo> waiting_for_top_level_window_info(
std::move(waiting_for_top_level_window_info_));
- client_connection_->SetIncomingMethodCallProcessingPaused(false);
+ binding_->SetIncomingMethodCallProcessingPaused(false);
// We were paused, so the id should still be valid.
DCHECK(IsValidIdForNewWindow(
waiting_for_top_level_window_info->client_window_id));
@@ -309,20 +306,19 @@ void WindowTreeImpl::OnWindowManagerCreatedTopLevelWindow(
client()->OnTopLevelCreated(client_change_id, WindowToWindowData(window));
}
-void WindowTreeImpl::OnChangeCompleted(uint32_t change_id, bool success) {
+void WindowTree::OnChangeCompleted(uint32_t change_id, bool success) {
client()->OnChangeCompleted(change_id, success);
}
-void WindowTreeImpl::OnAccelerator(uint32_t accelerator_id,
- mojom::EventPtr event) {
+void WindowTree::OnAccelerator(uint32_t accelerator_id, mojom::EventPtr event) {
DCHECK(window_manager_internal_);
window_manager_internal_->OnAccelerator(accelerator_id, std::move(event));
}
-void WindowTreeImpl::ProcessWindowBoundsChanged(const ServerWindow* window,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds,
- bool originated_change) {
+void WindowTree::ProcessWindowBoundsChanged(const ServerWindow* window,
+ const gfx::Rect& old_bounds,
+ const gfx::Rect& new_bounds,
+ bool originated_change) {
ClientWindowId client_window_id;
if (originated_change || !IsWindowKnown(window, &client_window_id))
return;
@@ -330,7 +326,7 @@ void WindowTreeImpl::ProcessWindowBoundsChanged(const ServerWindow* window,
Rect::From(new_bounds));
}
-void WindowTreeImpl::ProcessClientAreaChanged(
+void WindowTree::ProcessClientAreaChanged(
const ServerWindow* window,
const gfx::Insets& new_client_area,
const std::vector<gfx::Rect>& new_additional_client_areas,
@@ -343,7 +339,7 @@ void WindowTreeImpl::ProcessClientAreaChanged(
mojo::Array<mojo::RectPtr>::From(new_additional_client_areas));
}
-void WindowTreeImpl::ProcessViewportMetricsChanged(
+void WindowTree::ProcessViewportMetricsChanged(
Display* display,
const mojom::ViewportMetrics& old_metrics,
const mojom::ViewportMetrics& new_metrics,
@@ -364,7 +360,7 @@ void WindowTreeImpl::ProcessViewportMetricsChanged(
std::move(window_ids), old_metrics.Clone(), new_metrics.Clone());
}
-void WindowTreeImpl::ProcessWillChangeWindowHierarchy(
+void WindowTree::ProcessWillChangeWindowHierarchy(
const ServerWindow* window,
const ServerWindow* new_parent,
const ServerWindow* old_parent,
@@ -381,7 +377,7 @@ void WindowTreeImpl::ProcessWillChangeWindowHierarchy(
NotifyDrawnStateChanged(window, new_drawn);
}
-void WindowTreeImpl::ProcessWindowPropertyChanged(
+void WindowTree::ProcessWindowPropertyChanged(
const ServerWindow* window,
const std::string& name,
const std::vector<uint8_t>* new_data,
@@ -401,11 +397,10 @@ void WindowTreeImpl::ProcessWindowPropertyChanged(
std::move(data));
}
-void WindowTreeImpl::ProcessWindowHierarchyChanged(
- const ServerWindow* window,
- const ServerWindow* new_parent,
- const ServerWindow* old_parent,
- bool originated_change) {
+void WindowTree::ProcessWindowHierarchyChanged(const ServerWindow* window,
+ const ServerWindow* new_parent,
+ const ServerWindow* old_parent,
+ bool originated_change) {
const bool knows_new = new_parent && IsWindowKnown(new_parent);
if (originated_change && !IsWindowKnown(window) && knows_new) {
std::vector<const ServerWindow*> unused;
@@ -414,7 +409,7 @@ void WindowTreeImpl::ProcessWindowHierarchyChanged(
if (originated_change || (connection_manager_->current_operation_type() ==
OperationType::DELETE_WINDOW) ||
(connection_manager_->current_operation_type() == OperationType::EMBED) ||
- connection_manager_->DidConnectionMessageClient(id_)) {
+ connection_manager_->DidTreeMessageClient(id_)) {
return;
}
@@ -440,18 +435,18 @@ void WindowTreeImpl::ProcessWindowHierarchyChanged(
client()->OnWindowHierarchyChanged(
client_window_id.id, new_parent_client_window_id.id,
old_parent_client_window_id.id, WindowsToWindowDatas(to_send));
- connection_manager_->OnConnectionMessagedClient(id_);
+ connection_manager_->OnTreeMessagedClient(id_);
}
-void WindowTreeImpl::ProcessWindowReorder(const ServerWindow* window,
- const ServerWindow* relative_window,
- mojom::OrderDirection direction,
- bool originated_change) {
+void WindowTree::ProcessWindowReorder(const ServerWindow* window,
+ const ServerWindow* relative_window,
+ mojom::OrderDirection direction,
+ bool originated_change) {
DCHECK_EQ(window->parent(), relative_window->parent());
ClientWindowId client_window_id, relative_client_window_id;
if (originated_change || !IsWindowKnown(window, &client_window_id) ||
!IsWindowKnown(relative_window, &relative_client_window_id) ||
- connection_manager_->DidConnectionMessageClient(id_))
+ connection_manager_->DidTreeMessageClient(id_))
return;
// Do not notify ordering changes of the root windows, since the client
@@ -462,11 +457,11 @@ void WindowTreeImpl::ProcessWindowReorder(const ServerWindow* window,
client()->OnWindowReordered(client_window_id.id, relative_client_window_id.id,
direction);
- connection_manager_->OnConnectionMessagedClient(id_);
+ connection_manager_->OnTreeMessagedClient(id_);
}
-void WindowTreeImpl::ProcessWindowDeleted(const ServerWindow* window,
- bool originated_change) {
+void WindowTree::ProcessWindowDeleted(const ServerWindow* window,
+ bool originated_change) {
if (window->id().connection_id == id_)
created_window_map_.erase(window->id());
@@ -483,12 +478,11 @@ void WindowTreeImpl::ProcessWindowDeleted(const ServerWindow* window,
return;
client()->OnWindowDeleted(client_window_id.id);
- connection_manager_->OnConnectionMessagedClient(id_);
+ connection_manager_->OnTreeMessagedClient(id_);
}
-void WindowTreeImpl::ProcessWillChangeWindowVisibility(
- const ServerWindow* window,
- bool originated_change) {
+void WindowTree::ProcessWillChangeWindowVisibility(const ServerWindow* window,
+ bool originated_change) {
if (originated_change)
return;
@@ -511,9 +505,9 @@ void WindowTreeImpl::ProcessWillChangeWindowVisibility(
NotifyDrawnStateChanged(window, window_target_drawn_state);
}
-void WindowTreeImpl::ProcessCursorChanged(const ServerWindow* window,
- int32_t cursor_id,
- bool originated_change) {
+void WindowTree::ProcessCursorChanged(const ServerWindow* window,
+ int32_t cursor_id,
+ bool originated_change) {
if (originated_change)
return;
ClientWindowId client_window_id;
@@ -524,9 +518,8 @@ void WindowTreeImpl::ProcessCursorChanged(const ServerWindow* window,
mojom::Cursor(cursor_id));
}
-void WindowTreeImpl::ProcessFocusChanged(
- const ServerWindow* old_focused_window,
- const ServerWindow* new_focused_window) {
+void WindowTree::ProcessFocusChanged(const ServerWindow* old_focused_window,
+ const ServerWindow* new_focused_window) {
const ServerWindow* window =
new_focused_window
? access_policy_->GetWindowForFocusChange(new_focused_window)
@@ -539,7 +532,7 @@ void WindowTreeImpl::ProcessFocusChanged(
client()->OnWindowFocused(client_window_id.id);
}
-void WindowTreeImpl::ProcessTransientWindowAdded(
+void WindowTree::ProcessTransientWindowAdded(
const ServerWindow* window,
const ServerWindow* transient_window,
bool originated_change) {
@@ -555,7 +548,7 @@ void WindowTreeImpl::ProcessTransientWindowAdded(
transient_client_window_id.id);
}
-void WindowTreeImpl::ProcessTransientWindowRemoved(
+void WindowTree::ProcessTransientWindowRemoved(
const ServerWindow* window,
const ServerWindow* transient_window,
bool originated_change) {
@@ -570,8 +563,8 @@ void WindowTreeImpl::ProcessTransientWindowRemoved(
transient_client_window_id.id);
}
-Display* WindowTreeImpl::GetDisplayForWindowManager() {
- // The WindowTreeImpl for the wm has one and only one root.
+Display* WindowTree::GetDisplayForWindowManager() {
+ // The WindowTree for the wm has one and only one root.
CHECK_EQ(1u, roots_.size());
// Indicates this connection is for the wm.
@@ -586,8 +579,7 @@ Display* WindowTreeImpl::GetDisplayForWindowManager() {
return display;
}
-bool WindowTreeImpl::ShouldRouteToWindowManager(
- const ServerWindow* window) const {
+bool WindowTree::ShouldRouteToWindowManager(const ServerWindow* window) const {
// If the client created this window, then do not route it through the WM.
if (window->id().connection_id == id_)
return false;
@@ -611,8 +603,8 @@ bool WindowTreeImpl::ShouldRouteToWindowManager(
return is_wm ? false : true;
}
-void WindowTreeImpl::ProcessLostCapture(const ServerWindow* old_capture_window,
- bool originated_change) {
+void WindowTree::ProcessLostCapture(const ServerWindow* old_capture_window,
+ bool originated_change) {
if ((originated_change &&
connection_manager_->current_operation_type() ==
OperationType::RELEASE_CAPTURE) ||
@@ -622,14 +614,14 @@ void WindowTreeImpl::ProcessLostCapture(const ServerWindow* old_capture_window,
client()->OnLostCapture(WindowIdToTransportId(old_capture_window->id()));
}
-ClientWindowId WindowTreeImpl::ClientWindowIdForWindow(
+ClientWindowId WindowTree::ClientWindowIdForWindow(
const ServerWindow* window) const {
auto iter = window_id_to_client_id_map_.find(window->id());
DCHECK(iter != window_id_to_client_id_map_.end());
return iter->second;
}
-bool WindowTreeImpl::IsValidIdForNewWindow(const ClientWindowId& id) const {
+bool WindowTree::IsValidIdForNewWindow(const ClientWindowId& id) const {
if (is_embed_root_ && WindowIdFromTransportId(id.id).connection_id != id_) {
// Embed roots see windows created from other connections. If they don't
// use the connection id when creating windows the client could end up with
@@ -640,14 +632,14 @@ bool WindowTreeImpl::IsValidIdForNewWindow(const ClientWindowId& id) const {
return client_id_to_window_id_map_.count(id) == 0u;
}
-WindowId WindowTreeImpl::GenerateNewWindowId() {
+WindowId WindowTree::GenerateNewWindowId() {
// TODO(sky): deal with wrapping and uniqueness.
return WindowId(id_, next_window_id_++);
}
-bool WindowTreeImpl::CanReorderWindow(const ServerWindow* window,
- const ServerWindow* relative_window,
- mojom::OrderDirection direction) const {
+bool WindowTree::CanReorderWindow(const ServerWindow* window,
+ const ServerWindow* relative_window,
+ mojom::OrderDirection direction) const {
if (!window || !relative_window)
return false;
@@ -671,8 +663,7 @@ bool WindowTreeImpl::CanReorderWindow(const ServerWindow* window,
return true;
}
-bool WindowTreeImpl::DeleteWindowImpl(WindowTreeImpl* source,
- ServerWindow* window) {
+bool WindowTree::DeleteWindowImpl(WindowTree* source, ServerWindow* window) {
DCHECK(window);
DCHECK_EQ(window->id().connection_id, id_);
Operation op(source, connection_manager_, OperationType::DELETE_WINDOW);
@@ -680,7 +671,7 @@ bool WindowTreeImpl::DeleteWindowImpl(WindowTreeImpl* source,
return true;
}
-void WindowTreeImpl::GetUnknownWindowsFrom(
+void WindowTree::GetUnknownWindowsFrom(
const ServerWindow* window,
std::vector<const ServerWindow*>* windows) {
if (IsWindowKnown(window) || !access_policy_->CanGetWindowTree(window))
@@ -704,7 +695,7 @@ void WindowTreeImpl::GetUnknownWindowsFrom(
GetUnknownWindowsFrom(children[i], windows);
}
-bool WindowTreeImpl::RemoveFromMaps(const ServerWindow* window) {
+bool WindowTree::RemoveFromMaps(const ServerWindow* window) {
auto iter = window_id_to_client_id_map_.find(window->id());
if (iter == window_id_to_client_id_map_.end())
return false;
@@ -714,9 +705,8 @@ bool WindowTreeImpl::RemoveFromMaps(const ServerWindow* window) {
return true;
}
-void WindowTreeImpl::RemoveFromKnown(
- const ServerWindow* window,
- std::vector<ServerWindow*>* local_windows) {
+void WindowTree::RemoveFromKnown(const ServerWindow* window,
+ std::vector<ServerWindow*>* local_windows) {
if (window->id().connection_id == id_) {
if (local_windows)
local_windows->push_back(GetWindow(window->id()));
@@ -730,8 +720,8 @@ void WindowTreeImpl::RemoveFromKnown(
RemoveFromKnown(children[i], local_windows);
}
-void WindowTreeImpl::RemoveRoot(const ServerWindow* window,
- RemoveRootReason reason) {
+void WindowTree::RemoveRoot(const ServerWindow* window,
+ RemoveRootReason reason) {
DCHECK(roots_.count(window) > 0);
roots_.erase(window);
@@ -744,7 +734,7 @@ void WindowTreeImpl::RemoveRoot(const ServerWindow* window,
if (reason == RemoveRootReason::EMBED) {
client()->OnUnembed(client_window_id.id);
client()->OnWindowDeleted(client_window_id.id);
- connection_manager_->OnConnectionMessagedClient(id_);
+ connection_manager_->OnTreeMessagedClient(id_);
}
// This connection no longer knows about the window. Unparent any windows that
@@ -755,7 +745,7 @@ void WindowTreeImpl::RemoveRoot(const ServerWindow* window,
local_windows[i]->parent()->Remove(local_windows[i]);
}
-Array<mojom::WindowDataPtr> WindowTreeImpl::WindowsToWindowDatas(
+Array<mojom::WindowDataPtr> WindowTree::WindowsToWindowDatas(
const std::vector<const ServerWindow*>& windows) {
Array<mojom::WindowDataPtr> array(windows.size());
for (size_t i = 0; i < windows.size(); ++i)
@@ -763,7 +753,7 @@ Array<mojom::WindowDataPtr> WindowTreeImpl::WindowsToWindowDatas(
return array;
}
-mojom::WindowDataPtr WindowTreeImpl::WindowToWindowData(
+mojom::WindowDataPtr WindowTree::WindowToWindowData(
const ServerWindow* window) {
DCHECK(IsWindowKnown(window));
const ServerWindow* parent = window->parent();
@@ -786,7 +776,7 @@ mojom::WindowDataPtr WindowTreeImpl::WindowToWindowData(
return window_data;
}
-void WindowTreeImpl::GetWindowTreeImpl(
+void WindowTree::GetWindowTreeImpl(
const ServerWindow* window,
std::vector<const ServerWindow*>* windows) const {
DCHECK(window);
@@ -804,8 +794,8 @@ void WindowTreeImpl::GetWindowTreeImpl(
GetWindowTreeImpl(children[i], windows);
}
-void WindowTreeImpl::NotifyDrawnStateChanged(const ServerWindow* window,
- bool new_drawn_value) {
+void WindowTree::NotifyDrawnStateChanged(const ServerWindow* window,
+ bool new_drawn_value) {
// Even though we don't know about window, it may be an ancestor of our root,
// in which case the change may effect our roots drawn state.
if (roots_.empty())
@@ -819,7 +809,7 @@ void WindowTreeImpl::NotifyDrawnStateChanged(const ServerWindow* window,
}
}
-void WindowTreeImpl::DestroyWindows() {
+void WindowTree::DestroyWindows() {
if (created_window_map_.empty())
return;
@@ -839,37 +829,36 @@ void WindowTreeImpl::DestroyWindows() {
STLDeleteValues(&created_window_map_copy);
}
-bool WindowTreeImpl::CanEmbed(const ClientWindowId& window_id,
- uint32_t policy_bitmask) const {
+bool WindowTree::CanEmbed(const ClientWindowId& window_id,
+ uint32_t policy_bitmask) const {
const ServerWindow* window = GetWindowByClientId(window_id);
return window && access_policy_->CanEmbed(window, policy_bitmask);
}
-void WindowTreeImpl::PrepareForEmbed(ServerWindow* window) {
+void WindowTree::PrepareForEmbed(ServerWindow* window) {
DCHECK(window);
// Only allow a node to be the root for one connection.
- WindowTreeImpl* existing_owner =
- connection_manager_->GetConnectionWithRoot(window);
+ WindowTree* existing_owner = connection_manager_->GetTreeWithRoot(window);
Operation op(this, connection_manager_, OperationType::EMBED);
RemoveChildrenAsPartOfEmbed(window);
if (existing_owner) {
// Never message the originating connection.
- connection_manager_->OnConnectionMessagedClient(id_);
+ connection_manager_->OnTreeMessagedClient(id_);
existing_owner->RemoveRoot(window, RemoveRootReason::EMBED);
}
}
-void WindowTreeImpl::RemoveChildrenAsPartOfEmbed(ServerWindow* window) {
+void WindowTree::RemoveChildrenAsPartOfEmbed(ServerWindow* window) {
CHECK(window);
std::vector<ServerWindow*> children = window->GetChildren();
for (size_t i = 0; i < children.size(); ++i)
window->Remove(children[i]);
}
-void WindowTreeImpl::DispatchInputEventImpl(ServerWindow* target,
- mojom::EventPtr event) {
+void WindowTree::DispatchInputEventImpl(ServerWindow* target,
+ mojom::EventPtr event) {
DCHECK(!event_ack_id_);
// We do not want to create a sequential id for each event, because that can
// leak some information to the client. So instead, manufacture the id from
@@ -883,7 +872,7 @@ void WindowTreeImpl::DispatchInputEventImpl(ServerWindow* target,
event_ack_id_, ClientWindowIdForWindow(target).id, std::move(event));
}
-void WindowTreeImpl::NewWindow(
+void WindowTree::NewWindow(
uint32_t change_id,
Id transport_window_id,
mojo::Map<mojo::String, mojo::Array<uint8_t>> transport_properties) {
@@ -896,7 +885,7 @@ void WindowTreeImpl::NewWindow(
change_id, NewWindow(ClientWindowId(transport_window_id), properties));
}
-void WindowTreeImpl::NewTopLevelWindow(
+void WindowTree::NewTopLevelWindow(
uint32_t change_id,
Id transport_window_id,
mojo::Map<mojo::String, mojo::Array<uint8_t>> transport_properties) {
@@ -915,7 +904,7 @@ void WindowTreeImpl::NewTopLevelWindow(
// may try to alter the window. Pause incoming messages so that we know we
// can't get a message for a window before the window is created. Once the
// window is created we'll resume processing.
- client_connection_->SetIncomingMethodCallProcessingPaused(true);
+ binding_->SetIncomingMethodCallProcessingPaused(true);
const uint32_t wm_change_id =
connection_manager_->GenerateWindowManagerChangeId(this, change_id);
@@ -927,26 +916,26 @@ void WindowTreeImpl::NewTopLevelWindow(
wm_change_id, std::move(transport_properties));
}
-void WindowTreeImpl::DeleteWindow(uint32_t change_id, Id transport_window_id) {
+void WindowTree::DeleteWindow(uint32_t change_id, Id transport_window_id) {
ServerWindow* window =
GetWindowByClientId(ClientWindowId(transport_window_id));
bool success = false;
bool should_close = window && (access_policy_->CanDeleteWindow(window) ||
ShouldRouteToWindowManager(window));
if (should_close) {
- WindowTreeImpl* connection =
- connection_manager_->GetConnection(window->id().connection_id);
- success = connection && connection->DeleteWindowImpl(this, window);
+ WindowTree* tree =
+ connection_manager_->GetTreeWithId(window->id().connection_id);
+ success = tree && tree->DeleteWindowImpl(this, window);
}
client()->OnChangeCompleted(change_id, success);
}
-void WindowTreeImpl::AddWindow(uint32_t change_id, Id parent_id, Id child_id) {
+void WindowTree::AddWindow(uint32_t change_id, Id parent_id, Id child_id) {
client()->OnChangeCompleted(change_id, AddWindow(ClientWindowId(parent_id),
ClientWindowId(child_id)));
}
-void WindowTreeImpl::RemoveWindowFromParent(uint32_t change_id, Id window_id) {
+void WindowTree::RemoveWindowFromParent(uint32_t change_id, Id window_id) {
bool success = false;
ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id));
if (window && window->parent() &&
@@ -959,16 +948,16 @@ void WindowTreeImpl::RemoveWindowFromParent(uint32_t change_id, Id window_id) {
client()->OnChangeCompleted(change_id, success);
}
-void WindowTreeImpl::AddTransientWindow(uint32_t change_id,
- Id window,
- Id transient_window) {
+void WindowTree::AddTransientWindow(uint32_t change_id,
+ Id window,
+ Id transient_window) {
client()->OnChangeCompleted(
change_id, AddTransientWindow(ClientWindowId(window),
ClientWindowId(transient_window)));
}
-void WindowTreeImpl::RemoveTransientWindowFromParent(uint32_t change_id,
- Id transient_window_id) {
+void WindowTree::RemoveTransientWindowFromParent(uint32_t change_id,
+ Id transient_window_id) {
bool success = false;
ServerWindow* transient_window =
GetWindowByClientId(ClientWindowId(transient_window_id));
@@ -983,10 +972,10 @@ void WindowTreeImpl::RemoveTransientWindowFromParent(uint32_t change_id,
client()->OnChangeCompleted(change_id, success);
}
-void WindowTreeImpl::ReorderWindow(uint32_t change_id,
- Id window_id,
- Id relative_window_id,
- mojom::OrderDirection direction) {
+void WindowTree::ReorderWindow(uint32_t change_id,
+ Id window_id,
+ Id relative_window_id,
+ mojom::OrderDirection direction) {
bool success = false;
ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id));
ServerWindow* relative_window =
@@ -1001,7 +990,7 @@ void WindowTreeImpl::ReorderWindow(uint32_t change_id,
client()->OnChangeCompleted(change_id, success);
}
-void WindowTreeImpl::GetWindowTree(
+void WindowTree::GetWindowTree(
Id window_id,
const Callback<void(Array<mojom::WindowDataPtr>)>& callback) {
std::vector<const ServerWindow*> windows(
@@ -1009,7 +998,7 @@ void WindowTreeImpl::GetWindowTree(
callback.Run(WindowsToWindowDatas(windows));
}
-void WindowTreeImpl::SetCapture(uint32_t change_id, Id window_id) {
+void WindowTree::SetCapture(uint32_t change_id, Id window_id) {
ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id));
Display* display = GetDisplay(window);
ServerWindow* current_capture_window =
@@ -1025,7 +1014,7 @@ void WindowTreeImpl::SetCapture(uint32_t change_id, Id window_id) {
client()->OnChangeCompleted(change_id, success);
}
-void WindowTreeImpl::ReleaseCapture(uint32_t change_id, Id window_id) {
+void WindowTree::ReleaseCapture(uint32_t change_id, Id window_id) {
ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id));
Display* display = GetDisplay(window);
ServerWindow* current_capture_window =
@@ -1041,9 +1030,9 @@ void WindowTreeImpl::ReleaseCapture(uint32_t change_id, Id window_id) {
client()->OnChangeCompleted(change_id, success);
}
-void WindowTreeImpl::SetWindowBounds(uint32_t change_id,
- Id window_id,
- mojo::RectPtr bounds) {
+void WindowTree::SetWindowBounds(uint32_t change_id,
+ Id window_id,
+ mojo::RectPtr bounds) {
ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id));
if (window && ShouldRouteToWindowManager(window)) {
const uint32_t wm_change_id =
@@ -1068,18 +1057,18 @@ void WindowTreeImpl::SetWindowBounds(uint32_t change_id,
client()->OnChangeCompleted(change_id, success);
}
-void WindowTreeImpl::SetWindowVisibility(uint32_t change_id,
- Id transport_window_id,
- bool visible) {
+void WindowTree::SetWindowVisibility(uint32_t change_id,
+ Id transport_window_id,
+ bool visible) {
client()->OnChangeCompleted(
change_id,
SetWindowVisibility(ClientWindowId(transport_window_id), visible));
}
-void WindowTreeImpl::SetWindowProperty(uint32_t change_id,
- Id transport_window_id,
- const mojo::String& name,
- mojo::Array<uint8_t> value) {
+void WindowTree::SetWindowProperty(uint32_t change_id,
+ Id transport_window_id,
+ const mojo::String& name,
+ mojo::Array<uint8_t> value) {
ServerWindow* window =
GetWindowByClientId(ClientWindowId(transport_window_id));
if (window && ShouldRouteToWindowManager(window)) {
@@ -1106,11 +1095,10 @@ void WindowTreeImpl::SetWindowProperty(uint32_t change_id,
client()->OnChangeCompleted(change_id, success);
}
-void WindowTreeImpl::AttachSurface(
- Id transport_window_id,
- mojom::SurfaceType type,
- mojo::InterfaceRequest<mojom::Surface> surface,
- mojom::SurfaceClientPtr client) {
+void WindowTree::AttachSurface(Id transport_window_id,
+ mojom::SurfaceType type,
+ mojo::InterfaceRequest<mojom::Surface> surface,
+ mojom::SurfaceClientPtr client) {
ServerWindow* window =
GetWindowByClientId(ClientWindowId(transport_window_id));
const bool success =
@@ -1120,8 +1108,8 @@ void WindowTreeImpl::AttachSurface(
window->CreateSurface(type, std::move(surface), std::move(client));
}
-void WindowTreeImpl::SetWindowTextInputState(Id transport_window_id,
- mojo::TextInputStatePtr state) {
+void WindowTree::SetWindowTextInputState(Id transport_window_id,
+ mojo::TextInputStatePtr state) {
ServerWindow* window =
GetWindowByClientId(ClientWindowId(transport_window_id));
bool success = window && access_policy_->CanSetWindowTextInputState(window);
@@ -1129,9 +1117,9 @@ void WindowTreeImpl::SetWindowTextInputState(Id transport_window_id,
window->SetTextInputState(state.To<ui::TextInputState>());
}
-void WindowTreeImpl::SetImeVisibility(Id transport_window_id,
- bool visible,
- mojo::TextInputStatePtr state) {
+void WindowTree::SetImeVisibility(Id transport_window_id,
+ bool visible,
+ mojo::TextInputStatePtr state) {
ServerWindow* window =
GetWindowByClientId(ClientWindowId(transport_window_id));
bool success = window && access_policy_->CanSetWindowTextInputState(window);
@@ -1145,7 +1133,7 @@ void WindowTreeImpl::SetImeVisibility(Id transport_window_id,
}
}
-void WindowTreeImpl::OnWindowInputEventAck(uint32_t event_id) {
+void WindowTree::OnWindowInputEventAck(uint32_t event_id) {
if (event_ack_id_ == 0 || event_id != event_ack_id_) {
// TODO(sad): Something bad happened. Kill the client?
NOTIMPLEMENTED() << "Wrong event acked.";
@@ -1173,7 +1161,7 @@ void WindowTreeImpl::OnWindowInputEventAck(uint32_t event_id) {
}
}
-void WindowTreeImpl::SetClientArea(
+void WindowTree::SetClientArea(
Id transport_window_id,
mojo::InsetsPtr insets,
mojo::Array<mojo::RectPtr> transport_additional_client_areas) {
@@ -1187,17 +1175,17 @@ void WindowTreeImpl::SetClientArea(
window->SetClientArea(insets.To<gfx::Insets>(), additional_client_areas);
}
-void WindowTreeImpl::Embed(Id transport_window_id,
- mojom::WindowTreeClientPtr client,
- uint32_t policy_bitmask,
- const EmbedCallback& callback) {
+void WindowTree::Embed(Id transport_window_id,
+ mojom::WindowTreeClientPtr client,
+ uint32_t policy_bitmask,
+ const EmbedCallback& callback) {
ConnectionSpecificId connection_id = kInvalidConnectionId;
const bool result = Embed(ClientWindowId(transport_window_id),
std::move(client), policy_bitmask, &connection_id);
callback.Run(result, connection_id);
}
-void WindowTreeImpl::SetFocus(uint32_t change_id, Id transport_window_id) {
+void WindowTree::SetFocus(uint32_t change_id, Id transport_window_id) {
ServerWindow* window =
GetWindowByClientId(ClientWindowId(transport_window_id));
// TODO(beng): consider shifting non-policy drawn check logic to VTH's
@@ -1214,7 +1202,7 @@ void WindowTreeImpl::SetFocus(uint32_t change_id, Id transport_window_id) {
client()->OnChangeCompleted(change_id, success);
}
-void WindowTreeImpl::SetCanFocus(Id transport_window_id, bool can_focus) {
+void WindowTree::SetCanFocus(Id transport_window_id, bool can_focus) {
ServerWindow* window =
GetWindowByClientId(ClientWindowId(transport_window_id));
// TODO(sky): there should be an else case (it shouldn't route to wm and
@@ -1223,9 +1211,9 @@ void WindowTreeImpl::SetCanFocus(Id transport_window_id, bool can_focus) {
window->set_can_focus(can_focus);
}
-void WindowTreeImpl::SetPredefinedCursor(uint32_t change_id,
- Id transport_window_id,
- mus::mojom::Cursor cursor_id) {
+void WindowTree::SetPredefinedCursor(uint32_t change_id,
+ Id transport_window_id,
+ mus::mojom::Cursor cursor_id) {
ServerWindow* window =
GetWindowByClientId(ClientWindowId(transport_window_id));
@@ -1239,7 +1227,7 @@ void WindowTreeImpl::SetPredefinedCursor(uint32_t change_id,
client()->OnChangeCompleted(change_id, success);
}
-void WindowTreeImpl::GetWindowManagerClient(
+void WindowTree::GetWindowManagerClient(
mojo::AssociatedInterfaceRequest<mojom::WindowManagerClient> internal) {
if (!access_policy_->CanSetWindowManager() || !window_manager_internal_ ||
window_manager_internal_client_binding_) {
@@ -1250,9 +1238,9 @@ void WindowTreeImpl::GetWindowManagerClient(
this, std::move(internal)));
}
-void WindowTreeImpl::AddAccelerator(uint32_t id,
- mojom::EventMatcherPtr event_matcher,
- const AddAcceleratorCallback& callback) {
+void WindowTree::AddAccelerator(uint32_t id,
+ mojom::EventMatcherPtr event_matcher,
+ const AddAcceleratorCallback& callback) {
Display* host = GetDisplayForWindowManager();
const bool success =
host &&
@@ -1260,14 +1248,14 @@ void WindowTreeImpl::AddAccelerator(uint32_t id,
callback.Run(success);
}
-void WindowTreeImpl::RemoveAccelerator(uint32_t id) {
+void WindowTree::RemoveAccelerator(uint32_t id) {
Display* host = GetDisplayForWindowManager();
if (!host)
return;
host->event_dispatcher()->RemoveAccelerator(id);
}
-void WindowTreeImpl::AddActivationParent(Id transport_window_id) {
+void WindowTree::AddActivationParent(Id transport_window_id) {
Display* host = GetDisplayForWindowManager();
if (!host)
return;
@@ -1277,7 +1265,7 @@ void WindowTreeImpl::AddActivationParent(Id transport_window_id) {
host->AddActivationParent(window);
}
-void WindowTreeImpl::RemoveActivationParent(Id transport_window_id) {
+void WindowTree::RemoveActivationParent(Id transport_window_id) {
Display* host = GetDisplayForWindowManager();
if (!host)
return;
@@ -1287,14 +1275,14 @@ void WindowTreeImpl::RemoveActivationParent(Id transport_window_id) {
host->RemoveActivationParent(window);
}
-void WindowTreeImpl::ActivateNextWindow() {
+void WindowTree::ActivateNextWindow() {
Display* host = GetDisplayForWindowManager();
if (!host)
return;
host->focus_controller()->ActivateNextWindow();
}
-void WindowTreeImpl::SetUnderlaySurfaceOffsetAndExtendedHitArea(
+void WindowTree::SetUnderlaySurfaceOffsetAndExtendedHitArea(
Id window_id,
int32_t x_offset,
int32_t y_offset,
@@ -1307,13 +1295,13 @@ void WindowTreeImpl::SetUnderlaySurfaceOffsetAndExtendedHitArea(
window->set_extended_hit_test_region(hit_area.To<gfx::Insets>());
}
-void WindowTreeImpl::WmResponse(uint32_t change_id, bool response) {
+void WindowTree::WmResponse(uint32_t change_id, bool response) {
// TODO(sky): think about what else case means.
if (GetDisplayForWindowManager())
connection_manager_->WindowManagerChangeCompleted(change_id, response);
}
-void WindowTreeImpl::WmRequestClose(Id transport_window_id) {
+void WindowTree::WmRequestClose(Id transport_window_id) {
// Only the WindowManager should be using this.
Display* host = GetDisplayForWindowManager();
if (!host)
@@ -1321,23 +1309,21 @@ void WindowTreeImpl::WmRequestClose(Id transport_window_id) {
ServerWindow* window =
GetWindowByClientId(ClientWindowId(transport_window_id));
- WindowTreeImpl* connection =
- connection_manager_->GetConnectionWithRoot(window);
- if (connection && connection != this) {
- connection->client()->RequestClose(
- connection->ClientWindowIdForWindow(window).id);
+ WindowTree* tree = connection_manager_->GetTreeWithRoot(window);
+ if (tree && tree != this) {
+ tree->client()->RequestClose(tree->ClientWindowIdForWindow(window).id);
}
// TODO(sky): think about what else case means.
}
-void WindowTreeImpl::WmSetFrameDecorationValues(
+void WindowTree::WmSetFrameDecorationValues(
mojom::FrameDecorationValuesPtr values) {
if (GetDisplayForWindowManager())
GetDisplayForWindowManager()->SetFrameDecorationValues(std::move(values));
}
-void WindowTreeImpl::OnWmCreatedTopLevelWindow(uint32_t change_id,
- Id transport_window_id) {
+void WindowTree::OnWmCreatedTopLevelWindow(uint32_t change_id,
+ Id transport_window_id) {
if (GetDisplayForWindowManager()) {
ServerWindow* window =
GetWindowByClientId(ClientWindowId(transport_window_id));
@@ -1351,23 +1337,22 @@ void WindowTreeImpl::OnWmCreatedTopLevelWindow(uint32_t change_id,
// TODO(sky): think about what else case means.
}
-bool WindowTreeImpl::HasRootForAccessPolicy(const ServerWindow* window) const {
+bool WindowTree::HasRootForAccessPolicy(const ServerWindow* window) const {
return HasRoot(window);
}
-bool WindowTreeImpl::IsWindowKnownForAccessPolicy(
+bool WindowTree::IsWindowKnownForAccessPolicy(
const ServerWindow* window) const {
return IsWindowKnown(window);
}
-bool WindowTreeImpl::IsWindowRootOfAnotherConnectionForAccessPolicy(
+bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy(
const ServerWindow* window) const {
- WindowTreeImpl* connection =
- connection_manager_->GetConnectionWithRoot(window);
- return connection && connection != this;
+ WindowTree* tree = connection_manager_->GetTreeWithRoot(window);
+ return tree && tree != this;
}
-bool WindowTreeImpl::IsDescendantOfEmbedRoot(const ServerWindow* window) {
+bool WindowTree::IsDescendantOfEmbedRoot(const ServerWindow* window) {
if (!is_embed_root_)
return false;
diff --git a/components/mus/ws/window_tree_impl.h b/components/mus/ws/window_tree.h
index c7575cc..fed9da0 100644
--- a/components/mus/ws/window_tree_impl.h
+++ b/components/mus/ws/window_tree.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef COMPONENTS_MUS_WS_WINDOW_TREE_IMPL_H_
-#define COMPONENTS_MUS_WS_WINDOW_TREE_IMPL_H_
+#ifndef COMPONENTS_MUS_WS_WINDOW_TREE_H_
+#define COMPONENTS_MUS_WS_WINDOW_TREE_H_
#include <stdint.h>
@@ -20,8 +20,8 @@
#include "components/mus/public/interfaces/surface_id.mojom.h"
#include "components/mus/public/interfaces/window_tree.mojom.h"
#include "components/mus/ws/access_policy_delegate.h"
-#include "components/mus/ws/client_connection.h"
#include "components/mus/ws/ids.h"
+#include "components/mus/ws/window_tree_binding.h"
#include "mojo/public/cpp/bindings/associated_binding.h"
namespace gfx {
@@ -43,34 +43,38 @@ namespace test {
class WindowTreeTestApi;
}
-// An instance of WindowTreeImpl is created for every WindowTree request.
-// WindowTreeImpl tracks all the state and windows created by a client.
-// WindowTreeImpl coordinates with ConnectionManager to update the client (and
-// internal state) as necessary.
-class WindowTreeImpl : public mojom::WindowTree,
- public AccessPolicyDelegate,
- public mojom::WindowManagerClient {
+// WindowTree represents a view onto portions of the window tree. The parts of
+// the tree exposed to the client start at the root windows. A WindowTree may
+// have any number of roots (including none). A WindowTree may not have
+// visibility of all the descendants of its roots.
+//
+// WindowTree notifies its client as changes happen to windows exposed to the
+// the client.
+//
+// See ids.h for details on how WindowTree handles identity of windows.
+class WindowTree : public mojom::WindowTree,
+ public AccessPolicyDelegate,
+ public mojom::WindowManagerClient {
public:
- WindowTreeImpl(ConnectionManager* connection_manager,
- ServerWindow* root,
- uint32_t policy_bitmask);
- ~WindowTreeImpl() override;
+ WindowTree(ConnectionManager* connection_manager,
+ ServerWindow* root,
+ uint32_t policy_bitmask);
+ ~WindowTree() override;
- void Init(scoped_ptr<ClientConnection> client_connection,
- mojom::WindowTreePtr tree);
+ void Init(scoped_ptr<WindowTreeBinding> binding, mojom::WindowTreePtr tree);
- // Called if this WindowTreeImpl hosts the WindowManager. This happens if
- // this WindowTreeImpl serves as the root of a WindowTreeHost.
+ // Called if this WindowTree hosts the WindowManager. This happens if
+ // this WindowTree serves as the root of a WindowTreeHost.
void ConfigureWindowManager();
ConnectionSpecificId id() const { return id_; }
- mojom::WindowTreeClient* client() { return client_connection_->client(); }
+ mojom::WindowTreeClient* client() { return binding_->client(); }
// Returns the Window with the specified id.
ServerWindow* GetWindow(const WindowId& id) {
return const_cast<ServerWindow*>(
- const_cast<const WindowTreeImpl*>(this)->GetWindow(id));
+ const_cast<const WindowTree*>(this)->GetWindow(id));
}
const ServerWindow* GetWindow(const WindowId& id) const;
@@ -78,20 +82,20 @@ class WindowTreeImpl : public mojom::WindowTree,
// client, returns null if not known.
ServerWindow* GetWindowByClientId(const ClientWindowId& id) {
return const_cast<ServerWindow*>(
- const_cast<const WindowTreeImpl*>(this)->GetWindowByClientId(id));
+ const_cast<const WindowTree*>(this)->GetWindowByClientId(id));
}
const ServerWindow* GetWindowByClientId(const ClientWindowId& id) const;
bool IsWindowKnown(const ServerWindow* window) const {
return IsWindowKnown(window, nullptr);
}
- // Returns whether |window| is known to this connection. If |window| is
- // known and |client_window_id| is non-null |client_window_id| is set to
- // the ClientWindowId of the window.
+ // Returns whether |window| is known to this tree. If |window| is known and
+ // |client_window_id| is non-null |client_window_id| is set to the
+ // ClientWindowId of the window.
bool IsWindowKnown(const ServerWindow* window,
ClientWindowId* client_window_id) const;
- // Returns true if |window| is one of this connections roots.
+ // Returns true if |window| is one of this trees roots.
bool HasRoot(const ServerWindow* window) const;
std::set<const ServerWindow*> roots() { return roots_; }
@@ -101,11 +105,11 @@ class WindowTreeImpl : public mojom::WindowTree,
const Display* GetDisplay(const ServerWindow* window) const;
Display* GetDisplay(const ServerWindow* window) {
return const_cast<Display*>(
- const_cast<const WindowTreeImpl*>(this)->GetDisplay(window));
+ const_cast<const WindowTree*>(this)->GetDisplay(window));
}
- // Invoked when a connection is about to be destroyed.
- void OnWindowDestroyingTreeImpl(WindowTreeImpl* connection);
+ // Invoked when a tree is about to be destroyed.
+ void OnWindowDestroyingTreeImpl(WindowTree* tree);
void OnWillDestroyDisplay(Display* display);
@@ -221,14 +225,14 @@ class WindowTreeImpl : public mojom::WindowTree,
WindowId GenerateNewWindowId();
// These functions return true if the corresponding mojom function is allowed
- // for this connection.
+ // for this tree.
bool CanReorderWindow(const ServerWindow* window,
const ServerWindow* relative_window,
mojom::OrderDirection direction) const;
- // Deletes a window owned by this connection. Returns true on success.
- // |source| is the connection that originated the change.
- bool DeleteWindowImpl(WindowTreeImpl* source, ServerWindow* window);
+ // Deletes a window owned by this tree. Returns true on success. |source| is
+ // the tree that originated the change.
+ bool DeleteWindowImpl(WindowTree* source, ServerWindow* window);
// If |window| is known does nothing. Otherwise adds |window| to |windows|,
// marks |window| as known and recurses.
@@ -240,12 +244,13 @@ class WindowTreeImpl : public mojom::WindowTree,
bool RemoveFromMaps(const ServerWindow* window);
// Removes |window| and all its descendants from the necessary maps. This
- // does not recurse through windows that were created by this connection. All
- // windows owned by this connection are added to |local_windows|.
+ // does not recurse through windows that were created by this tree. All
+ // windows owned by this tree are added to |local_windows|.
void RemoveFromKnown(const ServerWindow* window,
std::vector<ServerWindow*>* local_windows);
- // Resets the root of this connection.
+ // Removes a root from set of roots of this tree. This does not remove
+ // the window from the window tree, only from the set of roots.
void RemoveRoot(const ServerWindow* window, RemoveRootReason reason);
// Converts Window(s) to WindowData(s) for transport. This assumes all the
@@ -366,26 +371,26 @@ class WindowTreeImpl : public mojom::WindowTree,
// AccessPolicyDelegate:
bool HasRootForAccessPolicy(const ServerWindow* window) const override;
bool IsWindowKnownForAccessPolicy(const ServerWindow* window) const override;
- bool IsWindowRootOfAnotherConnectionForAccessPolicy(
+ bool IsWindowRootOfAnotherTreeForAccessPolicy(
const ServerWindow* window) const override;
bool IsDescendantOfEmbedRoot(const ServerWindow* window) override;
ConnectionManager* connection_manager_;
- // Id of this connection as assigned by ConnectionManager.
+ // Id of this tree as assigned by ConnectionManager.
const ConnectionSpecificId id_;
ConnectionSpecificId next_window_id_;
- scoped_ptr<ClientConnection> client_connection_;
+ scoped_ptr<WindowTreeBinding> binding_;
scoped_ptr<mus::ws::AccessPolicy> access_policy_;
- // The roots, or embed points, of this connection. A WindowTreeImpl may have
- // any number of roots, including 0.
+ // The roots, or embed points, of this tree. A WindowTree may have any
+ // number of roots, including 0.
std::set<const ServerWindow*> roots_;
- // The windows created by this connection. This connection owns these objects.
+ // The windows created by this tree. This tree owns these objects.
base::hash_map<WindowId, ServerWindow*> created_window_map_;
// The client is allowed to assign ids. These two maps providing the mapping
@@ -409,10 +414,10 @@ class WindowTreeImpl : public mojom::WindowTree,
scoped_ptr<WaitingForTopLevelWindowInfo> waiting_for_top_level_window_info_;
- DISALLOW_COPY_AND_ASSIGN(WindowTreeImpl);
+ DISALLOW_COPY_AND_ASSIGN(WindowTree);
};
} // namespace ws
} // namespace mus
-#endif // COMPONENTS_MUS_WS_WINDOW_TREE_IMPL_H_
+#endif // COMPONENTS_MUS_WS_WINDOW_TREE_H_
diff --git a/components/mus/ws/window_tree_apptest.cc b/components/mus/ws/window_tree_apptest.cc
index f232911..8970435 100644
--- a/components/mus/ws/window_tree_apptest.cc
+++ b/components/mus/ws/window_tree_apptest.cc
@@ -65,7 +65,7 @@ void EmbedCallbackImpl(base::RunLoop* run_loop,
// -----------------------------------------------------------------------------
bool EmbedUrl(mojo::Connector* connector,
- WindowTree* ws,
+ WindowTree* tree,
const String& url,
Id root_id) {
bool result = false;
@@ -73,32 +73,32 @@ bool EmbedUrl(mojo::Connector* connector,
{
mojom::WindowTreeClientPtr client;
connector->ConnectToInterface(url.get(), &client);
- ws->Embed(root_id, std::move(client),
- mojom::WindowTree::kAccessPolicyDefault,
- base::Bind(&EmbedCallbackImpl, &run_loop, &result));
+ tree->Embed(root_id, std::move(client),
+ mojom::WindowTree::kAccessPolicyDefault,
+ base::Bind(&EmbedCallbackImpl, &run_loop, &result));
}
run_loop.Run();
return result;
}
-bool Embed(WindowTree* ws, Id root_id, mojom::WindowTreeClientPtr client) {
+bool Embed(WindowTree* tree, Id root_id, mojom::WindowTreeClientPtr client) {
bool result = false;
base::RunLoop run_loop;
{
- ws->Embed(root_id, std::move(client),
- mojom::WindowTree::kAccessPolicyDefault,
- base::Bind(&EmbedCallbackImpl, &run_loop, &result));
+ tree->Embed(root_id, std::move(client),
+ mojom::WindowTree::kAccessPolicyDefault,
+ base::Bind(&EmbedCallbackImpl, &run_loop, &result));
}
run_loop.Run();
return result;
}
-void GetWindowTree(WindowTree* ws,
+void GetWindowTree(WindowTree* tree,
Id window_id,
std::vector<TestWindow>* windows) {
base::RunLoop run_loop;
- ws->GetWindowTree(window_id,
- base::Bind(&WindowTreeResultCallback, &run_loop, windows));
+ tree->GetWindowTree(
+ window_id, base::Bind(&WindowTreeResultCallback, &run_loop, windows));
run_loop.Run();
}
@@ -481,19 +481,19 @@ class WindowTreeAppTest : public mojo::test::ApplicationTestBase,
protected:
// Returns the changes from the various connections.
- std::vector<Change>* changes1() { return ws_client1_->tracker()->changes(); }
- std::vector<Change>* changes2() { return ws_client2_->tracker()->changes(); }
- std::vector<Change>* changes3() { return ws_client3_->tracker()->changes(); }
+ std::vector<Change>* changes1() { return wt_client1_->tracker()->changes(); }
+ std::vector<Change>* changes2() { return wt_client2_->tracker()->changes(); }
+ std::vector<Change>* changes3() { return wt_client3_->tracker()->changes(); }
- // Various connections. |ws1()|, being the first connection, has special
+ // Various connections. |wt1()|, being the first connection, has special
// permissions (it's treated as the window manager).
- WindowTree* ws1() { return ws_client1_->tree(); }
- WindowTree* ws2() { return ws_client2_->tree(); }
- WindowTree* ws3() { return ws_client3_->tree(); }
+ WindowTree* wt1() { return wt_client1_->tree(); }
+ WindowTree* wt2() { return wt_client2_->tree(); }
+ WindowTree* wt3() { return wt_client3_->tree(); }
- TestWindowTreeClientImpl* ws_client1() { return ws_client1_.get(); }
- TestWindowTreeClientImpl* ws_client2() { return ws_client2_.get(); }
- TestWindowTreeClientImpl* ws_client3() { return ws_client3_.get(); }
+ TestWindowTreeClientImpl* wt_client1() { return wt_client1_.get(); }
+ TestWindowTreeClientImpl* wt_client2() { return wt_client2_.get(); }
+ TestWindowTreeClientImpl* wt_client3() { return wt_client3_.get(); }
Id root_window_id() const { return root_window_id_; }
@@ -501,17 +501,17 @@ class WindowTreeAppTest : public mojo::test::ApplicationTestBase,
int connection_id_2() const { return connection_id_2_; }
void EstablishSecondConnectionWithRoot(Id root_id) {
- ASSERT_TRUE(ws_client2_.get() == nullptr);
- ws_client2_ =
- EstablishConnectionViaEmbed(ws1(), root_id, &connection_id_2_);
+ ASSERT_TRUE(wt_client2_.get() == nullptr);
+ wt_client2_ =
+ EstablishConnectionViaEmbed(wt1(), root_id, &connection_id_2_);
ASSERT_GT(connection_id_2_, 0);
- ASSERT_TRUE(ws_client2_.get() != nullptr);
+ ASSERT_TRUE(wt_client2_.get() != nullptr);
}
void EstablishSecondConnection(bool create_initial_window) {
Id window_1_1 = 0;
if (create_initial_window) {
- window_1_1 = ws_client1()->NewWindow(1);
+ window_1_1 = wt_client1()->NewWindow(1);
ASSERT_TRUE(window_1_1);
}
ASSERT_NO_FATAL_FAILURE(
@@ -524,9 +524,9 @@ class WindowTreeAppTest : public mojo::test::ApplicationTestBase,
}
void EstablishThirdConnection(WindowTree* owner, Id root_id) {
- ASSERT_TRUE(ws_client3_.get() == nullptr);
- ws_client3_ = EstablishConnectionViaEmbed(owner, root_id, nullptr);
- ASSERT_TRUE(ws_client3_.get() != nullptr);
+ ASSERT_TRUE(wt_client3_.get() == nullptr);
+ wt_client3_ = EstablishConnectionViaEmbed(owner, root_id, nullptr);
+ ASSERT_TRUE(wt_client3_.get() != nullptr);
}
scoped_ptr<TestWindowTreeClientImpl> WaitForWindowTreeClient() {
@@ -577,14 +577,14 @@ class WindowTreeAppTest : public mojo::test::ApplicationTestBase,
connector()->ConnectToInterface("mojo:mus", &factory);
mojom::WindowTreeClientPtr tree_client_ptr;
- ws_client1_.reset(new TestWindowTreeClientImpl());
- ws_client1_->Bind(GetProxy(&tree_client_ptr));
+ wt_client1_.reset(new TestWindowTreeClientImpl());
+ wt_client1_->Bind(GetProxy(&tree_client_ptr));
factory->CreateWindowTreeHost(GetProxy(&host_),
std::move(tree_client_ptr));
// Next we should get an embed call on the "window manager" client.
- ws_client1_->WaitForIncomingMethodCall();
+ wt_client1_->WaitForIncomingMethodCall();
ASSERT_EQ(1u, changes1()->size());
EXPECT_EQ(CHANGE_TYPE_EMBED, (*changes1())[0].type);
@@ -595,7 +595,7 @@ class WindowTreeAppTest : public mojo::test::ApplicationTestBase,
connection_id_1_ = (*changes1())[0].connection_id;
ASSERT_FALSE((*changes1())[0].windows.empty());
root_window_id_ = (*changes1())[0].windows[0].window_id;
- ASSERT_EQ(root_window_id_, ws_client1_->root_window_id());
+ ASSERT_EQ(root_window_id_, wt_client1_->root_window_id());
changes1()->clear();
}
@@ -605,9 +605,9 @@ class WindowTreeAppTest : public mojo::test::ApplicationTestBase,
return true;
}
- scoped_ptr<TestWindowTreeClientImpl> ws_client1_;
- scoped_ptr<TestWindowTreeClientImpl> ws_client2_;
- scoped_ptr<TestWindowTreeClientImpl> ws_client3_;
+ scoped_ptr<TestWindowTreeClientImpl> wt_client1_;
+ scoped_ptr<TestWindowTreeClientImpl> wt_client2_;
+ scoped_ptr<TestWindowTreeClientImpl> wt_client3_;
mojom::WindowTreeHostPtr host_;
@@ -631,13 +631,13 @@ TEST_F(WindowTreeAppTest, TwoClientsGetDifferentConnectionIds) {
// Verifies when Embed() is invoked any child windows are removed.
TEST_F(WindowTreeAppTest, WindowsRemovedWhenEmbedding) {
// Two windows 1 and 2. 2 is parented to 1.
- Id window_1_1 = ws_client1()->NewWindow(1);
+ Id window_1_1 = wt_client1()->NewWindow(1);
ASSERT_TRUE(window_1_1);
- ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_1));
+ ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
- Id window_1_2 = ws_client1()->NewWindow(2);
+ Id window_1_2 = wt_client1()->NewWindow(2);
ASSERT_TRUE(window_1_2);
- ASSERT_TRUE(ws_client1()->AddWindow(window_1_1, window_1_2));
+ ASSERT_TRUE(wt_client1()->AddWindow(window_1_1, window_1_2));
ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false));
ASSERT_EQ(1u, changes2()->size());
@@ -648,7 +648,7 @@ TEST_F(WindowTreeAppTest, WindowsRemovedWhenEmbedding) {
// Embed() removed window 2.
{
std::vector<TestWindow> windows;
- GetWindowTree(ws1(), window_1_2, &windows);
+ GetWindowTree(wt1(), window_1_2, &windows);
EXPECT_EQ(WindowParentToString(window_1_2, kNullParentId),
SingleWindowDescription(windows));
}
@@ -656,35 +656,35 @@ TEST_F(WindowTreeAppTest, WindowsRemovedWhenEmbedding) {
// ws2 should not see window 2.
{
std::vector<TestWindow> windows;
- GetWindowTree(ws2(), window_1_1, &windows);
+ GetWindowTree(wt2(), window_1_1, &windows);
EXPECT_EQ(WindowParentToString(window_1_1, kNullParentId),
SingleWindowDescription(windows));
}
{
std::vector<TestWindow> windows;
- GetWindowTree(ws2(), window_1_2, &windows);
+ GetWindowTree(wt2(), window_1_2, &windows);
EXPECT_TRUE(windows.empty());
}
// Windows 3 and 4 in connection 2.
- Id window_2_3 = ws_client2()->NewWindow(3);
- Id window_2_4 = ws_client2()->NewWindow(4);
+ Id window_2_3 = wt_client2()->NewWindow(3);
+ Id window_2_4 = wt_client2()->NewWindow(4);
ASSERT_TRUE(window_2_3);
ASSERT_TRUE(window_2_4);
- ASSERT_TRUE(ws_client2()->AddWindow(window_2_3, window_2_4));
+ ASSERT_TRUE(wt_client2()->AddWindow(window_2_3, window_2_4));
// Connection 3 rooted at 2.
- ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(ws2(), window_2_3));
+ ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(wt2(), window_2_3));
// Window 4 should no longer have a parent.
{
std::vector<TestWindow> windows;
- GetWindowTree(ws2(), window_2_3, &windows);
+ GetWindowTree(wt2(), window_2_3, &windows);
EXPECT_EQ(WindowParentToString(window_2_3, kNullParentId),
SingleWindowDescription(windows));
windows.clear();
- GetWindowTree(ws2(), window_2_4, &windows);
+ GetWindowTree(wt2(), window_2_4, &windows);
EXPECT_EQ(WindowParentToString(window_2_4, kNullParentId),
SingleWindowDescription(windows));
}
@@ -692,7 +692,7 @@ TEST_F(WindowTreeAppTest, WindowsRemovedWhenEmbedding) {
// And window 4 should not be visible to connection 3.
{
std::vector<TestWindow> windows;
- GetWindowTree(ws3(), window_2_3, &windows);
+ GetWindowTree(wt3(), window_2_3, &windows);
EXPECT_EQ("no windows", SingleWindowDescription(windows));
}
}
@@ -703,22 +703,22 @@ TEST_F(WindowTreeAppTest, CantAccessChildrenOfEmbeddedWindow) {
ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
Id window_1_1 = BuildWindowId(connection_id_1(), 1);
- Id window_2_2 = ws_client2()->NewWindow(2);
+ Id window_2_2 = wt_client2()->NewWindow(2);
ASSERT_TRUE(window_2_2);
- ASSERT_TRUE(ws_client2()->AddWindow(window_1_1, window_2_2));
+ ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_2));
- ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(ws2(), window_2_2));
+ ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(wt2(), window_2_2));
- Id window_3_3 = ws_client3()->NewWindow(3);
+ Id window_3_3 = wt_client3()->NewWindow(3);
ASSERT_TRUE(window_3_3);
ASSERT_TRUE(
- ws_client3()->AddWindow(ws_client3()->root_window_id(), window_3_3));
+ wt_client3()->AddWindow(wt_client3()->root_window_id(), window_3_3));
// Even though 3 is a child of 2 connection 2 can't see 3 as it's from a
// different connection.
{
std::vector<TestWindow> windows;
- GetWindowTree(ws2(), window_2_2, &windows);
+ GetWindowTree(wt2(), window_2_2, &windows);
EXPECT_EQ(WindowParentToString(window_2_2, window_1_1),
SingleWindowDescription(windows));
}
@@ -726,20 +726,20 @@ TEST_F(WindowTreeAppTest, CantAccessChildrenOfEmbeddedWindow) {
// Connection 2 shouldn't be able to get window 3 at all.
{
std::vector<TestWindow> windows;
- GetWindowTree(ws2(), window_3_3, &windows);
+ GetWindowTree(wt2(), window_3_3, &windows);
EXPECT_TRUE(windows.empty());
}
// Connection 1 should be able to see it all (its the root).
{
std::vector<TestWindow> windows;
- GetWindowTree(ws1(), window_1_1, &windows);
+ GetWindowTree(wt1(), window_1_1, &windows);
ASSERT_EQ(3u, windows.size());
EXPECT_EQ(WindowParentToString(window_1_1, kNullParentId),
windows[0].ToString());
// NOTE: we expect a match of WindowParentToString(window_2_2, window_1_1),
// but the ids are in the id space of client2, which is not the same as
- // the id space of ws1().
+ // the id space of wt1().
EXPECT_EQ("window=2,1 parent=1,1", windows[1].ToString());
// Same thing here, we really want to test for
// WindowParentToString(window_3_3, window_2_2).
@@ -752,38 +752,38 @@ TEST_F(WindowTreeAppTest, CantModifyChildrenOfEmbeddedWindow) {
ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
Id window_1_1 = BuildWindowId(connection_id_1(), 1);
- Id window_2_1 = ws_client2()->NewWindow(1);
+ Id window_2_1 = wt_client2()->NewWindow(1);
ASSERT_TRUE(window_2_1);
- ASSERT_TRUE(ws_client2()->AddWindow(window_1_1, window_2_1));
+ ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_1));
- ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(ws2(), window_2_1));
+ ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(wt2(), window_2_1));
- Id window_2_2 = ws_client2()->NewWindow(2);
+ Id window_2_2 = wt_client2()->NewWindow(2);
ASSERT_TRUE(window_2_2);
// Connection 2 shouldn't be able to add anything to the window anymore.
- ASSERT_FALSE(ws_client2()->AddWindow(window_2_1, window_2_2));
+ ASSERT_FALSE(wt_client2()->AddWindow(window_2_1, window_2_2));
// Create window 3 in connection 3 and add it to window 3.
- Id window_3_1 = ws_client3()->NewWindow(1);
+ Id window_3_1 = wt_client3()->NewWindow(1);
ASSERT_TRUE(window_3_1);
- ASSERT_TRUE(ws_client3()->AddWindow(window_2_1, window_3_1));
+ ASSERT_TRUE(wt_client3()->AddWindow(window_2_1, window_3_1));
// Connection 2 shouldn't be able to remove window 3.
- ASSERT_FALSE(ws_client2()->RemoveWindowFromParent(window_3_1));
+ ASSERT_FALSE(wt_client2()->RemoveWindowFromParent(window_3_1));
}
// Verifies client gets a valid id.
TEST_F(WindowTreeAppTest, NewWindow) {
- Id window_1_1 = ws_client1()->NewWindow(1);
+ Id window_1_1 = wt_client1()->NewWindow(1);
ASSERT_TRUE(window_1_1);
EXPECT_TRUE(changes1()->empty());
// Can't create a window with the same id.
- ASSERT_EQ(0u, ws_client1()->NewWindowWithCompleteId(window_1_1));
+ ASSERT_EQ(0u, wt_client1()->NewWindowWithCompleteId(window_1_1));
EXPECT_TRUE(changes1()->empty());
// Can't create a window with a bogus connection id.
- ASSERT_EQ(0u, ws_client1()->NewWindowWithCompleteId(
+ ASSERT_EQ(0u, wt_client1()->NewWindowWithCompleteId(
BuildWindowId(connection_id_1() + 1, 1)));
EXPECT_TRUE(changes1()->empty());
}
@@ -791,46 +791,46 @@ TEST_F(WindowTreeAppTest, NewWindow) {
// Verifies AddWindow fails when window is already in position.
TEST_F(WindowTreeAppTest, AddWindowWithNoChange) {
// Create the embed point now so that the ids line up.
- ASSERT_TRUE(ws_client1()->NewWindow(1));
- Id window_1_2 = ws_client1()->NewWindow(2);
- Id window_1_3 = ws_client1()->NewWindow(3);
+ ASSERT_TRUE(wt_client1()->NewWindow(1));
+ Id window_1_2 = wt_client1()->NewWindow(2);
+ Id window_1_3 = wt_client1()->NewWindow(3);
ASSERT_TRUE(window_1_2);
ASSERT_TRUE(window_1_3);
ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false));
// Make 3 a child of 2.
- ASSERT_TRUE(ws_client1()->AddWindow(window_1_2, window_1_3));
+ ASSERT_TRUE(wt_client1()->AddWindow(window_1_2, window_1_3));
// Try again, this should fail.
- EXPECT_FALSE(ws_client1()->AddWindow(window_1_2, window_1_3));
+ EXPECT_FALSE(wt_client1()->AddWindow(window_1_2, window_1_3));
}
// Verifies AddWindow fails when window is already in position.
TEST_F(WindowTreeAppTest, AddAncestorFails) {
// Create the embed point now so that the ids line up.
- ASSERT_TRUE(ws_client1()->NewWindow(1));
- Id window_1_2 = ws_client1()->NewWindow(2);
- Id window_1_3 = ws_client1()->NewWindow(3);
+ ASSERT_TRUE(wt_client1()->NewWindow(1));
+ Id window_1_2 = wt_client1()->NewWindow(2);
+ Id window_1_3 = wt_client1()->NewWindow(3);
ASSERT_TRUE(window_1_2);
ASSERT_TRUE(window_1_3);
ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false));
// Make 3 a child of 2.
- ASSERT_TRUE(ws_client1()->AddWindow(window_1_2, window_1_3));
+ ASSERT_TRUE(wt_client1()->AddWindow(window_1_2, window_1_3));
// Try to make 2 a child of 3, this should fail since 2 is an ancestor of 3.
- EXPECT_FALSE(ws_client1()->AddWindow(window_1_3, window_1_2));
+ EXPECT_FALSE(wt_client1()->AddWindow(window_1_3, window_1_2));
}
// Verifies adding to root sends right notifications.
TEST_F(WindowTreeAppTest, AddToRoot) {
// Create the embed point now so that the ids line up.
- Id window_1_1 = ws_client1()->NewWindow(1);
+ Id window_1_1 = wt_client1()->NewWindow(1);
ASSERT_TRUE(window_1_1);
- Id window_1_21 = ws_client1()->NewWindow(21);
- Id window_1_3 = ws_client1()->NewWindow(3);
+ Id window_1_21 = wt_client1()->NewWindow(21);
+ Id window_1_3 = wt_client1()->NewWindow(3);
ASSERT_TRUE(window_1_21);
ASSERT_TRUE(window_1_3);
@@ -838,42 +838,42 @@ TEST_F(WindowTreeAppTest, AddToRoot) {
changes2()->clear();
// Make 3 a child of 21.
- ASSERT_TRUE(ws_client1()->AddWindow(window_1_21, window_1_3));
+ ASSERT_TRUE(wt_client1()->AddWindow(window_1_21, window_1_3));
// Make 21 a child of 1.
- ASSERT_TRUE(ws_client1()->AddWindow(window_1_1, window_1_21));
+ ASSERT_TRUE(wt_client1()->AddWindow(window_1_1, window_1_21));
// Connection 2 should not be told anything (because the window is from a
// different connection). Create a window to ensure we got a response from
// the server.
- ASSERT_TRUE(ws_client2()->NewWindow(100));
+ ASSERT_TRUE(wt_client2()->NewWindow(100));
EXPECT_TRUE(changes2()->empty());
}
// Verifies HierarchyChanged is correctly sent for various adds/removes.
TEST_F(WindowTreeAppTest, WindowHierarchyChangedWindows) {
// Create the embed point now so that the ids line up.
- Id window_1_1 = ws_client1()->NewWindow(1);
+ Id window_1_1 = wt_client1()->NewWindow(1);
// 1,2->1,11.
- Id window_1_2 = ws_client1()->NewWindow(2);
+ Id window_1_2 = wt_client1()->NewWindow(2);
ASSERT_TRUE(window_1_2);
- ASSERT_TRUE(ws_client1()->SetWindowVisibility(window_1_2, true));
- Id window_1_11 = ws_client1()->NewWindow(11);
+ ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_2, true));
+ Id window_1_11 = wt_client1()->NewWindow(11);
ASSERT_TRUE(window_1_11);
- ASSERT_TRUE(ws_client1()->SetWindowVisibility(window_1_11, true));
- ASSERT_TRUE(ws_client1()->AddWindow(window_1_2, window_1_11));
+ ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_11, true));
+ ASSERT_TRUE(wt_client1()->AddWindow(window_1_2, window_1_11));
ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false));
- ASSERT_TRUE(ws_client1()->SetWindowVisibility(window_1_1, true));
+ ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_1, true));
- ASSERT_TRUE(ws_client2()->WaitForAllMessages());
+ ASSERT_TRUE(wt_client2()->WaitForAllMessages());
changes2()->clear();
// 1,1->1,2->1,11
{
// Client 2 should not get anything (1,2 is from another connection).
- ASSERT_TRUE(ws_client1()->AddWindow(window_1_1, window_1_2));
- ASSERT_TRUE(ws_client2()->WaitForAllMessages());
+ ASSERT_TRUE(wt_client1()->AddWindow(window_1_1, window_1_2));
+ ASSERT_TRUE(wt_client2()->WaitForAllMessages());
EXPECT_TRUE(changes2()->empty());
}
@@ -881,8 +881,8 @@ TEST_F(WindowTreeAppTest, WindowHierarchyChangedWindows) {
{
// Client 2 is now connected to the root, so it should have gotten a drawn
// notification.
- ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_1));
- ws_client2_->WaitForChangeCount(1u);
+ ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
+ wt_client2_->WaitForChangeCount(1u);
EXPECT_EQ(
"DrawnStateChanged window=" + IdToString(window_1_1) + " drawn=true",
SingleChangeToDescription(*changes2()));
@@ -893,29 +893,29 @@ TEST_F(WindowTreeAppTest, WindowHierarchyChangedWindows) {
// Client 2 is no longer connected to the root, should get drawn state
// changed.
changes2()->clear();
- ASSERT_TRUE(ws_client1()->RemoveWindowFromParent(window_1_1));
- ws_client2_->WaitForChangeCount(1);
+ ASSERT_TRUE(wt_client1()->RemoveWindowFromParent(window_1_1));
+ wt_client2_->WaitForChangeCount(1);
EXPECT_EQ(
"DrawnStateChanged window=" + IdToString(window_1_1) + " drawn=false",
SingleChangeToDescription(*changes2()));
}
// 1,1->1,2->1,11->1,111.
- Id window_1_111 = ws_client1()->NewWindow(111);
+ Id window_1_111 = wt_client1()->NewWindow(111);
ASSERT_TRUE(window_1_111);
- ASSERT_TRUE(ws_client1()->SetWindowVisibility(window_1_111, true));
+ ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_111, true));
{
changes2()->clear();
- ASSERT_TRUE(ws_client1()->AddWindow(window_1_11, window_1_111));
- ASSERT_TRUE(ws_client2()->WaitForAllMessages());
+ ASSERT_TRUE(wt_client1()->AddWindow(window_1_11, window_1_111));
+ ASSERT_TRUE(wt_client2()->WaitForAllMessages());
EXPECT_TRUE(changes2()->empty());
}
// 0,1->1,1->1,2->1,11->1,111
{
changes2()->clear();
- ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_1));
- ws_client2_->WaitForChangeCount(1);
+ ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
+ wt_client2_->WaitForChangeCount(1);
EXPECT_EQ(
"DrawnStateChanged window=" + IdToString(window_1_1) + " drawn=true",
SingleChangeToDescription(*changes2()));
@@ -928,24 +928,24 @@ TEST_F(WindowTreeAppTest, WindowHierarchyChangedAddingKnownToUnknown) {
ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
Id window_1_1 = BuildWindowId(connection_id_1(), 1);
- Id window_2_11 = ws_client2()->NewWindow(11);
- Id window_2_2 = ws_client2()->NewWindow(2);
- Id window_2_21 = ws_client2()->NewWindow(21);
+ Id window_2_11 = wt_client2()->NewWindow(11);
+ Id window_2_2 = wt_client2()->NewWindow(2);
+ Id window_2_21 = wt_client2()->NewWindow(21);
ASSERT_TRUE(window_2_11);
ASSERT_TRUE(window_2_2);
ASSERT_TRUE(window_2_21);
// Set up the hierarchy.
- ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_1));
- ASSERT_TRUE(ws_client2()->AddWindow(window_1_1, window_2_11));
- ASSERT_TRUE(ws_client2()->AddWindow(window_2_2, window_2_21));
+ ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
+ ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_11));
+ ASSERT_TRUE(wt_client2()->AddWindow(window_2_2, window_2_21));
// Remove 11, should result in a hierarchy change for the root.
{
changes1()->clear();
- ASSERT_TRUE(ws_client2()->RemoveWindowFromParent(window_2_11));
+ ASSERT_TRUE(wt_client2()->RemoveWindowFromParent(window_2_11));
- ws_client1_->WaitForChangeCount(1);
+ wt_client1_->WaitForChangeCount(1);
// 2,1 should be IdToString(window_2_11), but window_2_11 is in the id
// space of client2, not client1.
EXPECT_EQ("HierarchyChanged window=2,1 new_parent=null old_parent=" +
@@ -956,8 +956,8 @@ TEST_F(WindowTreeAppTest, WindowHierarchyChangedAddingKnownToUnknown) {
// Add 2 to 1.
{
changes1()->clear();
- ASSERT_TRUE(ws_client2()->AddWindow(window_1_1, window_2_2));
- ws_client1_->WaitForChangeCount(1);
+ ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_2));
+ wt_client1_->WaitForChangeCount(1);
EXPECT_EQ("HierarchyChanged window=" + IdToString(window_2_2) +
" new_parent=" + IdToString(window_1_1) + " old_parent=null",
SingleChangeToDescription(*changes1()));
@@ -973,14 +973,14 @@ TEST_F(WindowTreeAppTest, WindowHierarchyChangedAddingKnownToUnknown) {
TEST_F(WindowTreeAppTest, ReorderWindow) {
ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
- Id window_2_1 = ws_client2()->NewWindow(1);
- Id window_2_2 = ws_client2()->NewWindow(2);
- Id window_2_3 = ws_client2()->NewWindow(3);
- Id window_1_4 = ws_client1()->NewWindow(4); // Peer to 1,1
- Id window_1_5 = ws_client1()->NewWindow(5); // Peer to 1,1
- Id window_2_6 = ws_client2()->NewWindow(6); // Child of 1,2.
- Id window_2_7 = ws_client2()->NewWindow(7); // Unparented.
- Id window_2_8 = ws_client2()->NewWindow(8); // Unparented.
+ Id window_2_1 = wt_client2()->NewWindow(1);
+ Id window_2_2 = wt_client2()->NewWindow(2);
+ Id window_2_3 = wt_client2()->NewWindow(3);
+ Id window_1_4 = wt_client1()->NewWindow(4); // Peer to 1,1
+ Id window_1_5 = wt_client1()->NewWindow(5); // Peer to 1,1
+ Id window_2_6 = wt_client2()->NewWindow(6); // Child of 1,2.
+ Id window_2_7 = wt_client2()->NewWindow(7); // Unparented.
+ Id window_2_8 = wt_client2()->NewWindow(8); // Unparented.
ASSERT_TRUE(window_2_1);
ASSERT_TRUE(window_2_2);
ASSERT_TRUE(window_2_3);
@@ -990,20 +990,20 @@ TEST_F(WindowTreeAppTest, ReorderWindow) {
ASSERT_TRUE(window_2_7);
ASSERT_TRUE(window_2_8);
- ASSERT_TRUE(ws_client2()->AddWindow(window_2_1, window_2_2));
- ASSERT_TRUE(ws_client2()->AddWindow(window_2_2, window_2_6));
- ASSERT_TRUE(ws_client2()->AddWindow(window_2_1, window_2_3));
- ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_4));
- ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_5));
+ ASSERT_TRUE(wt_client2()->AddWindow(window_2_1, window_2_2));
+ ASSERT_TRUE(wt_client2()->AddWindow(window_2_2, window_2_6));
+ ASSERT_TRUE(wt_client2()->AddWindow(window_2_1, window_2_3));
+ ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_4));
+ ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_5));
ASSERT_TRUE(
- ws_client2()->AddWindow(BuildWindowId(connection_id_1(), 1), window_2_1));
+ wt_client2()->AddWindow(BuildWindowId(connection_id_1(), 1), window_2_1));
{
changes1()->clear();
- ASSERT_TRUE(ws_client2()->ReorderWindow(window_2_2, window_2_3,
+ ASSERT_TRUE(wt_client2()->ReorderWindow(window_2_2, window_2_3,
mojom::OrderDirection::ABOVE));
- ws_client1_->WaitForChangeCount(1);
+ wt_client1_->WaitForChangeCount(1);
EXPECT_EQ("Reordered window=" + IdToString(window_2_2) + " relative=" +
IdToString(window_2_3) + " direction=above",
SingleChangeToDescription(*changes1()));
@@ -1011,34 +1011,34 @@ TEST_F(WindowTreeAppTest, ReorderWindow) {
{
changes1()->clear();
- ASSERT_TRUE(ws_client2()->ReorderWindow(window_2_2, window_2_3,
+ ASSERT_TRUE(wt_client2()->ReorderWindow(window_2_2, window_2_3,
mojom::OrderDirection::BELOW));
- ws_client1_->WaitForChangeCount(1);
+ wt_client1_->WaitForChangeCount(1);
EXPECT_EQ("Reordered window=" + IdToString(window_2_2) + " relative=" +
IdToString(window_2_3) + " direction=below",
SingleChangeToDescription(*changes1()));
}
// view2 is already below view3.
- EXPECT_FALSE(ws_client2()->ReorderWindow(window_2_2, window_2_3,
+ EXPECT_FALSE(wt_client2()->ReorderWindow(window_2_2, window_2_3,
mojom::OrderDirection::BELOW));
// view4 & 5 are unknown to connection2_.
- EXPECT_FALSE(ws_client2()->ReorderWindow(window_1_4, window_1_5,
+ EXPECT_FALSE(wt_client2()->ReorderWindow(window_1_4, window_1_5,
mojom::OrderDirection::ABOVE));
// view6 & view3 have different parents.
- EXPECT_FALSE(ws_client1()->ReorderWindow(window_2_3, window_2_6,
+ EXPECT_FALSE(wt_client1()->ReorderWindow(window_2_3, window_2_6,
mojom::OrderDirection::ABOVE));
// Non-existent window-ids
- EXPECT_FALSE(ws_client1()->ReorderWindow(BuildWindowId(connection_id_1(), 27),
+ EXPECT_FALSE(wt_client1()->ReorderWindow(BuildWindowId(connection_id_1(), 27),
BuildWindowId(connection_id_1(), 28),
mojom::OrderDirection::ABOVE));
// view7 & view8 are un-parented.
- EXPECT_FALSE(ws_client1()->ReorderWindow(window_2_7, window_2_8,
+ EXPECT_FALSE(wt_client1()->ReorderWindow(window_2_7, window_2_8,
mojom::OrderDirection::ABOVE));
}
@@ -1046,14 +1046,14 @@ TEST_F(WindowTreeAppTest, ReorderWindow) {
TEST_F(WindowTreeAppTest, DeleteWindow) {
ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
Id window_1_1 = BuildWindowId(connection_id_1(), 1);
- Id window_2_1 = ws_client2()->NewWindow(1);
+ Id window_2_1 = wt_client2()->NewWindow(1);
ASSERT_TRUE(window_2_1);
// Make 2 a child of 1.
{
changes1()->clear();
- ASSERT_TRUE(ws_client2()->AddWindow(window_1_1, window_2_1));
- ws_client1_->WaitForChangeCount(1);
+ ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_1));
+ wt_client1_->WaitForChangeCount(1);
EXPECT_EQ("HierarchyChanged window=" + IdToString(window_2_1) +
" new_parent=" + IdToString(window_1_1) + " old_parent=null",
SingleChangeToDescription(*changes1()));
@@ -1063,10 +1063,10 @@ TEST_F(WindowTreeAppTest, DeleteWindow) {
{
changes1()->clear();
changes2()->clear();
- ASSERT_TRUE(ws_client2()->DeleteWindow(window_2_1));
+ ASSERT_TRUE(wt_client2()->DeleteWindow(window_2_1));
EXPECT_TRUE(changes2()->empty());
- ws_client1_->WaitForChangeCount(1);
+ wt_client1_->WaitForChangeCount(1);
EXPECT_EQ("WindowDeleted window=" + IdToString(window_2_1),
SingleChangeToDescription(*changes1()));
}
@@ -1075,7 +1075,7 @@ TEST_F(WindowTreeAppTest, DeleteWindow) {
// Verifies DeleteWindow isn't allowed from a separate connection.
TEST_F(WindowTreeAppTest, DeleteWindowFromAnotherConnectionDisallowed) {
ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
- EXPECT_FALSE(ws_client2()->DeleteWindow(BuildWindowId(connection_id_1(), 1)));
+ EXPECT_FALSE(wt_client2()->DeleteWindow(BuildWindowId(connection_id_1(), 1)));
}
// Verifies if a window was deleted and then reused that other clients are
@@ -1083,14 +1083,14 @@ TEST_F(WindowTreeAppTest, DeleteWindowFromAnotherConnectionDisallowed) {
TEST_F(WindowTreeAppTest, ReuseDeletedWindowId) {
ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
Id window_1_1 = BuildWindowId(connection_id_1(), 1);
- Id window_2_1 = ws_client2()->NewWindow(1);
+ Id window_2_1 = wt_client2()->NewWindow(1);
ASSERT_TRUE(window_2_1);
// Add 2 to 1.
{
changes1()->clear();
- ASSERT_TRUE(ws_client2()->AddWindow(window_1_1, window_2_1));
- ws_client1_->WaitForChangeCount(1);
+ ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_1));
+ wt_client1_->WaitForChangeCount(1);
EXPECT_EQ("HierarchyChanged window=" + IdToString(window_2_1) +
" new_parent=" + IdToString(window_1_1) + " old_parent=null",
SingleChangeToDescription(*changes1()));
@@ -1101,21 +1101,21 @@ TEST_F(WindowTreeAppTest, ReuseDeletedWindowId) {
// Delete 2.
{
changes1()->clear();
- ASSERT_TRUE(ws_client2()->DeleteWindow(window_2_1));
+ ASSERT_TRUE(wt_client2()->DeleteWindow(window_2_1));
- ws_client1_->WaitForChangeCount(1);
+ wt_client1_->WaitForChangeCount(1);
EXPECT_EQ("WindowDeleted window=" + IdToString(window_2_1),
SingleChangeToDescription(*changes1()));
}
// Create 2 again, and add it back to 1. Should get the same notification.
- window_2_1 = ws_client2()->NewWindow(2);
+ window_2_1 = wt_client2()->NewWindow(2);
ASSERT_TRUE(window_2_1);
{
changes1()->clear();
- ASSERT_TRUE(ws_client2()->AddWindow(window_1_1, window_2_1));
+ ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_1));
- ws_client1_->WaitForChangeCount(1);
+ wt_client1_->WaitForChangeCount(1);
EXPECT_EQ("HierarchyChanged window=" + IdToString(window_2_1) +
" new_parent=" + IdToString(window_1_1) + " old_parent=null",
SingleChangeToDescription(*changes1()));
@@ -1130,23 +1130,23 @@ TEST_F(WindowTreeAppTest, GetWindowTree) {
Id window_1_1 = BuildWindowId(connection_id_1(), 1);
// Create 11 in first connection and make it a child of 1.
- Id window_1_11 = ws_client1()->NewWindow(11);
+ Id window_1_11 = wt_client1()->NewWindow(11);
ASSERT_TRUE(window_1_11);
- ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_1));
- ASSERT_TRUE(ws_client1()->AddWindow(window_1_1, window_1_11));
+ ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
+ ASSERT_TRUE(wt_client1()->AddWindow(window_1_1, window_1_11));
// Create two windows in second connection, 2 and 3, both children of 1.
- Id window_2_1 = ws_client2()->NewWindow(1);
- Id window_2_2 = ws_client2()->NewWindow(2);
+ Id window_2_1 = wt_client2()->NewWindow(1);
+ Id window_2_2 = wt_client2()->NewWindow(2);
ASSERT_TRUE(window_2_1);
ASSERT_TRUE(window_2_2);
- ASSERT_TRUE(ws_client2()->AddWindow(window_1_1, window_2_1));
- ASSERT_TRUE(ws_client2()->AddWindow(window_1_1, window_2_2));
+ ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_1));
+ ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_2));
// Verifies GetWindowTree() on the root. The root connection sees all.
{
std::vector<TestWindow> windows;
- GetWindowTree(ws1(), root_window_id(), &windows);
+ GetWindowTree(wt1(), root_window_id(), &windows);
ASSERT_EQ(5u, windows.size());
EXPECT_EQ(WindowParentToString(root_window_id(), kNullParentId),
windows[0].ToString());
@@ -1160,12 +1160,12 @@ TEST_F(WindowTreeAppTest, GetWindowTree) {
windows[4].ToString());
}
- // Verifies GetWindowTree() on the window 1,1 from ws2(). ws2() sees 1,1 as
+ // Verifies GetWindowTree() on the window 1,1 from wt2(). wt2() sees 1,1 as
// 1,1
- // is ws2()'s root and ws2() sees all the windows it created.
+ // is wt2()'s root and wt2() sees all the windows it created.
{
std::vector<TestWindow> windows;
- GetWindowTree(ws2(), window_1_1, &windows);
+ GetWindowTree(wt2(), window_1_1, &windows);
ASSERT_EQ(3u, windows.size());
EXPECT_EQ(WindowParentToString(window_1_1, kNullParentId),
windows[0].ToString());
@@ -1178,43 +1178,43 @@ TEST_F(WindowTreeAppTest, GetWindowTree) {
// Connection 2 shouldn't be able to get the root tree.
{
std::vector<TestWindow> windows;
- GetWindowTree(ws2(), root_window_id(), &windows);
+ GetWindowTree(wt2(), root_window_id(), &windows);
ASSERT_EQ(0u, windows.size());
}
}
TEST_F(WindowTreeAppTest, SetWindowBounds) {
- Id window_1_1 = ws_client1()->NewWindow(1);
+ Id window_1_1 = wt_client1()->NewWindow(1);
ASSERT_TRUE(window_1_1);
- ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_1));
+ ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false));
changes2()->clear();
- ws_client2_->set_track_root_bounds_changes(true);
+ wt_client2_->set_track_root_bounds_changes(true);
- ws1()->SetWindowBounds(10, window_1_1,
+ wt1()->SetWindowBounds(10, window_1_1,
mojo::Rect::From(gfx::Rect(0, 0, 100, 100)));
- ASSERT_TRUE(ws_client1()->WaitForChangeCompleted(10));
+ ASSERT_TRUE(wt_client1()->WaitForChangeCompleted(10));
- ws_client2_->WaitForChangeCount(1);
+ wt_client2_->WaitForChangeCount(1);
EXPECT_EQ("BoundsChanged window=" + IdToString(window_1_1) +
" old_bounds=0,0 0x0 new_bounds=0,0 100x100",
SingleChangeToDescription(*changes2()));
// Should not be possible to change the bounds of a window created by another
// connection.
- ws2()->SetWindowBounds(11, window_1_1,
+ wt2()->SetWindowBounds(11, window_1_1,
mojo::Rect::From(gfx::Rect(0, 0, 0, 0)));
- ASSERT_FALSE(ws_client2()->WaitForChangeCompleted(11));
+ ASSERT_FALSE(wt_client2()->WaitForChangeCompleted(11));
}
// Verify AddWindow fails when trying to manipulate windows in other roots.
TEST_F(WindowTreeAppTest, CantMoveWindowsFromOtherRoot) {
// Create 1 and 2 in the first connection.
- Id window_1_1 = ws_client1()->NewWindow(1);
- Id window_1_2 = ws_client1()->NewWindow(2);
+ Id window_1_1 = wt_client1()->NewWindow(1);
+ Id window_1_2 = wt_client1()->NewWindow(2);
ASSERT_TRUE(window_1_1);
ASSERT_TRUE(window_1_2);
@@ -1222,47 +1222,47 @@ TEST_F(WindowTreeAppTest, CantMoveWindowsFromOtherRoot) {
// Try to move 2 to be a child of 1 from connection 2. This should fail as 2
// should not be able to access 1.
- ASSERT_FALSE(ws_client2()->AddWindow(window_1_1, window_1_2));
+ ASSERT_FALSE(wt_client2()->AddWindow(window_1_1, window_1_2));
// Try to reparent 1 to the root. A connection is not allowed to reparent its
// roots.
- ASSERT_FALSE(ws_client2()->AddWindow(root_window_id(), window_1_1));
+ ASSERT_FALSE(wt_client2()->AddWindow(root_window_id(), window_1_1));
}
// Verify RemoveWindowFromParent fails for windows that are descendants of the
// roots.
TEST_F(WindowTreeAppTest, CantRemoveWindowsInOtherRoots) {
// Create 1 and 2 in the first connection and parent both to the root.
- Id window_1_1 = ws_client1()->NewWindow(1);
- Id window_1_2 = ws_client1()->NewWindow(2);
+ Id window_1_1 = wt_client1()->NewWindow(1);
+ Id window_1_2 = wt_client1()->NewWindow(2);
ASSERT_TRUE(window_1_1);
ASSERT_TRUE(window_1_2);
- ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_1));
- ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_2));
+ ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
+ ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_2));
// Establish the second connection and give it the root 1.
ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false));
// Connection 2 should not be able to remove window 2 or 1 from its parent.
- ASSERT_FALSE(ws_client2()->RemoveWindowFromParent(window_1_2));
- ASSERT_FALSE(ws_client2()->RemoveWindowFromParent(window_1_1));
+ ASSERT_FALSE(wt_client2()->RemoveWindowFromParent(window_1_2));
+ ASSERT_FALSE(wt_client2()->RemoveWindowFromParent(window_1_1));
// Create windows 10 and 11 in 2.
- Id window_2_10 = ws_client2()->NewWindow(10);
- Id window_2_11 = ws_client2()->NewWindow(11);
+ Id window_2_10 = wt_client2()->NewWindow(10);
+ Id window_2_11 = wt_client2()->NewWindow(11);
ASSERT_TRUE(window_2_10);
ASSERT_TRUE(window_2_11);
// Parent 11 to 10.
- ASSERT_TRUE(ws_client2()->AddWindow(window_2_10, window_2_11));
+ ASSERT_TRUE(wt_client2()->AddWindow(window_2_10, window_2_11));
// Remove 11 from 10.
- ASSERT_TRUE(ws_client2()->RemoveWindowFromParent(window_2_11));
+ ASSERT_TRUE(wt_client2()->RemoveWindowFromParent(window_2_11));
// Verify nothing was actually removed.
{
std::vector<TestWindow> windows;
- GetWindowTree(ws1(), root_window_id(), &windows);
+ GetWindowTree(wt1(), root_window_id(), &windows);
ASSERT_EQ(3u, windows.size());
EXPECT_EQ(WindowParentToString(root_window_id(), kNullParentId),
windows[0].ToString());
@@ -1276,28 +1276,28 @@ TEST_F(WindowTreeAppTest, CantRemoveWindowsInOtherRoots) {
// Verify GetWindowTree fails for windows that are not descendants of the roots.
TEST_F(WindowTreeAppTest, CantGetWindowTreeOfOtherRoots) {
// Create 1 and 2 in the first connection and parent both to the root.
- Id window_1_1 = ws_client1()->NewWindow(1);
- Id window_1_2 = ws_client1()->NewWindow(2);
+ Id window_1_1 = wt_client1()->NewWindow(1);
+ Id window_1_2 = wt_client1()->NewWindow(2);
ASSERT_TRUE(window_1_1);
ASSERT_TRUE(window_1_2);
- ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_1));
- ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_2));
+ ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
+ ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_2));
ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false));
std::vector<TestWindow> windows;
// Should get nothing for the root.
- GetWindowTree(ws2(), root_window_id(), &windows);
+ GetWindowTree(wt2(), root_window_id(), &windows);
ASSERT_TRUE(windows.empty());
// Should get nothing for window 2.
- GetWindowTree(ws2(), window_1_2, &windows);
+ GetWindowTree(wt2(), window_1_2, &windows);
ASSERT_TRUE(windows.empty());
// Should get window 1 if asked for.
- GetWindowTree(ws2(), window_1_1, &windows);
+ GetWindowTree(wt2(), window_1_1, &windows);
ASSERT_EQ(1u, windows.size());
EXPECT_EQ(WindowParentToString(window_1_1, kNullParentId),
windows[0].ToString());
@@ -1308,11 +1308,11 @@ TEST_F(WindowTreeAppTest, EmbedWithSameWindowId) {
changes2()->clear();
Id window_1_1 = BuildWindowId(connection_id_1(), 1);
- ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(ws1(), window_1_1));
+ ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(wt1(), window_1_1));
// Connection2 should have been told of the unembed and delete.
{
- ws_client2_->WaitForChangeCount(2);
+ wt_client2_->WaitForChangeCount(2);
EXPECT_EQ("OnUnembed window=" + IdToString(window_1_1),
ChangesToDescription1(*changes2())[0]);
EXPECT_EQ("WindowDeleted window=" + IdToString(window_1_1),
@@ -1322,7 +1322,7 @@ TEST_F(WindowTreeAppTest, EmbedWithSameWindowId) {
// Connection2 has no root. Verify it can't see window 1,1 anymore.
{
std::vector<TestWindow> windows;
- GetWindowTree(ws2(), window_1_1, &windows);
+ GetWindowTree(wt2(), window_1_1, &windows);
EXPECT_TRUE(windows.empty());
}
}
@@ -1332,20 +1332,20 @@ TEST_F(WindowTreeAppTest, EmbedWithSameWindowId2) {
Id window_1_1 = BuildWindowId(connection_id_1(), 1);
changes2()->clear();
- ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(ws1(), window_1_1));
+ ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(wt1(), window_1_1));
// Connection2 should have been told about the unembed and delete.
- ws_client2_->WaitForChangeCount(2);
+ wt_client2_->WaitForChangeCount(2);
changes2()->clear();
// Create a window in the third connection and parent it to the root.
- Id window_3_1 = ws_client3()->NewWindow(1);
+ Id window_3_1 = wt_client3()->NewWindow(1);
ASSERT_TRUE(window_3_1);
- ASSERT_TRUE(ws_client3()->AddWindow(window_1_1, window_3_1));
+ ASSERT_TRUE(wt_client3()->AddWindow(window_1_1, window_3_1));
// Connection 1 should have been told about the add (it owns the window).
{
- ws_client1_->WaitForChangeCount(1);
+ wt_client1_->WaitForChangeCount(1);
EXPECT_EQ("HierarchyChanged window=" + IdToString(window_3_1) +
" new_parent=" + IdToString(window_1_1) + " old_parent=null",
SingleChangeToDescription(*changes1()));
@@ -1357,40 +1357,40 @@ TEST_F(WindowTreeAppTest, EmbedWithSameWindowId2) {
// We should get a new connection for the new embedding.
scoped_ptr<TestWindowTreeClientImpl> connection4(
- EstablishConnectionViaEmbed(ws1(), window_1_1, nullptr));
+ EstablishConnectionViaEmbed(wt1(), window_1_1, nullptr));
ASSERT_TRUE(connection4.get());
EXPECT_EQ("[" + WindowParentToString(window_1_1, kNullParentId) + "]",
ChangeWindowDescription(*connection4->tracker()->changes()));
// And 3 should get an unembed and delete.
- ws_client3_->WaitForChangeCount(2);
+ wt_client3_->WaitForChangeCount(2);
EXPECT_EQ("OnUnembed window=" + IdToString(window_1_1),
ChangesToDescription1(*changes3())[0]);
EXPECT_EQ("WindowDeleted window=" + IdToString(window_1_1),
ChangesToDescription1(*changes3())[1]);
}
- // ws3() has no root. Verify it can't see window 1,1 anymore.
+ // wt3() has no root. Verify it can't see window 1,1 anymore.
{
std::vector<TestWindow> windows;
- GetWindowTree(ws3(), window_1_1, &windows);
+ GetWindowTree(wt3(), window_1_1, &windows);
EXPECT_TRUE(windows.empty());
}
// Verify 3,1 is no longer parented to 1,1. We have to do this from 1,1 as
- // ws3() can no longer see 1,1.
+ // wt3() can no longer see 1,1.
{
std::vector<TestWindow> windows;
- GetWindowTree(ws1(), window_1_1, &windows);
+ GetWindowTree(wt1(), window_1_1, &windows);
ASSERT_EQ(1u, windows.size());
EXPECT_EQ(WindowParentToString(window_1_1, kNullParentId),
windows[0].ToString());
}
- // Verify ws3() can still see the window it created 3,1.
+ // Verify wt3() can still see the window it created 3,1.
{
std::vector<TestWindow> windows;
- GetWindowTree(ws3(), window_3_1, &windows);
+ GetWindowTree(wt3(), window_3_1, &windows);
ASSERT_EQ(1u, windows.size());
EXPECT_EQ(WindowParentToString(window_3_1, kNullParentId),
windows[0].ToString());
@@ -1400,15 +1400,15 @@ TEST_F(WindowTreeAppTest, EmbedWithSameWindowId2) {
// Assertions for SetWindowVisibility.
TEST_F(WindowTreeAppTest, SetWindowVisibility) {
// Create 1 and 2 in the first connection and parent both to the root.
- Id window_1_1 = ws_client1()->NewWindow(1);
- Id window_1_2 = ws_client1()->NewWindow(2);
+ Id window_1_1 = wt_client1()->NewWindow(1);
+ Id window_1_2 = wt_client1()->NewWindow(2);
ASSERT_TRUE(window_1_1);
ASSERT_TRUE(window_1_2);
- ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_1));
+ ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
{
std::vector<TestWindow> windows;
- GetWindowTree(ws1(), root_window_id(), &windows);
+ GetWindowTree(wt1(), root_window_id(), &windows);
ASSERT_EQ(2u, windows.size());
EXPECT_EQ(WindowParentToString(root_window_id(), kNullParentId) +
" visible=true drawn=true",
@@ -1419,11 +1419,11 @@ TEST_F(WindowTreeAppTest, SetWindowVisibility) {
}
// Show all the windows.
- ASSERT_TRUE(ws_client1()->SetWindowVisibility(window_1_1, true));
- ASSERT_TRUE(ws_client1()->SetWindowVisibility(window_1_2, true));
+ ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_1, true));
+ ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_2, true));
{
std::vector<TestWindow> windows;
- GetWindowTree(ws1(), root_window_id(), &windows);
+ GetWindowTree(wt1(), root_window_id(), &windows);
ASSERT_EQ(2u, windows.size());
EXPECT_EQ(WindowParentToString(root_window_id(), kNullParentId) +
" visible=true drawn=true",
@@ -1434,10 +1434,10 @@ TEST_F(WindowTreeAppTest, SetWindowVisibility) {
}
// Hide 1.
- ASSERT_TRUE(ws_client1()->SetWindowVisibility(window_1_1, false));
+ ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_1, false));
{
std::vector<TestWindow> windows;
- GetWindowTree(ws1(), window_1_1, &windows);
+ GetWindowTree(wt1(), window_1_1, &windows);
ASSERT_EQ(1u, windows.size());
EXPECT_EQ(WindowParentToString(window_1_1, root_window_id()) +
" visible=false drawn=false",
@@ -1445,10 +1445,10 @@ TEST_F(WindowTreeAppTest, SetWindowVisibility) {
}
// Attach 2 to 1.
- ASSERT_TRUE(ws_client1()->AddWindow(window_1_1, window_1_2));
+ ASSERT_TRUE(wt_client1()->AddWindow(window_1_1, window_1_2));
{
std::vector<TestWindow> windows;
- GetWindowTree(ws1(), window_1_1, &windows);
+ GetWindowTree(wt1(), window_1_1, &windows);
ASSERT_EQ(2u, windows.size());
EXPECT_EQ(WindowParentToString(window_1_1, root_window_id()) +
" visible=false drawn=false",
@@ -1459,10 +1459,10 @@ TEST_F(WindowTreeAppTest, SetWindowVisibility) {
}
// Show 1.
- ASSERT_TRUE(ws_client1()->SetWindowVisibility(window_1_1, true));
+ ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_1, true));
{
std::vector<TestWindow> windows;
- GetWindowTree(ws1(), window_1_1, &windows);
+ GetWindowTree(wt1(), window_1_1, &windows);
ASSERT_EQ(2u, windows.size());
EXPECT_EQ(WindowParentToString(window_1_1, root_window_id()) +
" visible=true drawn=true",
@@ -1481,8 +1481,8 @@ TEST_F(WindowTreeAppTest, SetCursor) {
changes2()->clear();
ASSERT_TRUE(
- ws_client1()->SetPredefinedCursor(window_1_1, mojom::Cursor::IBEAM));
- ws_client2_->WaitForChangeCount(1u);
+ wt_client1()->SetPredefinedCursor(window_1_1, mojom::Cursor::IBEAM));
+ wt_client2_->WaitForChangeCount(1u);
EXPECT_EQ("CursorChanged id=" + IdToString(window_1_1) + " cursor_id=4",
SingleChangeToDescription(*changes2()));
@@ -1491,30 +1491,30 @@ TEST_F(WindowTreeAppTest, SetCursor) {
// Assertions for SetWindowVisibility sending notifications.
TEST_F(WindowTreeAppTest, SetWindowVisibilityNotifications) {
// Create 1,1 and 1,2. 1,2 is made a child of 1,1 and 1,1 a child of the root.
- Id window_1_1 = ws_client1()->NewWindow(1);
+ Id window_1_1 = wt_client1()->NewWindow(1);
ASSERT_TRUE(window_1_1);
- ASSERT_TRUE(ws_client1()->SetWindowVisibility(window_1_1, true));
- Id window_1_2 = ws_client1()->NewWindow(2);
+ ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_1, true));
+ Id window_1_2 = wt_client1()->NewWindow(2);
ASSERT_TRUE(window_1_2);
- ASSERT_TRUE(ws_client1()->SetWindowVisibility(window_1_2, true));
- ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_1));
- ASSERT_TRUE(ws_client1()->AddWindow(window_1_1, window_1_2));
+ ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_2, true));
+ ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
+ ASSERT_TRUE(wt_client1()->AddWindow(window_1_1, window_1_2));
// Establish the second connection at 1,2.
ASSERT_NO_FATAL_FAILURE(EstablishSecondConnectionWithRoot(window_1_2));
// Add 2,3 as a child of 1,2.
- Id window_2_1 = ws_client2()->NewWindow(1);
+ Id window_2_1 = wt_client2()->NewWindow(1);
ASSERT_TRUE(window_2_1);
- ASSERT_TRUE(ws_client2()->SetWindowVisibility(window_2_1, true));
- ASSERT_TRUE(ws_client2()->AddWindow(window_1_2, window_2_1));
- ASSERT_TRUE(ws_client1()->WaitForAllMessages());
+ ASSERT_TRUE(wt_client2()->SetWindowVisibility(window_2_1, true));
+ ASSERT_TRUE(wt_client2()->AddWindow(window_1_2, window_2_1));
+ ASSERT_TRUE(wt_client1()->WaitForAllMessages());
changes2()->clear();
// Hide 1,2 from connection 1. Connection 2 should see this.
- ASSERT_TRUE(ws_client1()->SetWindowVisibility(window_1_2, false));
+ ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_2, false));
{
- ws_client2_->WaitForChangeCount(1);
+ wt_client2_->WaitForChangeCount(1);
EXPECT_EQ(
"VisibilityChanged window=" + IdToString(window_1_2) + " visible=false",
SingleChangeToDescription(*changes2()));
@@ -1522,9 +1522,9 @@ TEST_F(WindowTreeAppTest, SetWindowVisibilityNotifications) {
changes1()->clear();
// Show 1,2 from connection 2, connection 1 should be notified.
- ASSERT_TRUE(ws_client2()->SetWindowVisibility(window_1_2, true));
+ ASSERT_TRUE(wt_client2()->SetWindowVisibility(window_1_2, true));
{
- ws_client1_->WaitForChangeCount(1);
+ wt_client1_->WaitForChangeCount(1);
EXPECT_EQ(
"VisibilityChanged window=" + IdToString(window_1_2) + " visible=true",
SingleChangeToDescription(*changes1()));
@@ -1532,9 +1532,9 @@ TEST_F(WindowTreeAppTest, SetWindowVisibilityNotifications) {
changes2()->clear();
// Hide 1,1, connection 2 should be told the draw state changed.
- ASSERT_TRUE(ws_client1()->SetWindowVisibility(window_1_1, false));
+ ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_1, false));
{
- ws_client2_->WaitForChangeCount(1);
+ wt_client2_->WaitForChangeCount(1);
EXPECT_EQ(
"DrawnStateChanged window=" + IdToString(window_1_2) + " drawn=false",
SingleChangeToDescription(*changes2()));
@@ -1542,9 +1542,9 @@ TEST_F(WindowTreeAppTest, SetWindowVisibilityNotifications) {
changes2()->clear();
// Show 1,1 from connection 1. Connection 2 should see this.
- ASSERT_TRUE(ws_client1()->SetWindowVisibility(window_1_1, true));
+ ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_1, true));
{
- ws_client2_->WaitForChangeCount(1);
+ wt_client2_->WaitForChangeCount(1);
EXPECT_EQ(
"DrawnStateChanged window=" + IdToString(window_1_2) + " drawn=true",
SingleChangeToDescription(*changes2()));
@@ -1552,9 +1552,9 @@ TEST_F(WindowTreeAppTest, SetWindowVisibilityNotifications) {
// Change visibility of 2,3, connection 1 should see this.
changes1()->clear();
- ASSERT_TRUE(ws_client2()->SetWindowVisibility(window_2_1, false));
+ ASSERT_TRUE(wt_client2()->SetWindowVisibility(window_2_1, false));
{
- ws_client1_->WaitForChangeCount(1);
+ wt_client1_->WaitForChangeCount(1);
EXPECT_EQ(
"VisibilityChanged window=" + IdToString(window_2_1) + " visible=false",
SingleChangeToDescription(*changes1()));
@@ -1562,9 +1562,9 @@ TEST_F(WindowTreeAppTest, SetWindowVisibilityNotifications) {
changes2()->clear();
// Remove 1,1 from the root, connection 2 should see drawn state changed.
- ASSERT_TRUE(ws_client1()->RemoveWindowFromParent(window_1_1));
+ ASSERT_TRUE(wt_client1()->RemoveWindowFromParent(window_1_1));
{
- ws_client2_->WaitForChangeCount(1);
+ wt_client2_->WaitForChangeCount(1);
EXPECT_EQ(
"DrawnStateChanged window=" + IdToString(window_1_2) + " drawn=false",
SingleChangeToDescription(*changes2()));
@@ -1572,9 +1572,9 @@ TEST_F(WindowTreeAppTest, SetWindowVisibilityNotifications) {
changes2()->clear();
// Add 1,1 back to the root, connection 2 should see drawn state changed.
- ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_1));
+ ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
{
- ws_client2_->WaitForChangeCount(1);
+ wt_client2_->WaitForChangeCount(1);
EXPECT_EQ(
"DrawnStateChanged window=" + IdToString(window_1_2) + " drawn=true",
SingleChangeToDescription(*changes2()));
@@ -1582,16 +1582,16 @@ TEST_F(WindowTreeAppTest, SetWindowVisibilityNotifications) {
}
TEST_F(WindowTreeAppTest, SetWindowProperty) {
- Id window_1_1 = ws_client1()->NewWindow(1);
+ Id window_1_1 = wt_client1()->NewWindow(1);
ASSERT_TRUE(window_1_1);
ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false));
changes2()->clear();
- ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_1));
+ ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
{
std::vector<TestWindow> windows;
- GetWindowTree(ws1(), root_window_id(), &windows);
+ GetWindowTree(wt1(), root_window_id(), &windows);
ASSERT_EQ(2u, windows.size());
EXPECT_EQ(root_window_id(), windows[0].window_id);
EXPECT_EQ(window_1_1, windows[1].window_id);
@@ -1601,9 +1601,9 @@ TEST_F(WindowTreeAppTest, SetWindowProperty) {
// Set properties on 1.
changes2()->clear();
std::vector<uint8_t> one(1, '1');
- ASSERT_TRUE(ws_client1()->SetWindowProperty(window_1_1, "one", &one));
+ ASSERT_TRUE(wt_client1()->SetWindowProperty(window_1_1, "one", &one));
{
- ws_client2_->WaitForChangeCount(1);
+ wt_client2_->WaitForChangeCount(1);
EXPECT_EQ(
"PropertyChanged window=" + IdToString(window_1_1) + " key=one value=1",
SingleChangeToDescription(*changes2()));
@@ -1612,7 +1612,7 @@ TEST_F(WindowTreeAppTest, SetWindowProperty) {
// Test that our properties exist in the window tree
{
std::vector<TestWindow> windows;
- GetWindowTree(ws1(), window_1_1, &windows);
+ GetWindowTree(wt1(), window_1_1, &windows);
ASSERT_EQ(1u, windows.size());
ASSERT_EQ(1u, windows[0].properties.size());
EXPECT_EQ(one, windows[0].properties["one"]);
@@ -1620,9 +1620,9 @@ TEST_F(WindowTreeAppTest, SetWindowProperty) {
changes2()->clear();
// Set back to null.
- ASSERT_TRUE(ws_client1()->SetWindowProperty(window_1_1, "one", NULL));
+ ASSERT_TRUE(wt_client1()->SetWindowProperty(window_1_1, "one", NULL));
{
- ws_client2_->WaitForChangeCount(1);
+ wt_client2_->WaitForChangeCount(1);
EXPECT_EQ("PropertyChanged window=" + IdToString(window_1_1) +
" key=one value=NULL",
SingleChangeToDescription(*changes2()));
@@ -1633,24 +1633,24 @@ TEST_F(WindowTreeAppTest, OnEmbeddedAppDisconnected) {
// Create connection 2 and 3.
ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
Id window_1_1 = BuildWindowId(connection_id_1(), 1);
- Id window_2_1 = ws_client2()->NewWindow(1);
+ Id window_2_1 = wt_client2()->NewWindow(1);
ASSERT_TRUE(window_2_1);
- ASSERT_TRUE(ws_client2()->AddWindow(window_1_1, window_2_1));
+ ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_1));
changes2()->clear();
- ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(ws2(), window_2_1));
+ ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(wt2(), window_2_1));
// Connection 1 should get a hierarchy change for window_2_1.
- ws_client1_->WaitForChangeCount(1);
+ wt_client1_->WaitForChangeCount(1);
changes1()->clear();
// Close connection 3. Connection 2 (which had previously embedded 3) should
// be notified of this.
- ws_client3_.reset();
- ws_client2_->WaitForChangeCount(1);
+ wt_client3_.reset();
+ wt_client2_->WaitForChangeCount(1);
EXPECT_EQ("OnEmbeddedAppDisconnected window=" + IdToString(window_2_1),
SingleChangeToDescription(*changes2()));
- ws_client1_->WaitForChangeCount(1);
+ wt_client1_->WaitForChangeCount(1);
EXPECT_EQ("OnEmbeddedAppDisconnected window=" + IdToString(window_2_1),
SingleChangeToDescription(*changes1()));
}
@@ -1661,20 +1661,20 @@ TEST_F(WindowTreeAppTest, OnParentOfEmbedDisconnects) {
// Create connection 2 and 3.
ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
Id window_1_1 = BuildWindowId(connection_id_1(), 1);
- ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_1));
- Id window_2_1 = ws_client2()->NewWindow(1);
- Id window_2_2 = ws_client2()->NewWindow(2);
+ ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
+ Id window_2_1 = wt_client2()->NewWindow(1);
+ Id window_2_2 = wt_client2()->NewWindow(2);
ASSERT_TRUE(window_2_1);
ASSERT_TRUE(window_2_2);
- ASSERT_TRUE(ws_client2()->AddWindow(window_1_1, window_2_1));
- ASSERT_TRUE(ws_client2()->AddWindow(window_2_1, window_2_2));
+ ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_1));
+ ASSERT_TRUE(wt_client2()->AddWindow(window_2_1, window_2_2));
changes2()->clear();
- ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(ws2(), window_2_2));
+ ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(wt2(), window_2_2));
changes3()->clear();
// Close connection 2. Connection 3 should get a delete (for its root).
- ws_client2_.reset();
- ws_client3_->WaitForChangeCount(1);
+ wt_client2_.reset();
+ wt_client3_->WaitForChangeCount(1);
EXPECT_EQ("WindowDeleted window=" + IdToString(window_2_2),
SingleChangeToDescription(*changes3()));
}
@@ -1684,25 +1684,25 @@ TEST_F(WindowTreeAppTest, OnParentOfEmbedDisconnects) {
TEST_F(WindowTreeAppTest, DontCleanMapOnDestroy) {
ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
Id window_1_1 = BuildWindowId(connection_id_1(), 1);
- ASSERT_TRUE(ws_client2()->NewWindow(1));
+ ASSERT_TRUE(wt_client2()->NewWindow(1));
changes1()->clear();
- ws_client2_.reset();
- ws_client1_->WaitForChangeCount(1);
+ wt_client2_.reset();
+ wt_client1_->WaitForChangeCount(1);
EXPECT_EQ("OnEmbeddedAppDisconnected window=" + IdToString(window_1_1),
SingleChangeToDescription(*changes1()));
std::vector<TestWindow> windows;
- GetWindowTree(ws1(), window_1_1, &windows);
+ GetWindowTree(wt1(), window_1_1, &windows);
EXPECT_FALSE(windows.empty());
}
// Verifies Embed() works when supplying a WindowTreeClient.
TEST_F(WindowTreeAppTest, EmbedSupplyingWindowTreeClient) {
- ASSERT_TRUE(ws_client1()->NewWindow(1));
+ ASSERT_TRUE(wt_client1()->NewWindow(1));
TestWindowTreeClientImpl client2;
mojom::WindowTreeClientPtr client2_ptr;
mojo::Binding<WindowTreeClient> client2_binding(&client2, &client2_ptr);
- ASSERT_TRUE(Embed(ws1(), BuildWindowId(connection_id_1(), 1),
+ ASSERT_TRUE(Embed(wt1(), BuildWindowId(connection_id_1(), 1),
std::move(client2_ptr)));
client2.WaitForOnEmbed();
EXPECT_EQ("OnEmbed",
@@ -1713,19 +1713,19 @@ TEST_F(WindowTreeAppTest, EmbedFailsFromOtherConnection) {
ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
Id window_1_1 = BuildWindowId(connection_id_1(), 1);
- Id window_2_1 = ws_client2()->NewWindow(1);
+ Id window_2_1 = wt_client2()->NewWindow(1);
ASSERT_TRUE(window_2_1);
- ASSERT_TRUE(ws_client2()->AddWindow(window_1_1, window_2_1));
- ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(ws2(), window_2_1));
+ ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_1));
+ ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(wt2(), window_2_1));
- Id window_3_3 = ws_client3()->NewWindow(3);
+ Id window_3_3 = wt_client3()->NewWindow(3);
ASSERT_TRUE(window_3_3);
- ASSERT_TRUE(ws_client3()->AddWindow(window_2_1, window_3_3));
+ ASSERT_TRUE(wt_client3()->AddWindow(window_2_1, window_3_3));
// 2 should not be able to embed in window_3_3 as window_3_3 was not created
// by
// 2.
- EXPECT_FALSE(EmbedUrl(connector(), ws2(), test_name(), window_3_3));
+ EXPECT_FALSE(EmbedUrl(connector(), wt2(), test_name(), window_3_3));
}
// Verifies Embed() from window manager on another connections window works.
@@ -1733,22 +1733,22 @@ TEST_F(WindowTreeAppTest, EmbedFromOtherConnection) {
ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
Id window_1_1 = BuildWindowId(connection_id_1(), 1);
- Id window_2_1 = ws_client2()->NewWindow(1);
+ Id window_2_1 = wt_client2()->NewWindow(1);
ASSERT_TRUE(window_2_1);
- ASSERT_TRUE(ws_client2()->AddWindow(window_1_1, window_2_1));
+ ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_1));
changes2()->clear();
// Establish a third connection in window_2_1.
- ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(ws1(), window_2_1));
+ ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(wt1(), window_2_1));
- ASSERT_TRUE(ws_client2()->WaitForAllMessages());
+ ASSERT_TRUE(wt_client2()->WaitForAllMessages());
EXPECT_EQ(std::string(), SingleChangeToDescription(*changes2()));
}
TEST_F(WindowTreeAppTest, CantEmbedFromConnectionRoot) {
// Shouldn't be able to embed into the root.
- ASSERT_FALSE(EmbedUrl(connector(), ws1(), test_name(), root_window_id()));
+ ASSERT_FALSE(EmbedUrl(connector(), wt1(), test_name(), root_window_id()));
// Even though the call above failed a WindowTreeClient was obtained. We need
// to
@@ -1757,24 +1757,24 @@ TEST_F(WindowTreeAppTest, CantEmbedFromConnectionRoot) {
// Don't allow a connection to embed into its own root.
ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
- EXPECT_FALSE(EmbedUrl(connector(), ws2(), test_name(),
+ EXPECT_FALSE(EmbedUrl(connector(), wt2(), test_name(),
BuildWindowId(connection_id_1(), 1)));
// Need to wait for a WindowTreeClient for same reason as above.
WaitForWindowTreeClient();
- Id window_1_2 = ws_client1()->NewWindow(2);
+ Id window_1_2 = wt_client1()->NewWindow(2);
ASSERT_TRUE(window_1_2);
ASSERT_TRUE(
- ws_client1()->AddWindow(BuildWindowId(connection_id_1(), 1), window_1_2));
- ASSERT_TRUE(ws_client3_.get() == nullptr);
- ws_client3_ = EstablishConnectionViaEmbedWithPolicyBitmask(
- ws1(), window_1_2, mojom::WindowTree::kAccessPolicyEmbedRoot, nullptr);
- ASSERT_TRUE(ws_client3_.get() != nullptr);
+ wt_client1()->AddWindow(BuildWindowId(connection_id_1(), 1), window_1_2));
+ ASSERT_TRUE(wt_client3_.get() == nullptr);
+ wt_client3_ = EstablishConnectionViaEmbedWithPolicyBitmask(
+ wt1(), window_1_2, mojom::WindowTree::kAccessPolicyEmbedRoot, nullptr);
+ ASSERT_TRUE(wt_client3_.get() != nullptr);
// window_1_2 is ws3's root, so even though v3 is an embed root it should not
// be able to Embed into itself.
- ASSERT_FALSE(EmbedUrl(connector(), ws3(), test_name(), window_1_2));
+ ASSERT_FALSE(EmbedUrl(connector(), wt3(), test_name(), window_1_2));
}
// Verifies that a transient window tracks its parent's lifetime.
@@ -1782,24 +1782,24 @@ TEST_F(WindowTreeAppTest, TransientWindowTracksTransientParentLifetime) {
ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
Id window_1_1 = BuildWindowId(connection_id_1(), 1);
- Id window_2_1 = ws_client2()->NewWindow(1);
- Id window_2_2 = ws_client2()->NewWindow(2);
- Id window_2_3 = ws_client2()->NewWindow(3);
+ Id window_2_1 = wt_client2()->NewWindow(1);
+ Id window_2_2 = wt_client2()->NewWindow(2);
+ Id window_2_3 = wt_client2()->NewWindow(3);
ASSERT_TRUE(window_2_1);
// root -> window_1_1 -> window_2_1
// root -> window_1_1 -> window_2_2
// root -> window_1_1 -> window_2_3
- ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_1));
- ASSERT_TRUE(ws_client2()->AddWindow(window_1_1, window_2_1));
- ASSERT_TRUE(ws_client2()->AddWindow(window_1_1, window_2_2));
- ASSERT_TRUE(ws_client2()->AddWindow(window_1_1, window_2_3));
+ ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
+ ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_1));
+ ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_2));
+ ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_3));
// window_2_2 and window_2_3 now track the lifetime of window_2_1.
changes1()->clear();
- ws2()->AddTransientWindow(10, window_2_1, window_2_2);
- ws2()->AddTransientWindow(11, window_2_1, window_2_3);
- ws_client1()->WaitForChangeCount(2);
+ wt2()->AddTransientWindow(10, window_2_1, window_2_2);
+ wt2()->AddTransientWindow(11, window_2_1, window_2_3);
+ wt_client1()->WaitForChangeCount(2);
EXPECT_EQ("AddTransientWindow parent = " + IdToString(window_2_1) +
" child = " + IdToString(window_2_2),
ChangesToDescription1(*changes1())[0]);
@@ -1808,15 +1808,15 @@ TEST_F(WindowTreeAppTest, TransientWindowTracksTransientParentLifetime) {
ChangesToDescription1(*changes1())[1]);
changes1()->clear();
- ws2()->RemoveTransientWindowFromParent(12, window_2_3);
- ws_client1()->WaitForChangeCount(1);
+ wt2()->RemoveTransientWindowFromParent(12, window_2_3);
+ wt_client1()->WaitForChangeCount(1);
EXPECT_EQ("RemoveTransientWindowFromParent parent = " +
IdToString(window_2_1) + " child = " + IdToString(window_2_3),
SingleChangeToDescription(*changes1()));
changes1()->clear();
- ASSERT_TRUE(ws_client2()->DeleteWindow(window_2_1));
- ws_client1()->WaitForChangeCount(2);
+ ASSERT_TRUE(wt_client2()->DeleteWindow(window_2_1));
+ wt_client1()->WaitForChangeCount(2);
EXPECT_EQ("WindowDeleted window=" + IdToString(window_2_2),
ChangesToDescription1(*changes1())[0]);
EXPECT_EQ("WindowDeleted window=" + IdToString(window_2_1),
@@ -1824,43 +1824,43 @@ TEST_F(WindowTreeAppTest, TransientWindowTracksTransientParentLifetime) {
}
TEST_F(WindowTreeAppTest, Ids) {
- const Id window_1_100 = ws_client1()->NewWindow(100);
+ const Id window_1_100 = wt_client1()->NewWindow(100);
ASSERT_TRUE(window_1_100);
- ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_100));
+ ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_100));
// Establish the second connection at 1,100.
ASSERT_NO_FATAL_FAILURE(EstablishSecondConnectionWithRoot(window_1_100));
- // 1,100 is the id in the ws_client1's id space. The new client should see
+ // 1,100 is the id in the wt_client1's id space. The new client should see
// 2,1 (the server id).
const Id window_1_100_in_ws2 = BuildWindowId(connection_id_1(), 1);
- EXPECT_EQ(window_1_100_in_ws2, ws_client2()->root_window_id());
+ EXPECT_EQ(window_1_100_in_ws2, wt_client2()->root_window_id());
// The first window created in the second connection gets a server id of 2,1
// regardless of the id the client uses.
- const Id window_2_101 = ws_client2()->NewWindow(101);
- ASSERT_TRUE(ws_client2()->AddWindow(window_1_100_in_ws2, window_2_101));
+ const Id window_2_101 = wt_client2()->NewWindow(101);
+ ASSERT_TRUE(wt_client2()->AddWindow(window_1_100_in_ws2, window_2_101));
const Id window_2_101_in_ws1 = BuildWindowId(connection_id_2(), 1);
- ws_client1()->WaitForChangeCount(1);
+ wt_client1()->WaitForChangeCount(1);
EXPECT_EQ("HierarchyChanged window=" + IdToString(window_2_101_in_ws1) +
" new_parent=" + IdToString(window_1_100) + " old_parent=null",
SingleChangeToDescription(*changes1()));
changes1()->clear();
// Change the bounds of window_2_101 and make sure server gets it.
- ws2()->SetWindowBounds(11, window_2_101,
+ wt2()->SetWindowBounds(11, window_2_101,
mojo::Rect::From(gfx::Rect(1, 2, 3, 4)));
- ASSERT_TRUE(ws_client2()->WaitForChangeCompleted(11));
- ws_client1()->WaitForChangeCount(1);
+ ASSERT_TRUE(wt_client2()->WaitForChangeCompleted(11));
+ wt_client1()->WaitForChangeCount(1);
EXPECT_EQ("BoundsChanged window=" + IdToString(window_2_101_in_ws1) +
" old_bounds=0,0 0x0 new_bounds=1,2 3x4",
SingleChangeToDescription(*changes1()));
changes2()->clear();
// Remove 2_101 from wm, client1 should see the change.
- ws1()->RemoveWindowFromParent(12, window_2_101_in_ws1);
- ASSERT_TRUE(ws_client1()->WaitForChangeCompleted(12));
- ws_client2()->WaitForChangeCount(1);
+ wt1()->RemoveWindowFromParent(12, window_2_101_in_ws1);
+ ASSERT_TRUE(wt_client1()->WaitForChangeCompleted(12));
+ wt_client2()->WaitForChangeCount(1);
EXPECT_EQ("HierarchyChanged window=" + IdToString(window_2_101) +
" new_parent=null old_parent=" +
IdToString(window_1_100_in_ws2),
@@ -1870,50 +1870,50 @@ TEST_F(WindowTreeAppTest, Ids) {
// Tests that setting capture fails when no input event has occurred, and there
// is no notification of lost capture.
TEST_F(WindowTreeAppTest, ExplicitCaptureWithoutInput) {
- Id window_1_1 = ws_client1()->NewWindow(1);
+ Id window_1_1 = wt_client1()->NewWindow(1);
// Add the window to the root, so that they have a Display to handle input
// capture.
- ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_1));
+ ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
changes1()->clear();
// Since there has been no input, capture should not succeed. No lost capture
// message is expected.
- ws1()->SetCapture(1, window_1_1);
- ws_client1_->WaitForAllMessages();
+ wt1()->SetCapture(1, window_1_1);
+ wt_client1_->WaitForAllMessages();
EXPECT_TRUE(changes1()->empty());
// Since there is no window with capture, lost capture should not be notified.
- ws1()->ReleaseCapture(3, window_1_1);
- ws_client1_->WaitForAllMessages();
+ wt1()->ReleaseCapture(3, window_1_1);
+ wt_client1_->WaitForAllMessages();
EXPECT_TRUE(changes1()->empty());
}
// TODO(jonross): Enable this once apptests can send input events to the server.
// Enabling capture requires that the connection be processing events.
TEST_F(WindowTreeAppTest, DISABLED_ExplicitCapturePropagation) {
- Id window_1_1 = ws_client1()->NewWindow(1);
- Id window_1_2 = ws_client1()->NewWindow(2);
+ Id window_1_1 = wt_client1()->NewWindow(1);
+ Id window_1_2 = wt_client1()->NewWindow(2);
// Add the windows to the root, so that they have a Display to handle input
// capture.
- ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_1));
- ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_2));
+ ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
+ ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_2));
changes1()->clear();
// Window 1 takes capture then Window 2 takes capture.
// Verify that window 1 has lost capture.
- ws1()->SetCapture(1, window_1_1);
- ws1()->SetCapture(2, window_1_2);
- ws_client1_->WaitForChangeCount(1);
+ wt1()->SetCapture(1, window_1_1);
+ wt1()->SetCapture(2, window_1_2);
+ wt_client1_->WaitForChangeCount(1);
EXPECT_EQ("OnLostCapture window=" + IdToString(window_1_1),
SingleChangeToDescription(*changes1()));
changes1()->clear();
// Explicitly releasing capture should not notify of lost capture.
- ws1()->ReleaseCapture(3, window_1_2);
- ws_client1_->WaitForAllMessages();
+ wt1()->ReleaseCapture(3, window_1_2);
+ wt_client1_->WaitForAllMessages();
EXPECT_TRUE(changes1()->empty());
}
diff --git a/components/mus/ws/client_connection.cc b/components/mus/ws/window_tree_binding.cc
index 9c55234..2eaae79 100644
--- a/components/mus/ws/client_connection.cc
+++ b/components/mus/ws/window_tree_binding.cc
@@ -2,26 +2,26 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/mus/ws/client_connection.h"
+#include "components/mus/ws/window_tree_binding.h"
#include "base/bind.h"
#include "components/mus/ws/connection_manager.h"
-#include "components/mus/ws/window_tree_impl.h"
+#include "components/mus/ws/window_tree.h"
namespace mus {
namespace ws {
-ClientConnection::ClientConnection(mojom::WindowTreeClient* client)
+WindowTreeBinding::WindowTreeBinding(mojom::WindowTreeClient* client)
: client_(client) {}
-ClientConnection::~ClientConnection() {}
+WindowTreeBinding::~WindowTreeBinding() {}
-DefaultClientConnection::DefaultClientConnection(
- WindowTreeImpl* tree,
+DefaultWindowTreeBinding::DefaultWindowTreeBinding(
+ WindowTree* tree,
ConnectionManager* connection_manager,
mojom::WindowTreeRequest service_request,
mojom::WindowTreeClientPtr client)
- : ClientConnection(client.get()),
+ : WindowTreeBinding(client.get()),
connection_manager_(connection_manager),
binding_(tree, std::move(service_request)),
client_(std::move(client)) {
@@ -31,18 +31,18 @@ DefaultClientConnection::DefaultClientConnection(
base::Unretained(connection_manager), base::Unretained(tree)));
}
-DefaultClientConnection::DefaultClientConnection(
- WindowTreeImpl* tree,
+DefaultWindowTreeBinding::DefaultWindowTreeBinding(
+ WindowTree* tree,
ConnectionManager* connection_manager,
mojom::WindowTreeClientPtr client)
- : ClientConnection(client.get()),
+ : WindowTreeBinding(client.get()),
connection_manager_(connection_manager),
binding_(tree),
client_(std::move(client)) {}
-DefaultClientConnection::~DefaultClientConnection() {}
+DefaultWindowTreeBinding::~DefaultWindowTreeBinding() {}
-void DefaultClientConnection::SetIncomingMethodCallProcessingPaused(
+void DefaultWindowTreeBinding::SetIncomingMethodCallProcessingPaused(
bool paused) {
if (paused)
binding_.PauseIncomingMethodCallProcessing();
@@ -50,12 +50,12 @@ void DefaultClientConnection::SetIncomingMethodCallProcessingPaused(
binding_.ResumeIncomingMethodCallProcessing();
}
-mojom::WindowTreePtr DefaultClientConnection::CreateInterfacePtrAndBind() {
+mojom::WindowTreePtr DefaultWindowTreeBinding::CreateInterfacePtrAndBind() {
DCHECK(!binding_.is_bound());
return binding_.CreateInterfacePtrAndBind();
}
-mojom::WindowManager* DefaultClientConnection::GetWindowManager() {
+mojom::WindowManager* DefaultWindowTreeBinding::GetWindowManager() {
client_->GetWindowManager(
GetProxy(&window_manager_internal_, client_.associated_group()));
return window_manager_internal_.get();
diff --git a/components/mus/ws/client_connection.h b/components/mus/ws/window_tree_binding.h
index 1d4f674..cfe0f92 100644
--- a/components/mus/ws/client_connection.h
+++ b/components/mus/ws/window_tree_binding.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef COMPONENTS_MUS_WS_CLIENT_CONNECTION_H_
-#define COMPONENTS_MUS_WS_CLIENT_CONNECTION_H_
+#ifndef COMPONENTS_MUS_WS_WINDOW_TREE_BINDING_H_
+#define COMPONENTS_MUS_WS_WINDOW_TREE_BINDING_H_
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
@@ -14,15 +14,15 @@ namespace mus {
namespace ws {
class ConnectionManager;
-class WindowTreeImpl;
+class WindowTree;
-// ClientConnection encapsulates the state needed for a single client connected
-// to the window manager. ClientConnection is owned by the WindowTreeImpl the
-// ClientConnection is associated with.
-class ClientConnection {
+// WindowTreeBinding manages the binding between a WindowTree and its mojo
+// clients. WindowTreeBinding exists so that the client can be mocked for
+// tests. WindowTree owns its associated WindowTreeBinding.
+class WindowTreeBinding {
public:
- explicit ClientConnection(mojom::WindowTreeClient* client);
- virtual ~ClientConnection();
+ explicit WindowTreeBinding(mojom::WindowTreeClient* client);
+ virtual ~WindowTreeBinding();
mojom::WindowTreeClient* client() { return client_; }
@@ -34,26 +34,26 @@ class ClientConnection {
private:
mojom::WindowTreeClient* client_;
- DISALLOW_COPY_AND_ASSIGN(ClientConnection);
+ DISALLOW_COPY_AND_ASSIGN(WindowTreeBinding);
};
-// Bindings implementation of ClientConnection.
-class DefaultClientConnection : public ClientConnection {
+// Bindings implementation of WindowTreeBinding.
+class DefaultWindowTreeBinding : public WindowTreeBinding {
public:
- DefaultClientConnection(WindowTreeImpl* tree,
- ConnectionManager* connection_manager,
- mojom::WindowTreeRequest service_request,
- mojom::WindowTreeClientPtr client);
- DefaultClientConnection(WindowTreeImpl* tree,
- ConnectionManager* connection_manager,
- mojom::WindowTreeClientPtr client);
- ~DefaultClientConnection() override;
+ DefaultWindowTreeBinding(WindowTree* tree,
+ ConnectionManager* connection_manager,
+ mojom::WindowTreeRequest service_request,
+ mojom::WindowTreeClientPtr client);
+ DefaultWindowTreeBinding(WindowTree* tree,
+ ConnectionManager* connection_manager,
+ mojom::WindowTreeClientPtr client);
+ ~DefaultWindowTreeBinding() override;
// Use when created with the constructor that does not take a
// WindowTreeRequest.
mojom::WindowTreePtr CreateInterfacePtrAndBind();
- // ClientConnection:
+ // WindowTreeBinding:
mojom::WindowManager* GetWindowManager() override;
void SetIncomingMethodCallProcessingPaused(bool paused) override;
@@ -63,10 +63,10 @@ class DefaultClientConnection : public ClientConnection {
mojom::WindowTreeClientPtr client_;
mojom::WindowManagerAssociatedPtr window_manager_internal_;
- DISALLOW_COPY_AND_ASSIGN(DefaultClientConnection);
+ DISALLOW_COPY_AND_ASSIGN(DefaultWindowTreeBinding);
};
} // namespace ws
} // namespace mus
-#endif // COMPONENTS_MUS_WS_CLIENT_CONNECTION_H_
+#endif // COMPONENTS_MUS_WS_WINDOW_TREE_BINDING_H_
diff --git a/components/mus/ws/window_tree_factory.cc b/components/mus/ws/window_tree_factory.cc
index 05d48e7..14231cc 100644
--- a/components/mus/ws/window_tree_factory.cc
+++ b/components/mus/ws/window_tree_factory.cc
@@ -4,9 +4,9 @@
#include "components/mus/ws/window_tree_factory.h"
-#include "components/mus/ws/client_connection.h"
#include "components/mus/ws/connection_manager.h"
-#include "components/mus/ws/window_tree_impl.h"
+#include "components/mus/ws/window_tree.h"
+#include "components/mus/ws/window_tree_binding.h"
namespace mus {
namespace ws {
@@ -24,14 +24,13 @@ void WindowTreeFactory::AddBinding(
void WindowTreeFactory::CreateWindowTree(
mojo::InterfaceRequest<mojom::WindowTree> tree_request,
mojom::WindowTreeClientPtr client) {
- scoped_ptr<ws::WindowTreeImpl> service(new ws::WindowTreeImpl(
+ scoped_ptr<ws::WindowTree> service(new ws::WindowTree(
connection_manager_, nullptr, mojom::WindowTree::kAccessPolicyDefault));
- scoped_ptr<ws::DefaultClientConnection> client_connection(
- new ws::DefaultClientConnection(service.get(), connection_manager_,
- std::move(tree_request),
- std::move(client)));
- connection_manager_->AddTree(std::move(service), std::move(client_connection),
- nullptr);
+ scoped_ptr<ws::DefaultWindowTreeBinding> binding(
+ new ws::DefaultWindowTreeBinding(service.get(), connection_manager_,
+ std::move(tree_request),
+ std::move(client)));
+ connection_manager_->AddTree(std::move(service), std::move(binding), nullptr);
}
} // namespace ws
diff --git a/components/mus/ws/window_tree_unittest.cc b/components/mus/ws/window_tree_unittest.cc
index 09f23f3..17f59eb 100644
--- a/components/mus/ws/window_tree_unittest.cc
+++ b/components/mus/ws/window_tree_unittest.cc
@@ -14,7 +14,6 @@
#include "components/mus/common/util.h"
#include "components/mus/public/interfaces/window_tree.mojom.h"
#include "components/mus/surfaces/surfaces_state.h"
-#include "components/mus/ws/client_connection.h"
#include "components/mus/ws/connection_manager.h"
#include "components/mus/ws/connection_manager_delegate.h"
#include "components/mus/ws/display_binding.h"
@@ -25,7 +24,8 @@
#include "components/mus/ws/server_window_surface_manager_test_api.h"
#include "components/mus/ws/test_change_tracker.h"
#include "components/mus/ws/test_utils.h"
-#include "components/mus/ws/window_tree_impl.h"
+#include "components/mus/ws/window_tree.h"
+#include "components/mus/ws/window_tree_binding.h"
#include "mojo/converters/geometry/geometry_type_converters.h"
#include "mojo/services/network/public/interfaces/url_loader.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -42,12 +42,12 @@ std::string WindowIdToString(const WindowId& id) {
return base::StringPrintf("%d,%d", id.connection_id, id.window_id);
}
-ClientWindowId BuildClientWindowId(WindowTreeImpl* tree,
+ClientWindowId BuildClientWindowId(WindowTree* tree,
ConnectionSpecificId window_id) {
return ClientWindowId(WindowIdToTransportId(WindowId(tree->id(), window_id)));
}
-ClientWindowId ClientWindowIdForWindow(WindowTreeImpl* tree,
+ClientWindowId ClientWindowIdForWindow(WindowTree* tree,
const ServerWindow* window) {
ClientWindowId client_window_id;
// If window isn't known we'll return 0, which should then error out.
@@ -102,7 +102,7 @@ class TestDisplayBinding : public DisplayBinding {
private:
// DisplayBinding:
- WindowTreeImpl* CreateWindowTree(ServerWindow* root) override {
+ WindowTree* CreateWindowTree(ServerWindow* root) override {
return connection_manager_->EmbedAtWindow(
root, mus::mojom::WindowTree::kAccessPolicyEmbedRoot,
mus::mojom::WindowTreeClientPtr());
@@ -144,15 +144,13 @@ ui::PointerEvent CreateMouseUpEvent(int x, int y) {
ui::EF_LEFT_MOUSE_BUTTON));
}
-const ServerWindow* FirstRoot(WindowTreeImpl* connection) {
- return connection->roots().size() == 1u ? *(connection->roots().begin())
- : nullptr;
+const ServerWindow* FirstRoot(WindowTree* tree) {
+ return tree->roots().size() == 1u ? *(tree->roots().begin()) : nullptr;
}
-ClientWindowId FirstRootId(WindowTreeImpl* connection) {
- return connection->roots().size() == 1u
- ? ClientWindowIdForWindow(connection,
- *(connection->roots().begin()))
+ClientWindowId FirstRootId(WindowTree* tree) {
+ return tree->roots().size() == 1u
+ ? ClientWindowIdForWindow(tree, *(tree->roots().begin()))
: ClientWindowId();
}
@@ -168,18 +166,14 @@ class WindowTreeTest : public testing::Test {
platform_display_factory_(&cursor_id_) {}
~WindowTreeTest() override {}
- // WindowTreeImpl for the window manager.
- WindowTreeImpl* wm_connection() {
- return connection_manager_->GetConnection(1);
- }
+ // WindowTree for the window manager.
+ WindowTree* wm_tree() { return connection_manager_->GetTreeWithId(1); }
TestWindowTreeClient* last_window_tree_client() {
return delegate_.last_client();
}
- TestClientConnection* last_client_connection() {
- return delegate_.last_connection();
- }
+ TestWindowTreeBinding* last_binding() { return delegate_.last_binding(); }
ConnectionManager* connection_manager() { return connection_manager_.get(); }
@@ -196,9 +190,9 @@ class WindowTreeTest : public testing::Test {
DisplayTestApi(display_).OnEvent(event);
}
- void set_window_manager_internal(WindowTreeImpl* connection,
+ void set_window_manager_internal(WindowTree* tree,
mojom::WindowManager* wm_internal) {
- WindowTreeTestApi(connection).set_window_manager_internal(wm_internal);
+ WindowTreeTestApi(tree).set_window_manager_internal(wm_internal);
}
void AckPreviousEvent() {
@@ -212,10 +206,10 @@ class WindowTreeTest : public testing::Test {
AckPreviousEvent();
}
- // Creates a new window from wm_connection() and embeds a new connection in
+ // Creates a new window from wm_tree() and embeds a new connection in
// it.
void SetupEventTargeting(TestWindowTreeClient** out_client,
- WindowTreeImpl** window_tree_connection,
+ WindowTree** window_tree,
ServerWindow** window);
protected:
@@ -248,44 +242,38 @@ class WindowTreeTest : public testing::Test {
DISALLOW_COPY_AND_ASSIGN(WindowTreeTest);
};
-// Creates a new window in wm_connection(), adds it to the root, embeds a
+// Creates a new window in wm_tree(), adds it to the root, embeds a
// new client in the window and creates a child of said window. |window| is
-// set to the child of |window_tree_connection| that is created.
-void WindowTreeTest::SetupEventTargeting(
- TestWindowTreeClient** out_client,
- WindowTreeImpl** window_tree_connection,
- ServerWindow** window) {
- const ClientWindowId embed_window_id =
- BuildClientWindowId(wm_connection(), 1);
+// set to the child of |window_tree| that is created.
+void WindowTreeTest::SetupEventTargeting(TestWindowTreeClient** out_client,
+ WindowTree** window_tree,
+ ServerWindow** window) {
+ const ClientWindowId embed_window_id = BuildClientWindowId(wm_tree(), 1);
EXPECT_TRUE(
- wm_connection()->NewWindow(embed_window_id, ServerWindow::Properties()));
- EXPECT_TRUE(wm_connection()->SetWindowVisibility(embed_window_id, true));
- EXPECT_TRUE(wm_connection()->AddWindow(FirstRootId(wm_connection()),
- embed_window_id));
+ wm_tree()->NewWindow(embed_window_id, ServerWindow::Properties()));
+ EXPECT_TRUE(wm_tree()->SetWindowVisibility(embed_window_id, true));
+ EXPECT_TRUE(wm_tree()->AddWindow(FirstRootId(wm_tree()), embed_window_id));
display_->root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
mojom::WindowTreeClientPtr client;
mojom::WindowTreeClientRequest client_request = GetProxy(&client);
wm_client()->Bind(std::move(client_request));
ConnectionSpecificId connection_id = 0;
- wm_connection()->Embed(embed_window_id, std::move(client),
- mojom::WindowTree::kAccessPolicyDefault,
- &connection_id);
- ServerWindow* embed_window =
- wm_connection()->GetWindowByClientId(embed_window_id);
- WindowTreeImpl* connection1 =
- connection_manager()->GetConnectionWithRoot(embed_window);
- ASSERT_TRUE(connection1 != nullptr);
- ASSERT_NE(connection1, wm_connection());
+ wm_tree()->Embed(embed_window_id, std::move(client),
+ mojom::WindowTree::kAccessPolicyDefault, &connection_id);
+ ServerWindow* embed_window = wm_tree()->GetWindowByClientId(embed_window_id);
+ WindowTree* tree1 = connection_manager()->GetTreeWithRoot(embed_window);
+ ASSERT_TRUE(tree1 != nullptr);
+ ASSERT_NE(tree1, wm_tree());
embed_window->SetBounds(gfx::Rect(0, 0, 50, 50));
- const ClientWindowId child1_id(BuildClientWindowId(connection1, 1));
- EXPECT_TRUE(connection1->NewWindow(child1_id, ServerWindow::Properties()));
- ServerWindow* child1 = connection1->GetWindowByClientId(child1_id);
+ const ClientWindowId child1_id(BuildClientWindowId(tree1, 1));
+ EXPECT_TRUE(tree1->NewWindow(child1_id, ServerWindow::Properties()));
+ ServerWindow* child1 = tree1->GetWindowByClientId(child1_id);
ASSERT_TRUE(child1);
- EXPECT_TRUE(connection1->AddWindow(
- ClientWindowIdForWindow(connection1, embed_window), child1_id));
- connection1->GetDisplay(embed_window)->AddActivationParent(embed_window);
+ EXPECT_TRUE(tree1->AddWindow(ClientWindowIdForWindow(tree1, embed_window),
+ child1_id));
+ tree1->GetDisplay(embed_window)->AddActivationParent(embed_window);
child1->SetVisible(true);
child1->SetBounds(gfx::Rect(20, 20, 20, 20));
@@ -296,59 +284,55 @@ void WindowTreeTest::SetupEventTargeting(
wm_client()->tracker()->changes()->clear();
*out_client = embed_connection;
- *window_tree_connection = connection1;
+ *window_tree = tree1;
*window = child1;
}
// Verifies focus correctly changes on pointer events.
TEST_F(WindowTreeTest, FocusOnPointer) {
- const ClientWindowId embed_window_id =
- BuildClientWindowId(wm_connection(), 1);
+ const ClientWindowId embed_window_id = BuildClientWindowId(wm_tree(), 1);
EXPECT_TRUE(
- wm_connection()->NewWindow(embed_window_id, ServerWindow::Properties()));
- ServerWindow* embed_window =
- wm_connection()->GetWindowByClientId(embed_window_id);
+ wm_tree()->NewWindow(embed_window_id, ServerWindow::Properties()));
+ ServerWindow* embed_window = wm_tree()->GetWindowByClientId(embed_window_id);
ASSERT_TRUE(embed_window);
- EXPECT_TRUE(wm_connection()->SetWindowVisibility(embed_window_id, true));
- ASSERT_TRUE(FirstRoot(wm_connection()));
- const ClientWindowId wm_root_id = FirstRootId(wm_connection());
- EXPECT_TRUE(wm_connection()->AddWindow(wm_root_id, embed_window_id));
+ EXPECT_TRUE(wm_tree()->SetWindowVisibility(embed_window_id, true));
+ ASSERT_TRUE(FirstRoot(wm_tree()));
+ const ClientWindowId wm_root_id = FirstRootId(wm_tree());
+ EXPECT_TRUE(wm_tree()->AddWindow(wm_root_id, embed_window_id));
display_->root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
mojom::WindowTreeClientPtr client;
mojom::WindowTreeClientRequest client_request = GetProxy(&client);
wm_client()->Bind(std::move(client_request));
ConnectionSpecificId connection_id = 0;
- wm_connection()->Embed(embed_window_id, std::move(client),
- mojom::WindowTree::kAccessPolicyDefault,
- &connection_id);
- WindowTreeImpl* connection1 =
- connection_manager()->GetConnectionWithRoot(embed_window);
- ASSERT_TRUE(connection1 != nullptr);
- ASSERT_NE(connection1, wm_connection());
+ wm_tree()->Embed(embed_window_id, std::move(client),
+ mojom::WindowTree::kAccessPolicyDefault, &connection_id);
+ WindowTree* tree1 = connection_manager()->GetTreeWithRoot(embed_window);
+ ASSERT_TRUE(tree1 != nullptr);
+ ASSERT_NE(tree1, wm_tree());
embed_window->SetBounds(gfx::Rect(0, 0, 50, 50));
- const ClientWindowId child1_id(BuildClientWindowId(connection1, 1));
- EXPECT_TRUE(connection1->NewWindow(child1_id, ServerWindow::Properties()));
- EXPECT_TRUE(connection1->AddWindow(
- ClientWindowIdForWindow(connection1, embed_window), child1_id));
- ServerWindow* child1 = connection1->GetWindowByClientId(child1_id);
+ const ClientWindowId child1_id(BuildClientWindowId(tree1, 1));
+ EXPECT_TRUE(tree1->NewWindow(child1_id, ServerWindow::Properties()));
+ EXPECT_TRUE(tree1->AddWindow(ClientWindowIdForWindow(tree1, embed_window),
+ child1_id));
+ ServerWindow* child1 = tree1->GetWindowByClientId(child1_id);
ASSERT_TRUE(child1);
child1->SetVisible(true);
child1->SetBounds(gfx::Rect(20, 20, 20, 20));
EnableHitTest(child1);
- TestWindowTreeClient* connection1_client = last_window_tree_client();
- connection1_client->tracker()->changes()->clear();
+ TestWindowTreeClient* tree1_client = last_window_tree_client();
+ tree1_client->tracker()->changes()->clear();
wm_client()->tracker()->changes()->clear();
// Focus should not go to |child1| yet, since the parent still doesn't allow
// active children.
DispatchEventAndAckImmediately(CreatePointerDownEvent(21, 22));
- Display* display1 = connection1->GetDisplay(embed_window);
+ Display* display1 = tree1->GetDisplay(embed_window);
EXPECT_EQ(nullptr, display1->GetFocusedWindow());
DispatchEventAndAckImmediately(CreatePointerUpEvent(21, 22));
- connection1_client->tracker()->changes()->clear();
+ tree1_client->tracker()->changes()->clear();
wm_client()->tracker()->changes()->clear();
display1->AddActivationParent(embed_window);
@@ -360,14 +344,13 @@ TEST_F(WindowTreeTest, FocusOnPointer) {
ASSERT_GE(wm_client()->tracker()->changes()->size(), 1u);
EXPECT_EQ("Focused id=2,1",
ChangesToDescription1(*wm_client()->tracker()->changes())[0]);
- ASSERT_GE(connection1_client->tracker()->changes()->size(), 1u);
- EXPECT_EQ(
- "Focused id=2,1",
- ChangesToDescription1(*connection1_client->tracker()->changes())[0]);
+ ASSERT_GE(tree1_client->tracker()->changes()->size(), 1u);
+ EXPECT_EQ("Focused id=2,1",
+ ChangesToDescription1(*tree1_client->tracker()->changes())[0]);
DispatchEventAndAckImmediately(CreatePointerUpEvent(21, 22));
wm_client()->tracker()->changes()->clear();
- connection1_client->tracker()->changes()->clear();
+ tree1_client->tracker()->changes()->clear();
// Press outside of the embedded window. Note that root cannot be focused
// (because it cannot be activated). So the focus would not move in this case.
@@ -376,7 +359,7 @@ TEST_F(WindowTreeTest, FocusOnPointer) {
DispatchEventAndAckImmediately(CreatePointerUpEvent(21, 22));
wm_client()->tracker()->changes()->clear();
- connection1_client->tracker()->changes()->clear();
+ tree1_client->tracker()->changes()->clear();
// Press in the same location. Should not get a focus change event (only input
// event).
@@ -386,15 +369,15 @@ TEST_F(WindowTreeTest, FocusOnPointer) {
<< SingleChangeToDescription(*wm_client()->tracker()->changes());
EXPECT_EQ("InputEvent window=0,3 event_action=4",
ChangesToDescription1(*wm_client()->tracker()->changes())[0]);
- EXPECT_TRUE(connection1_client->tracker()->changes()->empty());
+ EXPECT_TRUE(tree1_client->tracker()->changes()->empty());
}
TEST_F(WindowTreeTest, BasicInputEventTarget) {
TestWindowTreeClient* embed_connection = nullptr;
- WindowTreeImpl* window_tree_connection = nullptr;
+ WindowTree* tree = nullptr;
ServerWindow* window = nullptr;
EXPECT_NO_FATAL_FAILURE(
- SetupEventTargeting(&embed_connection, &window_tree_connection, &window));
+ SetupEventTargeting(&embed_connection, &tree, &window));
// Send an event to |v1|. |embed_connection| should get the event, not
// |wm_client|, since |v1| lives inside an embedded window.
@@ -411,10 +394,10 @@ TEST_F(WindowTreeTest, BasicInputEventTarget) {
TEST_F(WindowTreeTest, CursorChangesWhenMouseOverWindowAndWindowSetsCursor) {
TestWindowTreeClient* embed_connection = nullptr;
- WindowTreeImpl* window_tree_connection = nullptr;
+ WindowTree* tree = nullptr;
ServerWindow* window = nullptr;
EXPECT_NO_FATAL_FAILURE(
- SetupEventTargeting(&embed_connection, &window_tree_connection, &window));
+ SetupEventTargeting(&embed_connection, &tree, &window));
// Like in BasicInputEventTarget, we send a pointer down event to be
// dispatched. This is only to place the mouse cursor over that window though.
@@ -429,10 +412,10 @@ TEST_F(WindowTreeTest, CursorChangesWhenMouseOverWindowAndWindowSetsCursor) {
TEST_F(WindowTreeTest, CursorChangesWhenEnteringWindowWithDifferentCursor) {
TestWindowTreeClient* embed_connection = nullptr;
- WindowTreeImpl* window_tree_connection = nullptr;
+ WindowTree* tree = nullptr;
ServerWindow* window = nullptr;
EXPECT_NO_FATAL_FAILURE(
- SetupEventTargeting(&embed_connection, &window_tree_connection, &window));
+ SetupEventTargeting(&embed_connection, &tree, &window));
// Let's create a pointer event outside the window and then move the pointer
// inside.
@@ -446,10 +429,10 @@ TEST_F(WindowTreeTest, CursorChangesWhenEnteringWindowWithDifferentCursor) {
TEST_F(WindowTreeTest, TouchesDontChangeCursor) {
TestWindowTreeClient* embed_connection = nullptr;
- WindowTreeImpl* window_tree_connection = nullptr;
+ WindowTree* tree = nullptr;
ServerWindow* window = nullptr;
EXPECT_NO_FATAL_FAILURE(
- SetupEventTargeting(&embed_connection, &window_tree_connection, &window));
+ SetupEventTargeting(&embed_connection, &tree, &window));
// Let's create a pointer event outside the window and then move the pointer
// inside.
@@ -464,10 +447,10 @@ TEST_F(WindowTreeTest, TouchesDontChangeCursor) {
TEST_F(WindowTreeTest, DragOutsideWindow) {
TestWindowTreeClient* embed_connection = nullptr;
- WindowTreeImpl* window_tree_connection = nullptr;
+ WindowTree* tree = nullptr;
ServerWindow* window = nullptr;
EXPECT_NO_FATAL_FAILURE(
- SetupEventTargeting(&embed_connection, &window_tree_connection, &window));
+ SetupEventTargeting(&embed_connection, &tree, &window));
// Start with the cursor outside the window. Setting the cursor shouldn't
// change the cursor.
@@ -495,10 +478,10 @@ TEST_F(WindowTreeTest, DragOutsideWindow) {
TEST_F(WindowTreeTest, ChangingWindowBoundsChangesCursor) {
TestWindowTreeClient* embed_connection = nullptr;
- WindowTreeImpl* window_tree_connection = nullptr;
+ WindowTree* tree = nullptr;
ServerWindow* window = nullptr;
EXPECT_NO_FATAL_FAILURE(
- SetupEventTargeting(&embed_connection, &window_tree_connection, &window));
+ SetupEventTargeting(&embed_connection, &tree, &window));
// Put the cursor just outside the bounds of the window.
DispatchEventAndAckImmediately(CreateMouseMoveEvent(41, 41));
@@ -517,20 +500,18 @@ TEST_F(WindowTreeTest, ChangingWindowBoundsChangesCursor) {
TEST_F(WindowTreeTest, WindowReorderingChangesCursor) {
TestWindowTreeClient* embed_connection = nullptr;
- WindowTreeImpl* window_tree_connection = nullptr;
+ WindowTree* tree = nullptr;
ServerWindow* window1 = nullptr;
- EXPECT_NO_FATAL_FAILURE(SetupEventTargeting(
- &embed_connection, &window_tree_connection, &window1));
+ EXPECT_NO_FATAL_FAILURE(
+ SetupEventTargeting(&embed_connection, &tree, &window1));
// Create a second window right over the first.
- const ClientWindowId embed_window_id(FirstRootId(window_tree_connection));
- const ClientWindowId child2_id(
- BuildClientWindowId(window_tree_connection, 2));
- EXPECT_TRUE(
- window_tree_connection->NewWindow(child2_id, ServerWindow::Properties()));
- ServerWindow* child2 = window_tree_connection->GetWindowByClientId(child2_id);
+ const ClientWindowId embed_window_id(FirstRootId(tree));
+ const ClientWindowId child2_id(BuildClientWindowId(tree, 2));
+ EXPECT_TRUE(tree->NewWindow(child2_id, ServerWindow::Properties()));
+ ServerWindow* child2 = tree->GetWindowByClientId(child2_id);
ASSERT_TRUE(child2);
- EXPECT_TRUE(window_tree_connection->AddWindow(embed_window_id, child2_id));
+ EXPECT_TRUE(tree->AddWindow(embed_window_id, child2_id));
child2->SetVisible(true);
child2->SetBounds(gfx::Rect(20, 20, 20, 20));
EnableHitTest(child2);
@@ -549,14 +530,12 @@ TEST_F(WindowTreeTest, WindowReorderingChangesCursor) {
}
TEST_F(WindowTreeTest, EventAck) {
- const ClientWindowId embed_window_id =
- BuildClientWindowId(wm_connection(), 1);
+ const ClientWindowId embed_window_id = BuildClientWindowId(wm_tree(), 1);
EXPECT_TRUE(
- wm_connection()->NewWindow(embed_window_id, ServerWindow::Properties()));
- EXPECT_TRUE(wm_connection()->SetWindowVisibility(embed_window_id, true));
- ASSERT_TRUE(FirstRoot(wm_connection()));
- EXPECT_TRUE(wm_connection()->AddWindow(FirstRootId(wm_connection()),
- embed_window_id));
+ wm_tree()->NewWindow(embed_window_id, ServerWindow::Properties()));
+ EXPECT_TRUE(wm_tree()->SetWindowVisibility(embed_window_id, true));
+ ASSERT_TRUE(FirstRoot(wm_tree()));
+ EXPECT_TRUE(wm_tree()->AddWindow(FirstRootId(wm_tree()), embed_window_id));
display_->root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
wm_client()->tracker()->changes()->clear();
@@ -581,12 +560,12 @@ TEST_F(WindowTreeTest, EventAck) {
// sure client paused.
TEST_F(WindowTreeTest, NewTopLevelWindow) {
TestWindowManager wm_internal;
- set_window_manager_internal(wm_connection(), &wm_internal);
+ set_window_manager_internal(wm_tree(), &wm_internal);
TestWindowTreeClient* embed_connection = nullptr;
- WindowTreeImpl* window_tree_connection = nullptr;
+ WindowTree* tree = nullptr;
ServerWindow* window = nullptr;
ASSERT_NO_FATAL_FAILURE(
- SetupEventTargeting(&embed_connection, &window_tree_connection, &window));
+ SetupEventTargeting(&embed_connection, &tree, &window));
embed_connection->tracker()->changes()->clear();
embed_connection->set_record_on_change_completed(true);
@@ -595,27 +574,24 @@ TEST_F(WindowTreeTest, NewTopLevelWindow) {
const uint32_t initial_change_id = 17;
// Explicitly use an id that does not contain the connection id.
const ClientWindowId embed_window_id2_in_child(45 << 16 | 27);
- static_cast<mojom::WindowTree*>(window_tree_connection)
- ->NewTopLevelWindow(initial_change_id, embed_window_id2_in_child.id,
- std::move(properties));
+ static_cast<mojom::WindowTree*>(tree)->NewTopLevelWindow(
+ initial_change_id, embed_window_id2_in_child.id, std::move(properties));
// The binding should be paused until the wm acks the change.
uint32_t wm_change_id = 0u;
ASSERT_TRUE(wm_internal.did_call_create_top_level_window(&wm_change_id));
- EXPECT_TRUE(last_client_connection()->is_paused());
+ EXPECT_TRUE(last_binding()->is_paused());
// Create the window for |embed_window_id2_in_child|.
- const ClientWindowId embed_window_id2 =
- BuildClientWindowId(wm_connection(), 2);
+ const ClientWindowId embed_window_id2 = BuildClientWindowId(wm_tree(), 2);
EXPECT_TRUE(
- wm_connection()->NewWindow(embed_window_id2, ServerWindow::Properties()));
- EXPECT_TRUE(wm_connection()->AddWindow(FirstRootId(wm_connection()),
- embed_window_id2));
+ wm_tree()->NewWindow(embed_window_id2, ServerWindow::Properties()));
+ EXPECT_TRUE(wm_tree()->AddWindow(FirstRootId(wm_tree()), embed_window_id2));
// Ack the change, which should resume the binding.
- static_cast<mojom::WindowManagerClient*>(wm_connection())
+ static_cast<mojom::WindowManagerClient*>(wm_tree())
->OnWmCreatedTopLevelWindow(wm_change_id, embed_window_id2.id);
- EXPECT_FALSE(last_client_connection()->is_paused());
+ EXPECT_FALSE(last_binding()->is_paused());
EXPECT_EQ("TopLevelCreated id=17 window_id=" +
WindowIdToString(
WindowIdFromTransportId(embed_window_id2_in_child.id)),
@@ -624,12 +600,11 @@ TEST_F(WindowTreeTest, NewTopLevelWindow) {
// Change the visibility of the window from the owner and make sure the
// client sees the right id.
- ServerWindow* embed_window =
- wm_connection()->GetWindowByClientId(embed_window_id2);
+ ServerWindow* embed_window = wm_tree()->GetWindowByClientId(embed_window_id2);
ASSERT_TRUE(embed_window);
EXPECT_FALSE(embed_window->visible());
- ASSERT_TRUE(wm_connection()->SetWindowVisibility(
- ClientWindowIdForWindow(wm_connection(), embed_window), true));
+ ASSERT_TRUE(wm_tree()->SetWindowVisibility(
+ ClientWindowIdForWindow(wm_tree(), embed_window), true));
EXPECT_TRUE(embed_window->visible());
EXPECT_EQ("VisibilityChanged window=" +
WindowIdToString(
@@ -638,8 +613,7 @@ TEST_F(WindowTreeTest, NewTopLevelWindow) {
SingleChangeToDescription(*embed_connection->tracker()->changes()));
// Set the visibility from the child using the client assigned id.
- ASSERT_TRUE(window_tree_connection->SetWindowVisibility(
- embed_window_id2_in_child, false));
+ ASSERT_TRUE(tree->SetWindowVisibility(embed_window_id2_in_child, false));
EXPECT_FALSE(embed_window->visible());
}
@@ -647,23 +621,20 @@ TEST_F(WindowTreeTest, NewTopLevelWindow) {
// processed, and the only the capture window can release capture.
TEST_F(WindowTreeTest, ExplicitSetCapture) {
TestWindowTreeClient* embed_connection = nullptr;
- WindowTreeImpl* window_tree_connection = nullptr;
+ WindowTree* tree = nullptr;
ServerWindow* window = nullptr;
EXPECT_NO_FATAL_FAILURE(
- SetupEventTargeting(&embed_connection, &window_tree_connection, &window));
- const ServerWindow* root_window = *window_tree_connection->roots().begin();
- window_tree_connection->AddWindow(
- FirstRootId(window_tree_connection),
- ClientWindowIdForWindow(window_tree_connection, window));
+ SetupEventTargeting(&embed_connection, &tree, &window));
+ const ServerWindow* root_window = *tree->roots().begin();
+ tree->AddWindow(FirstRootId(tree), ClientWindowIdForWindow(tree, window));
window->SetBounds(gfx::Rect(0, 0, 100, 100));
- ASSERT_TRUE(window_tree_connection->GetDisplay(window));
+ ASSERT_TRUE(tree->GetDisplay(window));
// Setting capture should fail when there are no active events
- mojom::WindowTree* mojom_window_tree =
- static_cast<mojom::WindowTree*>(window_tree_connection);
+ mojom::WindowTree* mojom_window_tree = static_cast<mojom::WindowTree*>(tree);
uint32_t change_id = 42;
mojom_window_tree->SetCapture(change_id, WindowIdToTransportId(window->id()));
- Display* display = window_tree_connection->GetDisplay(window);
+ Display* display = tree->GetDisplay(window);
EXPECT_NE(window, display->GetCaptureWindow());
// Setting capture after the event is acknowledged should fail