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

Side by Side Diff: components/mus/ws/client_connection.h

Issue 1764483003: Changes ownership of ClientConnection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « components/mus/mus_app.cc ('k') | components/mus/ws/client_connection.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_MUS_WS_CLIENT_CONNECTION_H_ 5 #ifndef COMPONENTS_MUS_WS_CLIENT_CONNECTION_H_
6 #define COMPONENTS_MUS_WS_CLIENT_CONNECTION_H_ 6 #define COMPONENTS_MUS_WS_CLIENT_CONNECTION_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "components/mus/public/interfaces/window_tree.mojom.h" 10 #include "components/mus/public/interfaces/window_tree.mojom.h"
11 #include "mojo/public/cpp/bindings/binding.h" 11 #include "mojo/public/cpp/bindings/binding.h"
12 12
13 namespace mus { 13 namespace mus {
14 namespace ws { 14 namespace ws {
15 15
16 class ConnectionManager; 16 class ConnectionManager;
17 class WindowTreeImpl; 17 class WindowTreeImpl;
18 18
19 // ClientConnection encapsulates the state needed for a single client connected 19 // ClientConnection encapsulates the state needed for a single client connected
20 // to the window manager. 20 // to the window manager. ClientConnection is owned by the WindowTreeImpl the
21 // ClientConnection is associated with.
21 class ClientConnection { 22 class ClientConnection {
22 public: 23 public:
23 ClientConnection(scoped_ptr<WindowTreeImpl> service, 24 explicit ClientConnection(mojom::WindowTreeClient* client);
24 mojom::WindowTreeClient* client);
25 virtual ~ClientConnection(); 25 virtual ~ClientConnection();
26 26
27 WindowTreeImpl* service() { return service_.get(); }
28 const WindowTreeImpl* service() const { return service_.get(); }
29
30 mojom::WindowTreeClient* client() { return client_; } 27 mojom::WindowTreeClient* client() { return client_; }
31 28
29 // Obtains a new WindowManager. This should only be called once.
32 virtual mojom::WindowManager* GetWindowManager() = 0; 30 virtual mojom::WindowManager* GetWindowManager() = 0;
33 31
34 virtual void SetIncomingMethodCallProcessingPaused(bool paused) = 0; 32 virtual void SetIncomingMethodCallProcessingPaused(bool paused) = 0;
35 33
36 private: 34 private:
37 scoped_ptr<WindowTreeImpl> service_;
38 mojom::WindowTreeClient* client_; 35 mojom::WindowTreeClient* client_;
39 36
40 DISALLOW_COPY_AND_ASSIGN(ClientConnection); 37 DISALLOW_COPY_AND_ASSIGN(ClientConnection);
41 }; 38 };
42 39
43 // Bindings implementation of ClientConnection. 40 // Bindings implementation of ClientConnection.
44 class DefaultClientConnection : public ClientConnection { 41 class DefaultClientConnection : public ClientConnection {
45 public: 42 public:
46 DefaultClientConnection(scoped_ptr<WindowTreeImpl> service_impl, 43 DefaultClientConnection(WindowTreeImpl* tree,
47 ConnectionManager* connection_manager, 44 ConnectionManager* connection_manager,
48 mojom::WindowTreeRequest service_request, 45 mojom::WindowTreeRequest service_request,
49 mojom::WindowTreeClientPtr client); 46 mojom::WindowTreeClientPtr client);
50 DefaultClientConnection(scoped_ptr<WindowTreeImpl> service_impl, 47 DefaultClientConnection(WindowTreeImpl* tree,
51 ConnectionManager* connection_manager, 48 ConnectionManager* connection_manager,
52 mojom::WindowTreeClientPtr client); 49 mojom::WindowTreeClientPtr client);
53 ~DefaultClientConnection() override; 50 ~DefaultClientConnection() override;
54 51
55 // Use when created with the constructor that does not take a 52 // Use when created with the constructor that does not take a
56 // WindowTreeRequest. 53 // WindowTreeRequest.
57 mojom::WindowTreePtr CreateInterfacePtrAndBind(); 54 mojom::WindowTreePtr CreateInterfacePtrAndBind();
58 55
59 // ClientConnection: 56 // ClientConnection:
60 mojom::WindowManager* GetWindowManager() override; 57 mojom::WindowManager* GetWindowManager() override;
61 void SetIncomingMethodCallProcessingPaused(bool paused) override; 58 void SetIncomingMethodCallProcessingPaused(bool paused) override;
62 59
63 private: 60 private:
64 ConnectionManager* connection_manager_; 61 ConnectionManager* connection_manager_;
65 mojo::Binding<mojom::WindowTree> binding_; 62 mojo::Binding<mojom::WindowTree> binding_;
66 mojom::WindowTreeClientPtr client_; 63 mojom::WindowTreeClientPtr client_;
67 mojom::WindowManagerAssociatedPtr window_manager_internal_; 64 mojom::WindowManagerAssociatedPtr window_manager_internal_;
68 65
69 DISALLOW_COPY_AND_ASSIGN(DefaultClientConnection); 66 DISALLOW_COPY_AND_ASSIGN(DefaultClientConnection);
70 }; 67 };
71 68
72 } // namespace ws 69 } // namespace ws
73 } // namespace mus 70 } // namespace mus
74 71
75 #endif // COMPONENTS_MUS_WS_CLIENT_CONNECTION_H_ 72 #endif // COMPONENTS_MUS_WS_CLIENT_CONNECTION_H_
OLDNEW
« no previous file with comments | « components/mus/mus_app.cc ('k') | components/mus/ws/client_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698