diff options
author | sky <sky@chromium.org> | 2016-03-10 16:08:48 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-11 00:10:04 +0000 |
commit | b93b6764fe14490b172848796c576919be633a97 (patch) | |
tree | c517901380d3a3c88be09ccfb7919b2123a7bc91 | |
parent | 10ebf5c24cfea4581529716a4763e9a071fed638 (diff) | |
download | chromium_src-b93b6764fe14490b172848796c576919be633a97.zip chromium_src-b93b6764fe14490b172848796c576919be633a97.tar.gz chromium_src-b93b6764fe14490b172848796c576919be633a97.tar.bz2 |
Removes embed root from mus
This was used by mandoline and is no longer used, so nuking it to
simplify things.
BUG=none
TEST=covered by tests
R=ben@chromium.org
Review URL: https://codereview.chromium.org/1783993002
Cr-Commit-Position: refs/heads/master@{#380497}
27 files changed, 86 insertions, 277 deletions
diff --git a/components/mus/public/cpp/lib/window.cc b/components/mus/public/cpp/lib/window.cc index 7078784..0fe9dbb 100644 --- a/components/mus/public/cpp/lib/window.cc +++ b/components/mus/public/cpp/lib/window.cc @@ -158,7 +158,7 @@ bool OwnsWindowOrIsRoot(Window* window) { return OwnsWindow(window->connection(), window) || IsConnectionRoot(window); } -void EmptyEmbedCallback(bool result, ConnectionSpecificId connection_id) {} +void EmptyEmbedCallback(bool result) {} } // namespace @@ -410,17 +410,15 @@ void Window::SetCanFocus(bool can_focus) { } void Window::Embed(mus::mojom::WindowTreeClientPtr client) { - Embed(std::move(client), mus::mojom::WindowTree::kAccessPolicyDefault, - base::Bind(&EmptyEmbedCallback)); + Embed(std::move(client), base::Bind(&EmptyEmbedCallback)); } void Window::Embed(mus::mojom::WindowTreeClientPtr client, - uint32_t policy_bitmask, const EmbedCallback& callback) { if (PrepareForEmbed()) - tree_client()->Embed(id_, std::move(client), policy_bitmask, callback); + tree_client()->Embed(id_, std::move(client), callback); else - callback.Run(false, 0); + callback.Run(false); } void Window::RequestClose() { @@ -764,7 +762,7 @@ void Window::NotifyWindowVisibilityChangedUp(Window* target) { } bool Window::PrepareForEmbed() { - if (!OwnsWindow(connection_, this) && !tree_client()->is_embed_root()) + if (!OwnsWindow(connection_, this)) return false; while (!children_.empty()) diff --git a/components/mus/public/cpp/lib/window_tree_client_impl.cc b/components/mus/public/cpp/lib/window_tree_client_impl.cc index 47ea48e..12ffb51 100644 --- a/components/mus/public/cpp/lib/window_tree_client_impl.cc +++ b/components/mus/public/cpp/lib/window_tree_client_impl.cc @@ -123,7 +123,6 @@ WindowTreeClientImpl::WindowTreeClientImpl( focused_window_(nullptr), binding_(this), tree_(nullptr), - is_embed_root_(false), delete_on_no_roots_(true), in_destructor_(false) { // Allow for a null request in tests. @@ -350,10 +349,9 @@ void WindowTreeClientImpl::SetImeVisibility(Id window_id, void WindowTreeClientImpl::Embed( Id window_id, mojom::WindowTreeClientPtr client, - uint32_t policy_bitmask, const mojom::WindowTree::EmbedCallback& callback) { DCHECK(tree_); - tree_->Embed(window_id, std::move(client), policy_bitmask, callback); + tree_->Embed(window_id, std::move(client), callback); } void WindowTreeClientImpl::RequestClose(Window* window) { @@ -484,14 +482,11 @@ Window* WindowTreeClientImpl::NewWindowImpl( void WindowTreeClientImpl::OnEmbedImpl(mojom::WindowTree* window_tree, ConnectionSpecificId connection_id, mojom::WindowDataPtr root_data, - Id focused_window_id, - uint32_t access_policy) { + Id focused_window_id) { // WARNING: this is only called if WindowTreeClientImpl was created as the // result of an embedding. tree_ = window_tree; connection_id_ = connection_id; - is_embed_root_ = - (access_policy & mojom::WindowTree::kAccessPolicyEmbedRoot) != 0; DCHECK(roots_.empty()); Window* root = AddWindowToConnection(this, nullptr, root_data); @@ -537,10 +532,6 @@ Window* WindowTreeClientImpl::NewTopLevelWindow( return NewWindowImpl(NewWindowType::TOP_LEVEL, properties); } -bool WindowTreeClientImpl::IsEmbedRoot() { - return is_embed_root_; -} - ConnectionSpecificId WindowTreeClientImpl::GetConnectionId() { return connection_id_; } @@ -560,8 +551,7 @@ void WindowTreeClientImpl::RemoveObserver( void WindowTreeClientImpl::OnEmbed(ConnectionSpecificId connection_id, mojom::WindowDataPtr root_data, mojom::WindowTreePtr tree, - Id focused_window_id, - uint32_t access_policy) { + Id focused_window_id) { DCHECK(!tree_ptr_); tree_ptr_ = std::move(tree); tree_ptr_.set_connection_error_handler([this]() { delete this; }); @@ -572,7 +562,7 @@ void WindowTreeClientImpl::OnEmbed(ConnectionSpecificId connection_id, } OnEmbedImpl(tree_ptr_.get(), connection_id, std::move(root_data), - focused_window_id, access_policy); + focused_window_id); } void WindowTreeClientImpl::OnEmbeddedAppDisconnected(Id window_id) { diff --git a/components/mus/public/cpp/lib/window_tree_client_impl.h b/components/mus/public/cpp/lib/window_tree_client_impl.h index 5dba11c..df21407 100644 --- a/components/mus/public/cpp/lib/window_tree_client_impl.h +++ b/components/mus/public/cpp/lib/window_tree_client_impl.h @@ -97,7 +97,6 @@ class WindowTreeClientImpl : public WindowTreeConnection, void Embed(Id window_id, mojom::WindowTreeClientPtr client, - uint32_t policy_bitmask, const mojom::WindowTree::EmbedCallback& callback); void RequestClose(Window* window); @@ -118,8 +117,6 @@ class WindowTreeClientImpl : public WindowTreeConnection, bool IsRoot(Window* window) const { return roots_.count(window) > 0; } - bool is_embed_root() const { return is_embed_root_; } - // Called after the window's observers have been notified of destruction (as // the last step of ~Window). void OnWindowDestroyed(Window* window); @@ -159,8 +156,7 @@ class WindowTreeClientImpl : public WindowTreeConnection, void OnEmbedImpl(mojom::WindowTree* window_tree, ConnectionSpecificId connection_id, mojom::WindowDataPtr root_data, - Id focused_window_id, - uint32_t access_policy); + Id focused_window_id); // Overridden from WindowTreeConnection: void SetDeleteOnNoRoots(bool value) override; @@ -170,7 +166,6 @@ class WindowTreeClientImpl : public WindowTreeConnection, Window* NewWindow(const Window::SharedProperties* properties) override; Window* NewTopLevelWindow( const Window::SharedProperties* properties) override; - bool IsEmbedRoot() override; ConnectionSpecificId GetConnectionId() override; void AddObserver(WindowTreeConnectionObserver* observer) override; void RemoveObserver(WindowTreeConnectionObserver* observer) override; @@ -179,8 +174,7 @@ class WindowTreeClientImpl : public WindowTreeConnection, void OnEmbed(ConnectionSpecificId connection_id, mojom::WindowDataPtr root, mojom::WindowTreePtr tree, - Id focused_window_id, - uint32_t access_policy) override; + Id focused_window_id) override; void OnEmbeddedAppDisconnected(Id window_id) override; void OnUnembed(Id window_id) override; void OnLostCapture(Id window_id) override; @@ -283,8 +277,6 @@ class WindowTreeClientImpl : public WindowTreeConnection, // directly set this. mojom::WindowTree* tree_; - bool is_embed_root_; - bool delete_on_no_roots_; bool in_destructor_; diff --git a/components/mus/public/cpp/tests/test_window_tree.cc b/components/mus/public/cpp/tests/test_window_tree.cc index ba9ebed..fa155c8 100644 --- a/components/mus/public/cpp/tests/test_window_tree.cc +++ b/components/mus/public/cpp/tests/test_window_tree.cc @@ -113,7 +113,6 @@ void TestWindowTree::ReleaseCapture(uint32_t change_id, uint32_t window_id) { void TestWindowTree::Embed(uint32_t window_id, mojom::WindowTreeClientPtr client, - uint32_t policy_bitmask, const EmbedCallback& callback) {} void TestWindowTree::SetFocus(uint32_t change_id, uint32_t window_id) { diff --git a/components/mus/public/cpp/tests/test_window_tree.h b/components/mus/public/cpp/tests/test_window_tree.h index 8165c70..8c13166 100644 --- a/components/mus/public/cpp/tests/test_window_tree.h +++ b/components/mus/public/cpp/tests/test_window_tree.h @@ -76,7 +76,6 @@ class TestWindowTree : public mojom::WindowTree { void ReleaseCapture(uint32_t change_id, uint32_t window_id) override; void Embed(uint32_t window_id, mojom::WindowTreeClientPtr client, - uint32_t policy_bitmask, const EmbedCallback& callback) override; void SetFocus(uint32_t change_id, uint32_t window_id) override; void SetCanFocus(uint32_t window_id, bool can_focus) override; diff --git a/components/mus/public/cpp/tests/window_tree_client_impl_unittest.cc b/components/mus/public/cpp/tests/window_tree_client_impl_unittest.cc index 69c498b..a46da1b 100644 --- a/components/mus/public/cpp/tests/window_tree_client_impl_unittest.cc +++ b/components/mus/public/cpp/tests/window_tree_client_impl_unittest.cc @@ -57,7 +57,7 @@ class WindowTreeClientImplPrivate { : tree_client_impl_(tree_client_impl) {} ~WindowTreeClientImplPrivate() {} - void Init(mojom::WindowTree* window_tree, uint32_t access_policy) { + void Init(mojom::WindowTree* window_tree) { mojom::WindowDataPtr root_data(mojom::WindowData::New()); root_data->parent_id = 0; root_data->window_id = 1; @@ -69,8 +69,7 @@ class WindowTreeClientImplPrivate { root_data->viewport_metrics->size_in_pixels = mojo::Size::From(gfx::Size(1000, 1000)); root_data->viewport_metrics->device_pixel_ratio = 1; - tree_client_impl_->OnEmbedImpl(window_tree, 1, std::move(root_data), 0, - access_policy); + tree_client_impl_->OnEmbedImpl(window_tree, 1, std::move(root_data), 0); } private: @@ -82,8 +81,7 @@ class WindowTreeClientImplPrivate { class WindowTreeSetup { public: WindowTreeSetup() : tree_client_(&window_tree_delegate_, nullptr, nullptr) { - WindowTreeClientImplPrivate(&tree_client_) - .Init(&window_tree_, mojom::WindowTree::kAccessPolicyDefault); + WindowTreeClientImplPrivate(&tree_client_).Init(&window_tree_); window_tree_.GetAndClearChangeId(nullptr); } diff --git a/components/mus/public/cpp/window.h b/components/mus/public/cpp/window.h index a04af04..e3bda59 100644 --- a/components/mus/public/cpp/window.h +++ b/components/mus/public/cpp/window.h @@ -52,7 +52,7 @@ struct WindowProperty; class Window { public: using Children = std::vector<Window*>; - using EmbedCallback = base::Callback<void(bool, ConnectionSpecificId)>; + using EmbedCallback = base::Callback<void(bool)>; using PropertyDeallocator = void (*)(int64_t value); using SharedProperties = std::map<std::string, std::vector<uint8_t>>; @@ -208,7 +208,6 @@ class Window { // NOTE: callback is run synchronously if Embed() is not allowed on this // Window. void Embed(mus::mojom::WindowTreeClientPtr client, - uint32_t policy_bitmask, const EmbedCallback& callback); // TODO(sky): this API is only applicable to the WindowManager. Move it diff --git a/components/mus/public/cpp/window_tree_connection.h b/components/mus/public/cpp/window_tree_connection.h index d99eda2..43db0f1 100644 --- a/components/mus/public/cpp/window_tree_connection.h +++ b/components/mus/public/cpp/window_tree_connection.h @@ -85,9 +85,6 @@ class WindowTreeConnection { virtual Window* NewTopLevelWindow( const std::map<std::string, std::vector<uint8_t>>* properties) = 0; - // Returns true if ACCESS_POLICY_EMBED_ROOT was specified. - virtual bool IsEmbedRoot() = 0; - // Returns the id for this connection. // TODO(sky): remove this. It is not necessarily correct anymore. virtual ConnectionSpecificId GetConnectionId() = 0; diff --git a/components/mus/public/interfaces/window_tree.mojom b/components/mus/public/interfaces/window_tree.mojom index 6ad3990..a30bf93 100644 --- a/components/mus/public/interfaces/window_tree.mojom +++ b/components/mus/public/interfaces/window_tree.mojom @@ -69,17 +69,6 @@ enum SurfaceType { // change id in anyway, it is up to the client to assign a value and use it. // Generally the change id is an ever increasing integer. interface WindowTree { - const int32 kAccessPolicyDefault = 0; - - // An embed root has the following abilities: - // . The app sees all the descendants of the window the app is ebmedded at, - // even those from separate connections. - // . The app is able to Embed() in all the descendants of the window the app - // is embedded at, even those from separate connections. - // Only connections originating from the WindowTreeHostFactory can grant - // this policy. - const int32 kAccessPolicyEmbedRoot = 1; - // Creates a new window with the specified id. It is up to the client to // ensure the id is unique to the connection (the id need not be globally // unique). Additionally the connection id (embedded in |window_id|) must @@ -211,9 +200,8 @@ interface WindowTree { // // When a connection embeds a WindowTreeClient the originating connection no // longer has privileges to access or see any of the children of the window. - // If the window had existing children the children are removed. The one - // exception is the root connection and any connections with the policy - // kAccessPolicyEmbedRoot. + // If the window had existing children the children are removed. The + // WindowManager gets to see the whole tree. // // A window may only have one embedding in it at a time. Subsequent calls to // Embed() for the same window result in the currently embedded @@ -224,15 +212,8 @@ interface WindowTree { // The embedder can detect when the embedded app disconnects by way of // OnEmbeddedAppDisconnected(). // - // The callback returns whether the embedding was successful, and if the - // embedding was successful and the originating connection is an embed root - // the resulting id of the new connection. - // - // policy_bitmask is a bitmask of the kAccessPolicy constants. See them for - // details. - Embed(uint32 window_id, - WindowTreeClient client, - uint32 policy_bitmask) => (bool success, uint16 connection_id); + // The callback returns whether the embedding was successful. + Embed(uint32 window_id, WindowTreeClient client) => (bool success); SetFocus(uint32 change_id, uint32 window_id); SetCanFocus(uint32 window_id, bool can_focus); @@ -271,8 +252,7 @@ interface WindowTreeClient { OnEmbed(uint16 connection_id, WindowData root, WindowTree? tree, - uint32 focused_window, - uint32 access_policy); + uint32 focused_window); // Invoked when the application embedded at |window| is disconnected. In other // words the embedded app closes the connection to the server. This is called diff --git a/components/mus/ws/access_policy.h b/components/mus/ws/access_policy.h index 4ce1540..8ba6ff6 100644 --- a/components/mus/ws/access_policy.h +++ b/components/mus/ws/access_policy.h @@ -42,8 +42,7 @@ class AccessPolicy { // descend into |window|. virtual bool CanDescendIntoWindowForWindowTree( const ServerWindow* window) const = 0; - virtual bool CanEmbed(const ServerWindow* window, - uint32_t policy_bitmask) const = 0; + virtual bool CanEmbed(const ServerWindow* window) const = 0; virtual bool CanChangeWindowVisibility(const ServerWindow* window) const = 0; virtual bool CanSetWindowSurface(const ServerWindow* window, mojom::SurfaceType surface_type) const = 0; @@ -69,6 +68,8 @@ class AccessPolicy { // Returns the window to supply to the client when focus changes to |focused|. virtual const ServerWindow* GetWindowForFocusChange( const ServerWindow* focused) = 0; + + virtual bool IsValidIdForNewWindow(const ClientWindowId& id) const = 0; }; } // namespace ws diff --git a/components/mus/ws/access_policy_delegate.h b/components/mus/ws/access_policy_delegate.h index 9b049fb..3e33de5 100644 --- a/components/mus/ws/access_policy_delegate.h +++ b/components/mus/ws/access_policy_delegate.h @@ -30,10 +30,6 @@ class AccessPolicyDelegate { virtual bool IsWindowRootOfAnotherTreeForAccessPolicy( const ServerWindow* window) const = 0; - // Returns true if SetEmbedRoot() was invoked and |window| is a descendant of - // the root of the connection. - virtual bool IsDescendantOfEmbedRoot(const ServerWindow* window) = 0; - protected: virtual ~AccessPolicyDelegate() {} }; diff --git a/components/mus/ws/connection_manager.cc b/components/mus/ws/connection_manager.cc index 2e1dd13..6096d40 100644 --- a/components/mus/ws/connection_manager.cc +++ b/components/mus/ws/connection_manager.cc @@ -68,11 +68,9 @@ ConnectionSpecificId ConnectionManager::GetAndAdvanceNextConnectionId() { WindowTree* ConnectionManager::EmbedAtWindow( ServerWindow* root, - uint32_t policy_bitmask, const UserId& user_id, mojom::WindowTreeClientPtr client) { - scoped_ptr<WindowTree> tree_ptr( - new WindowTree(this, user_id, root, policy_bitmask)); + scoped_ptr<WindowTree> tree_ptr(new WindowTree(this, user_id, root)); WindowTree* tree = tree_ptr.get(); mojom::WindowTreePtr window_tree_ptr; @@ -103,8 +101,7 @@ WindowTree* ConnectionManager::CreateTreeForWindowManager( mojom::DisplayPtr display_ptr = display->ToMojomDisplay(); mojom::WindowTreeClientPtr tree_client; factory->CreateWindowManager(std::move(display_ptr), GetProxy(&tree_client)); - scoped_ptr<WindowTree> tree_ptr(new WindowTree( - this, user_id, root, mojom::WindowTree::kAccessPolicyEmbedRoot)); + scoped_ptr<WindowTree> tree_ptr(new WindowTree(this, user_id, root)); WindowTree* tree = tree_ptr.get(); scoped_ptr<DefaultWindowTreeBinding> binding(new DefaultWindowTreeBinding( tree_ptr.get(), this, std::move(tree_client))); diff --git a/components/mus/ws/connection_manager.h b/components/mus/ws/connection_manager.h index 3fe49874..fc4b185 100644 --- a/components/mus/ws/connection_manager.h +++ b/components/mus/ws/connection_manager.h @@ -70,7 +70,6 @@ class ConnectionManager : public ServerWindowDelegate, // See description of WindowTree::Embed() for details. This assumes // |transport_window_id| is valid. WindowTree* EmbedAtWindow(ServerWindow* root, - uint32_t policy_bitmask, const UserId& user_id, mojom::WindowTreeClientPtr client); diff --git a/components/mus/ws/default_access_policy.cc b/components/mus/ws/default_access_policy.cc index 7c8c062..77e3e8b 100644 --- a/components/mus/ws/default_access_policy.cc +++ b/components/mus/ws/default_access_policy.cc @@ -8,7 +8,6 @@ #include "components/mus/ws/server_window.h" namespace mus { - namespace ws { DefaultAccessPolicy::DefaultAccessPolicy(ConnectionSpecificId connection_id, @@ -70,26 +69,18 @@ bool DefaultAccessPolicy::CanDeleteWindow(const ServerWindow* window) const { bool DefaultAccessPolicy::CanGetWindowTree(const ServerWindow* window) const { return WasCreatedByThisConnection(window) || - delegate_->HasRootForAccessPolicy(window) || - IsDescendantOfEmbedRoot(window); + delegate_->HasRootForAccessPolicy(window); } bool DefaultAccessPolicy::CanDescendIntoWindowForWindowTree( const ServerWindow* window) const { return (WasCreatedByThisConnection(window) && !delegate_->IsWindowRootOfAnotherTreeForAccessPolicy(window)) || - delegate_->HasRootForAccessPolicy(window) || - delegate_->IsDescendantOfEmbedRoot(window); + delegate_->HasRootForAccessPolicy(window); } -bool DefaultAccessPolicy::CanEmbed(const ServerWindow* window, - uint32_t policy_bitmask) const { - if (policy_bitmask != mojom::WindowTree::kAccessPolicyDefault) - return false; - return WasCreatedByThisConnection(window) || - (delegate_->IsWindowKnownForAccessPolicy(window) && - IsDescendantOfEmbedRoot(window) && - !delegate_->HasRootForAccessPolicy(window)); +bool DefaultAccessPolicy::CanEmbed(const ServerWindow* window) const { + return WasCreatedByThisConnection(window); } bool DefaultAccessPolicy::CanChangeWindowVisibility( @@ -153,21 +144,16 @@ bool DefaultAccessPolicy::ShouldNotifyOnHierarchyChange( const ServerWindow* window, const ServerWindow** new_parent, const ServerWindow** old_parent) const { - if (!WasCreatedByThisConnection(window) && !IsDescendantOfEmbedRoot(window) && - (!*new_parent || !IsDescendantOfEmbedRoot(*new_parent)) && - (!*old_parent || !IsDescendantOfEmbedRoot(*old_parent))) { + if (!WasCreatedByThisConnection(window) && !*new_parent && !*old_parent) return false; - } if (*new_parent && !WasCreatedByThisConnection(*new_parent) && - !delegate_->HasRootForAccessPolicy((*new_parent)) && - !delegate_->IsDescendantOfEmbedRoot(*new_parent)) { + !delegate_->HasRootForAccessPolicy((*new_parent))) { *new_parent = nullptr; } if (*old_parent && !WasCreatedByThisConnection(*old_parent) && - !delegate_->HasRootForAccessPolicy((*old_parent)) && - !delegate_->IsDescendantOfEmbedRoot(*new_parent)) { + !delegate_->HasRootForAccessPolicy((*old_parent))) { *old_parent = nullptr; } return true; @@ -190,11 +176,13 @@ bool DefaultAccessPolicy::WasCreatedByThisConnection( return window->id().connection_id == connection_id_; } -bool DefaultAccessPolicy::IsDescendantOfEmbedRoot( - const ServerWindow* window) const { - return delegate_->IsDescendantOfEmbedRoot(window); +bool DefaultAccessPolicy::IsValidIdForNewWindow( + const ClientWindowId& id) const { + // Clients using DefaultAccessPolicy only see windows they have created (for + // the embed point they choose the id), so it's ok for clients to use whatever + // id they want. + return true; } } // namespace ws - } // namespace mus diff --git a/components/mus/ws/default_access_policy.h b/components/mus/ws/default_access_policy.h index af93e78..8c1c5d0 100644 --- a/components/mus/ws/default_access_policy.h +++ b/components/mus/ws/default_access_policy.h @@ -11,7 +11,6 @@ #include "components/mus/ws/access_policy.h" namespace mus { - namespace ws { class AccessPolicyDelegate; @@ -39,8 +38,7 @@ class DefaultAccessPolicy : public AccessPolicy { bool CanGetWindowTree(const ServerWindow* window) const override; bool CanDescendIntoWindowForWindowTree( const ServerWindow* window) const override; - bool CanEmbed(const ServerWindow* window, - uint32_t policy_bitmask) const override; + bool CanEmbed(const ServerWindow* window) const override; bool CanChangeWindowVisibility(const ServerWindow* window) const override; bool CanSetWindowSurface(const ServerWindow* window, mus::mojom::SurfaceType surface_type) const override; @@ -58,10 +56,10 @@ class DefaultAccessPolicy : public AccessPolicy { const ServerWindow* GetWindowForFocusChange( const ServerWindow* focused) override; bool CanSetWindowManager() const override; + bool IsValidIdForNewWindow(const ClientWindowId& id) const override; private: bool WasCreatedByThisConnection(const ServerWindow* window) const; - bool IsDescendantOfEmbedRoot(const ServerWindow* window) const; const ConnectionSpecificId connection_id_; AccessPolicyDelegate* delegate_; @@ -70,7 +68,6 @@ class DefaultAccessPolicy : public AccessPolicy { }; } // namespace ws - } // namespace mus #endif // COMPONENTS_MUS_WS_DEFAULT_ACCESS_POLICY_H_ diff --git a/components/mus/ws/display_binding.cc b/components/mus/ws/display_binding.cc index 4ccb390..31ce695 100644 --- a/components/mus/ws/display_binding.cc +++ b/components/mus/ws/display_binding.cc @@ -25,9 +25,8 @@ DisplayBindingImpl::DisplayBindingImpl(mojom::WindowTreeHostRequest request, DisplayBindingImpl::~DisplayBindingImpl() {} WindowTree* DisplayBindingImpl::CreateWindowTree(ServerWindow* root) { - WindowTree* tree = connection_manager_->EmbedAtWindow( - root, mojom::WindowTree::kAccessPolicyEmbedRoot, user_id_, - std::move(client_)); + WindowTree* tree = + connection_manager_->EmbedAtWindow(root, user_id_, std::move(client_)); tree->ConfigureWindowManager(); return tree; } diff --git a/components/mus/ws/test_utils.cc b/components/mus/ws/test_utils.cc index 2cb7491..1418c27 100644 --- a/components/mus/ws/test_utils.cc +++ b/components/mus/ws/test_utils.cc @@ -126,8 +126,7 @@ void TestWindowTreeClient::Bind( void TestWindowTreeClient::OnEmbed(uint16_t connection_id, mojom::WindowDataPtr root, mus::mojom::WindowTreePtr tree, - Id focused_window_id, - uint32_t access_policy) { + Id focused_window_id) { // TODO(sky): add test coverage of |focused_window_id|. tracker_.OnEmbed(connection_id, std::move(root)); } diff --git a/components/mus/ws/test_utils.h b/components/mus/ws/test_utils.h index f8d615d..31826d9 100644 --- a/components/mus/ws/test_utils.h +++ b/components/mus/ws/test_utils.h @@ -168,8 +168,7 @@ class TestWindowTreeClient : public mus::mojom::WindowTreeClient { void OnEmbed(uint16_t connection_id, mojom::WindowDataPtr root, mus::mojom::WindowTreePtr tree, - Id focused_window_id, - uint32_t access_policy) override; + Id focused_window_id) override; void OnEmbeddedAppDisconnected(uint32_t window) override; void OnUnembed(Id window_id) override; void OnLostCapture(Id window_id) override; diff --git a/components/mus/ws/window_manager_access_policy.cc b/components/mus/ws/window_manager_access_policy.cc index d8be6ac..16a215b 100644 --- a/components/mus/ws/window_manager_access_policy.cc +++ b/components/mus/ws/window_manager_access_policy.cc @@ -8,7 +8,6 @@ #include "components/mus/ws/server_window.h" namespace mus { - namespace ws { // TODO(sky): document why this differs from default for each case. Maybe want @@ -69,8 +68,7 @@ bool WindowManagerAccessPolicy::CanDescendIntoWindowForWindowTree( return true; } -bool WindowManagerAccessPolicy::CanEmbed(const ServerWindow* window, - uint32_t policy_bitmask) const { +bool WindowManagerAccessPolicy::CanEmbed(const ServerWindow* window) const { return !delegate_->HasRootForAccessPolicy(window); } @@ -157,6 +155,14 @@ bool WindowManagerAccessPolicy::IsWindowKnown( return delegate_->IsWindowKnownForAccessPolicy(window); } -} // namespace ws +bool WindowManagerAccessPolicy::IsValidIdForNewWindow( + const ClientWindowId& id) const { + // The WindowManager see windows created from other clients. If the WM doesn't + // use the connection id when creating windows the WM could end up with two + // windows with the same id. Because of this the wm must use the same + // connection id for all windows it creates. + return WindowIdFromTransportId(id.id).connection_id == connection_id_; +} +} // namespace ws } // namespace mus diff --git a/components/mus/ws/window_manager_access_policy.h b/components/mus/ws/window_manager_access_policy.h index 67f0e73..7cb062e 100644 --- a/components/mus/ws/window_manager_access_policy.h +++ b/components/mus/ws/window_manager_access_policy.h @@ -11,7 +11,6 @@ #include "components/mus/ws/access_policy.h" namespace mus { - namespace ws { class AccessPolicyDelegate; @@ -38,8 +37,7 @@ class WindowManagerAccessPolicy : public AccessPolicy { bool CanGetWindowTree(const ServerWindow* window) const override; bool CanDescendIntoWindowForWindowTree( const ServerWindow* window) const override; - bool CanEmbed(const ServerWindow* window, - uint32_t policy_bitmask) const override; + bool CanEmbed(const ServerWindow* window) const override; bool CanChangeWindowVisibility(const ServerWindow* window) const override; bool CanSetWindowSurface(const ServerWindow* window, mus::mojom::SurfaceType surface_type) const override; @@ -57,6 +55,7 @@ class WindowManagerAccessPolicy : public AccessPolicy { const ServerWindow* GetWindowForFocusChange( const ServerWindow* focused) override; bool CanSetWindowManager() const override; + bool IsValidIdForNewWindow(const ClientWindowId& id) const override; private: bool IsWindowKnown(const ServerWindow* window) const; @@ -68,7 +67,6 @@ class WindowManagerAccessPolicy : public AccessPolicy { }; } // namespace ws - } // namespace mus #endif // COMPONENTS_MUS_WS_WINDOW_MANAGER_ACCESS_POLICY_H_ diff --git a/components/mus/ws/window_manager_client_unittest.cc b/components/mus/ws/window_manager_client_unittest.cc index 33623de..31c5a11 100644 --- a/components/mus/ws/window_manager_client_unittest.cc +++ b/components/mus/ws/window_manager_client_unittest.cc @@ -251,14 +251,9 @@ class WindowServerTest : public WindowServerTestBase { // a response is received, or a timeout. On success the new WindowServer is // returned. EmbedResult Embed(Window* window) { - return Embed(window, mus::mojom::WindowTree::kAccessPolicyDefault); - } - - EmbedResult Embed(Window* window, uint32_t access_policy_bitmask) { DCHECK(!embed_details_); embed_details_.reset(new EmbedDetails); window->Embed(ConnectAndGetWindowServerClient(), - access_policy_bitmask, base::Bind(&WindowServerTest::EmbedCallbackImpl, base::Unretained(this))); embed_details_->waiting = true; @@ -297,7 +292,6 @@ class WindowServerTest : public WindowServerTestBase { : callback_run(false), result(false), waiting(false), - connection_id(0), connection(nullptr) {} // The callback supplied to Embed() was received. @@ -317,10 +311,9 @@ class WindowServerTest : public WindowServerTestBase { WindowTreeConnection* connection; }; - void EmbedCallbackImpl(bool result, ConnectionSpecificId connection_id) { + void EmbedCallbackImpl(bool result) { embed_details_->callback_run = true; embed_details_->result = result; - embed_details_->connection_id = connection_id; if (embed_details_->waiting && (!result || embed_details_->connection)) EXPECT_TRUE(WindowServerTestBase::QuitRunLoop()); } @@ -1034,68 +1027,6 @@ TEST_F(WindowServerTest, WindowServerDestroyedAfterRootObserver) { EXPECT_TRUE(got_destroy); } -// Verifies an embed root sees windows created beneath it from another -// connection. -TEST_F(WindowServerTest, EmbedRootSeesHierarchyChanged) { - Window* embed_window = window_manager()->NewWindow(); - GetFirstWMRoot()->AddChild(embed_window); - - WindowTreeConnection* vm2 = - Embed(embed_window, mus::mojom::WindowTree::kAccessPolicyEmbedRoot) - .connection; - Window* vm2_v1 = vm2->NewWindow(); - GetFirstRoot(vm2)->AddChild(vm2_v1); - - WindowTreeConnection* vm3 = Embed(vm2_v1).connection; - Window* vm3_v1 = vm3->NewWindow(); - GetFirstRoot(vm3)->AddChild(vm3_v1); - - // As |vm2| is an embed root it should get notified about |vm3_v1|. - ASSERT_TRUE(WaitForTreeSizeToMatch(vm2_v1, 2)); -} - -// Flaky failure: http://crbug.com/587868 -#if defined(OS_LINUX) -#define MAYBE_EmbedFromEmbedRoot DISABLED_EmbedFromEmbedRoot -#else -#define MAYBE_EmbedFromEmbedRoot EmbedFromEmbedRoot -#endif -TEST_F(WindowServerTest, MAYBE_EmbedFromEmbedRoot) { - Window* embed_window = window_manager()->NewWindow(); - GetFirstWMRoot()->AddChild(embed_window); - - // Give the connection embedded at |embed_window| embed root powers. - const EmbedResult result1 = - Embed(embed_window, mus::mojom::WindowTree::kAccessPolicyEmbedRoot); - WindowTreeConnection* vm2 = result1.connection; - EXPECT_EQ(result1.connection_id, vm2->GetConnectionId()); - Window* vm2_v1 = vm2->NewWindow(); - GetFirstRoot(vm2)->AddChild(vm2_v1); - - const EmbedResult result2 = Embed(vm2_v1); - WindowTreeConnection* vm3 = result2.connection; - EXPECT_EQ(result2.connection_id, vm3->GetConnectionId()); - Window* vm3_v1 = vm3->NewWindow(); - GetFirstRoot(vm3)->AddChild(vm3_v1); - - // Embed from v3, the callback should not get the connection id as vm3 is not - // an embed root. - const EmbedResult result3 = Embed(vm3_v1); - ASSERT_TRUE(result3.connection); - EXPECT_EQ(0, result3.connection_id); - - // As |vm2| is an embed root it should get notified about |vm3_v1|. - ASSERT_TRUE(WaitForTreeSizeToMatch(vm2_v1, 2)); - - // Embed() from vm2 in vm3_v1. This is allowed as vm2 is an embed root, and - // further the callback should see the connection id. - ASSERT_EQ(1u, vm2_v1->children().size()); - Window* vm3_v1_in_vm2 = vm2_v1->children()[0]; - const EmbedResult result4 = Embed(vm3_v1_in_vm2); - ASSERT_TRUE(result4.connection); - EXPECT_EQ(result4.connection_id, result4.connection->GetConnectionId()); -} - TEST_F(WindowServerTest, ClientAreaChanged) { Window* embed_window = window_manager()->NewWindow(); GetFirstWMRoot()->AddChild(embed_window); diff --git a/components/mus/ws/window_tree.cc b/components/mus/ws/window_tree.cc index cf7179e..58c0f28 100644 --- a/components/mus/ws/window_tree.cc +++ b/components/mus/ws/window_tree.cc @@ -67,25 +67,20 @@ class TargetedEvent : public ServerWindowObserver { WindowTree::WindowTree(ConnectionManager* connection_manager, const UserId& user_id, - ServerWindow* root, - uint32_t policy_bitmask) + ServerWindow* root) : connection_manager_(connection_manager), user_id_(user_id), id_(connection_manager_->GetAndAdvanceNextConnectionId()), next_window_id_(1), event_ack_id_(0), - is_embed_root_(false), window_manager_internal_(nullptr) { if (root) roots_.insert(root); // TODO(sky): pass in type rather than inferring it. - if (root && root->id().connection_id == kInvalidConnectionId) { + if (root && root->id().connection_id == kInvalidConnectionId) access_policy_.reset(new WindowManagerAccessPolicy(id_, this)); - is_embed_root_ = true; - } else { + else access_policy_.reset(new DefaultAccessPolicy(id_, this)); - is_embed_root_ = (policy_bitmask & WindowTree::kAccessPolicyEmbedRoot) != 0; - } } WindowTree::~WindowTree() { @@ -114,9 +109,7 @@ void WindowTree::Init(scoped_ptr<WindowTreeBinding> binding, IsWindowKnown(focused_window, &focused_window_id); client()->OnEmbed(id_, WindowToWindowData(to_send.front()), std::move(tree), - focused_window_id.id, - is_embed_root_ ? WindowTree::kAccessPolicyEmbedRoot - : WindowTree::kAccessPolicyDefault); + focused_window_id.id); } void WindowTree::ConfigureWindowManager() { @@ -175,7 +168,7 @@ 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))) { + if (owns_tree_root) { client()->OnEmbeddedAppDisconnected( ClientWindowIdForWindow(tree_root).id); } @@ -279,20 +272,15 @@ bool WindowTree::SetWindowVisibility(const ClientWindowId& window_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)) + mojom::WindowTreeClientPtr client) { + if (!client || !CanEmbed(window_id)) return false; ServerWindow* window = GetWindowByClientId(window_id); PrepareForEmbed(window); // When embedding we don't know the user id of where the TreeClient came // from. Use an invalid id, which limits what the client is able to do. - WindowTree* new_tree = connection_manager_->EmbedAtWindow( - window, policy_bitmask, InvalidUserId(), std::move(client)); - if (is_embed_root_) - *connection_id = new_tree->id(); + connection_manager_->EmbedAtWindow(window, InvalidUserId(), + std::move(client)); return true; } @@ -670,14 +658,8 @@ ClientWindowId WindowTree::ClientWindowIdForWindow( } 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 - // two windows with the same id. Because of this we restrict the ids such - // connections can create. - return false; - } - return client_id_to_window_id_map_.count(id) == 0u; + return client_id_to_window_id_map_.count(id) == 0u && + access_policy_->IsValidIdForNewWindow(id); } WindowId WindowTree::GenerateNewWindowId() { @@ -877,10 +859,9 @@ void WindowTree::DestroyWindows() { STLDeleteValues(&created_window_map_copy); } -bool WindowTree::CanEmbed(const ClientWindowId& window_id, - uint32_t policy_bitmask) const { +bool WindowTree::CanEmbed(const ClientWindowId& window_id) const { const ServerWindow* window = GetWindowByClientId(window_id); - return window && access_policy_->CanEmbed(window, policy_bitmask); + return window && access_policy_->CanEmbed(window); } void WindowTree::PrepareForEmbed(ServerWindow* window) { @@ -1221,12 +1202,8 @@ void WindowTree::SetClientArea( 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); + callback.Run(Embed(ClientWindowId(transport_window_id), std::move(client))); } void WindowTree::SetFocus(uint32_t change_id, Id transport_window_id) { @@ -1394,16 +1371,5 @@ bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy( return tree && tree != this; } -bool WindowTree::IsDescendantOfEmbedRoot(const ServerWindow* window) { - if (!is_embed_root_) - return false; - - for (const auto* root : roots_) { - if (root->Contains(window)) - return true; - } - return false; -} - } // namespace ws } // namespace mus diff --git a/components/mus/ws/window_tree.h b/components/mus/ws/window_tree.h index 4810bd4..c4c5055 100644 --- a/components/mus/ws/window_tree.h +++ b/components/mus/ws/window_tree.h @@ -60,8 +60,7 @@ class WindowTree : public mojom::WindowTree, public: WindowTree(ConnectionManager* connection_manager, const UserId& user_id, - ServerWindow* root, - uint32_t policy_bitmask); + ServerWindow* root); ~WindowTree() override; void Init(scoped_ptr<WindowTreeBinding> binding, mojom::WindowTreePtr tree); @@ -105,8 +104,6 @@ class WindowTree : public mojom::WindowTree, std::set<const ServerWindow*> roots() { return roots_; } - bool is_embed_root() const { return is_embed_root_; } - const Display* GetDisplay(const ServerWindow* window) const; Display* GetDisplay(const ServerWindow* window) { return const_cast<Display*>( @@ -137,9 +134,7 @@ class WindowTree : public mojom::WindowTree, const ClientWindowId& window_id) const; bool SetWindowVisibility(const ClientWindowId& window_id, bool visible); bool Embed(const ClientWindowId& window_id, - mojom::WindowTreeClientPtr client, - uint32_t policy_bitmask, - ConnectionSpecificId* connection_id); + mojom::WindowTreeClientPtr client); void DispatchInputEvent(ServerWindow* target, mojom::EventPtr event); bool IsWaitingForNewTopLevelWindow(uint32_t wm_change_id); @@ -290,7 +285,7 @@ class WindowTree : public mojom::WindowTree, // Deletes all Windows we own. void DestroyWindows(); - bool CanEmbed(const ClientWindowId& window_id, uint32_t policy_bitmask) const; + bool CanEmbed(const ClientWindowId& window_id) const; void PrepareForEmbed(ServerWindow* window); void RemoveChildrenAsPartOfEmbed(ServerWindow* window); @@ -344,7 +339,6 @@ class WindowTree : public mojom::WindowTree, mojom::SurfaceClientPtr client) override; void Embed(Id transport_window_id, mojom::WindowTreeClientPtr client, - uint32_t policy_bitmask, const EmbedCallback& callback) override; void SetFocus(uint32_t change_id, Id transport_window_id) override; void SetCanFocus(Id transport_window_id, bool can_focus) override; @@ -390,7 +384,6 @@ class WindowTree : public mojom::WindowTree, bool IsWindowKnownForAccessPolicy(const ServerWindow* window) const override; bool IsWindowRootOfAnotherTreeForAccessPolicy( const ServerWindow* window) const override; - bool IsDescendantOfEmbedRoot(const ServerWindow* window) override; ConnectionManager* connection_manager_; @@ -423,8 +416,6 @@ class WindowTree : public mojom::WindowTree, // WindowManager the current event came from. WindowManagerState* event_source_wms_ = nullptr; - bool is_embed_root_; - std::queue<scoped_ptr<TargetedEvent>> event_queue_; scoped_ptr<mojo::AssociatedBinding<mojom::WindowManagerClient>> diff --git a/components/mus/ws/window_tree_client_unittest.cc b/components/mus/ws/window_tree_client_unittest.cc index 7401a9a..f98da25 100644 --- a/components/mus/ws/window_tree_client_unittest.cc +++ b/components/mus/ws/window_tree_client_unittest.cc @@ -75,7 +75,6 @@ bool EmbedUrl(mojo::Connector* connector, mojom::WindowTreeClientPtr client; connector->ConnectToInterface(url.get(), &client); tree->Embed(root_id, std::move(client), - mojom::WindowTree::kAccessPolicyDefault, base::Bind(&EmbedCallbackImpl, &run_loop, &result)); } run_loop.Run(); @@ -87,7 +86,6 @@ bool Embed(WindowTree* tree, Id root_id, mojom::WindowTreeClientPtr client) { base::RunLoop run_loop; { tree->Embed(root_id, std::move(client), - mojom::WindowTree::kAccessPolicyDefault, base::Bind(&EmbedCallbackImpl, &run_loop, &result)); } run_loop.Run(); @@ -540,8 +538,8 @@ class WindowTreeClientTest : public WindowServerShellTestBase { WindowTree* owner, Id root_id, int* connection_id) { - return EstablishConnectionViaEmbedWithPolicyBitmask( - owner, root_id, mojom::WindowTree::kAccessPolicyDefault, connection_id); + return EstablishConnectionViaEmbedWithPolicyBitmask(owner, root_id, + connection_id); } scoped_ptr<TestWindowTreeClientImpl> @@ -1768,8 +1766,8 @@ TEST_F(WindowTreeClientTest, CantEmbedFromConnectionRoot) { ASSERT_TRUE( 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); + wt_client3_ = + EstablishConnectionViaEmbedWithPolicyBitmask(wt1(), window_1_2, 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 diff --git a/components/mus/ws/window_tree_factory.cc b/components/mus/ws/window_tree_factory.cc index 56654ce..e805ab6 100644 --- a/components/mus/ws/window_tree_factory.cc +++ b/components/mus/ws/window_tree_factory.cc @@ -26,8 +26,7 @@ void WindowTreeFactory::CreateWindowTree( mojo::InterfaceRequest<mojom::WindowTree> tree_request, mojom::WindowTreeClientPtr client) { scoped_ptr<ws::WindowTree> service( - new ws::WindowTree(connection_manager_, user_id_, nullptr, - mojom::WindowTree::kAccessPolicyDefault)); + new ws::WindowTree(connection_manager_, user_id_, nullptr)); scoped_ptr<ws::DefaultWindowTreeBinding> binding( new ws::DefaultWindowTreeBinding(service.get(), connection_manager_, std::move(tree_request), diff --git a/components/mus/ws/window_tree_unittest.cc b/components/mus/ws/window_tree_unittest.cc index ce37fe7..bd55e09 100644 --- a/components/mus/ws/window_tree_unittest.cc +++ b/components/mus/ws/window_tree_unittest.cc @@ -106,8 +106,8 @@ class TestDisplayBinding : public DisplayBinding { // DisplayBinding: WindowTree* CreateWindowTree(ServerWindow* root) override { return connection_manager_->EmbedAtWindow( - root, mus::mojom::WindowTree::kAccessPolicyEmbedRoot, - mojo::shell::mojom::kRootUserID, mus::mojom::WindowTreeClientPtr()); + root, mojo::shell::mojom::kRootUserID, + mus::mojom::WindowTreeClientPtr()); } Display* display_; @@ -224,8 +224,7 @@ class WindowTreeTest : public testing::Test { WindowTree* CreateNewTree(const UserId& user_id, TestWindowTreeBinding** binding) { WindowTree* tree = - new WindowTree(connection_manager_.get(), user_id, nullptr, - mojom::WindowTree::kAccessPolicyDefault); + new WindowTree(connection_manager_.get(), user_id, nullptr); *binding = new TestWindowTreeBinding; connection_manager_->AddTree(make_scoped_ptr(tree), make_scoped_ptr(*binding), nullptr); @@ -278,9 +277,7 @@ void WindowTreeTest::SetupEventTargeting(TestWindowTreeClient** out_client, mojom::WindowTreeClientPtr client; mojom::WindowTreeClientRequest client_request = GetProxy(&client); wm_client()->Bind(std::move(client_request)); - ConnectionSpecificId connection_id = 0; - wm_tree()->Embed(embed_window_id, std::move(client), - mojom::WindowTree::kAccessPolicyDefault, &connection_id); + wm_tree()->Embed(embed_window_id, std::move(client)); ServerWindow* embed_window = wm_tree()->GetWindowByClientId(embed_window_id); WindowTree* tree1 = connection_manager()->GetTreeWithRoot(embed_window); ASSERT_TRUE(tree1 != nullptr); @@ -324,9 +321,7 @@ TEST_F(WindowTreeTest, FocusOnPointer) { mojom::WindowTreeClientPtr client; mojom::WindowTreeClientRequest client_request = GetProxy(&client); wm_client()->Bind(std::move(client_request)); - ConnectionSpecificId connection_id = 0; - wm_tree()->Embed(embed_window_id, std::move(client), - mojom::WindowTree::kAccessPolicyDefault, &connection_id); + wm_tree()->Embed(embed_window_id, std::move(client)); WindowTree* tree1 = connection_manager()->GetTreeWithRoot(embed_window); ASSERT_TRUE(tree1 != nullptr); ASSERT_NE(tree1, wm_tree()); diff --git a/mash/wm/window_manager_apptest.cc b/mash/wm/window_manager_apptest.cc index 7ea0a25..605b825 100644 --- a/mash/wm/window_manager_apptest.cc +++ b/mash/wm/window_manager_apptest.cc @@ -31,7 +31,7 @@ class WindowTreeDelegateImpl : public mus::WindowTreeDelegate { using WindowManagerAppTest = mojo::test::ApplicationTestBase; -void OnEmbed(bool success, uint16_t id) { +void OnEmbed(bool success) { ASSERT_TRUE(success); } @@ -55,9 +55,7 @@ TEST_F(WindowManagerAppTest, OpenWindow) { // |child_window|. This blocks until it succeeds. mus::mojom::WindowTreeClientPtr tree_client; auto tree_client_request = GetProxy(&tree_client); - child_window->Embed(std::move(tree_client), - mus::mojom::WindowTree::kAccessPolicyDefault, - base::Bind(&OnEmbed)); + child_window->Embed(std::move(tree_client), base::Bind(&OnEmbed)); scoped_ptr<mus::WindowTreeConnection> child_connection( mus::WindowTreeConnection::Create( &window_tree_delegate, std::move(tree_client_request), |