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

Unified Diff: components/mus/ws/window_tree_host_connection.h

Issue 1750143002: Changes ownership of WindowTreeHostConnection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/mus/ws/connection_manager.cc ('k') | components/mus/ws/window_tree_host_connection.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/ws/window_tree_host_connection.h
diff --git a/components/mus/ws/window_tree_host_connection.h b/components/mus/ws/window_tree_host_connection.h
index 452a5f0683f7a76f02d66c3d4ca8a8666f758c05..da5dc7dbeb145ad67210e9530c1e15e58da7b700 100644
--- a/components/mus/ws/window_tree_host_connection.h
+++ b/components/mus/ws/window_tree_host_connection.h
@@ -8,56 +8,26 @@
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "components/mus/public/interfaces/window_tree_host.mojom.h"
-#include "components/mus/ws/window_tree_host_delegate.h"
#include "components/mus/ws/window_tree_host_impl.h"
#include "mojo/public/cpp/bindings/binding.h"
namespace mus {
-
namespace ws {
class ConnectionManager;
+class ServerWindow;
class WindowTreeImpl;
-// WindowTreeHostConnection is a server-side object that encapsulates the
-// connection between a client of the WindowTreeHost and its implementation.
-// WindowTreeHostConnection also establishes a ClientConnection via the same
-// code path as embedded windows. ConnectionManager manages the lifetime of
-// WindowTreeHostConnections. If a connection to the client is lost or if the
-// associated root is closed, the WindowTreeHostConnection will inform the
-// ConnectionManager to destroy the root and its associated window tree.
-class WindowTreeHostConnection : public WindowTreeHostDelegate {
+// WindowTreeHostConnection encapsulates the connection between a client of the
+// WindowTreeHost and its implementation. Additionally WindowTreeHostConnection
+// is able to create the WindowTree that is bound to the root.
+//
+// WindowTreeHostConnection is owned by WindowTreeHostImpl.
+class WindowTreeHostConnection {
public:
- WindowTreeHostConnection(scoped_ptr<WindowTreeHostImpl> host_impl,
- ConnectionManager* connection_manager);
-
- void set_window_tree(WindowTreeImpl* tree) { tree_ = tree; }
-
- WindowTreeHostImpl* window_tree_host() { return host_.get(); }
- const WindowTreeHostImpl* window_tree_host() const { return host_.get(); }
-
- ConnectionManager* connection_manager() { return connection_manager_; }
- const ConnectionManager* connection_manager() const {
- return connection_manager_;
- }
+ virtual ~WindowTreeHostConnection() {}
- void CloseConnection();
-
- protected:
- ~WindowTreeHostConnection() override;
-
- // WindowTreeHostDelegate:
- void OnDisplayInitialized() override;
- void OnDisplayClosed() override;
- const WindowTreeImpl* GetWindowTree() const override;
-
- private:
- scoped_ptr<WindowTreeHostImpl> host_;
- WindowTreeImpl* tree_;
- ConnectionManager* connection_manager_;
- bool connection_closed_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowTreeHostConnection);
+ virtual WindowTreeImpl* CreateWindowTree(ServerWindow* root) = 0;
};
// Live implementation of WindowTreeHostConnection.
@@ -65,16 +35,16 @@ class WindowTreeHostConnectionImpl : public WindowTreeHostConnection {
public:
WindowTreeHostConnectionImpl(
mojo::InterfaceRequest<mojom::WindowTreeHost> request,
- scoped_ptr<WindowTreeHostImpl> host_impl,
+ WindowTreeHostImpl* host_impl,
mojom::WindowTreeClientPtr client,
ConnectionManager* connection_manager);
-
- private:
~WindowTreeHostConnectionImpl() override;
- // WindowTreeHostDelegate:
- void OnDisplayInitialized() override;
+ private:
+ // WindowTreeHostConnection:
+ WindowTreeImpl* CreateWindowTree(ServerWindow* root) override;
+ ConnectionManager* connection_manager_;
mojo::Binding<mojom::WindowTreeHost> binding_;
mojom::WindowTreeClientPtr client_;
@@ -82,7 +52,6 @@ class WindowTreeHostConnectionImpl : public WindowTreeHostConnection {
};
} // namespace ws
-
} // namespace mus
#endif // COMPONENTS_MUS_WS_WINDOW_TREE_HOST_CONNECTION_H_
« no previous file with comments | « components/mus/ws/connection_manager.cc ('k') | components/mus/ws/window_tree_host_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698