| OLD | NEW |
| 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_VIEW_MANAGER_CLIENT_CONNECTION_H_ | 5 #ifndef COMPONENTS_VIEW_MANAGER_CLIENT_CONNECTION_H_ |
| 6 #define COMPONENTS_VIEW_MANAGER_CLIENT_CONNECTION_H_ | 6 #define COMPONENTS_VIEW_MANAGER_CLIENT_CONNECTION_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "components/view_manager/public/interfaces/view_manager.mojom.h" | 9 #include "components/view_manager/public/interfaces/view_tree.mojom.h" |
| 10 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" | 10 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" |
| 11 | 11 |
| 12 namespace view_manager { | 12 namespace view_manager { |
| 13 | 13 |
| 14 class ConnectionManager; | 14 class ConnectionManager; |
| 15 class ViewManagerServiceImpl; | 15 class ViewTreeImpl; |
| 16 | 16 |
| 17 // ClientConnection encapsulates the state needed for a single client connected | 17 // ClientConnection encapsulates the state needed for a single client connected |
| 18 // to the view manager. | 18 // to the view manager. |
| 19 class ClientConnection { | 19 class ClientConnection { |
| 20 public: | 20 public: |
| 21 ClientConnection(scoped_ptr<ViewManagerServiceImpl> service, | 21 ClientConnection(scoped_ptr<ViewTreeImpl> service, |
| 22 mojo::ViewManagerClient* client); | 22 mojo::ViewTreeClient* client); |
| 23 virtual ~ClientConnection(); | 23 virtual ~ClientConnection(); |
| 24 | 24 |
| 25 ViewManagerServiceImpl* service() { return service_.get(); } | 25 ViewTreeImpl* service() { return service_.get(); } |
| 26 const ViewManagerServiceImpl* service() const { return service_.get(); } | 26 const ViewTreeImpl* service() const { return service_.get(); } |
| 27 | 27 |
| 28 mojo::ViewManagerClient* client() { return client_; } | 28 mojo::ViewTreeClient* client() { return client_; } |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 scoped_ptr<ViewManagerServiceImpl> service_; | 31 scoped_ptr<ViewTreeImpl> service_; |
| 32 mojo::ViewManagerClient* client_; | 32 mojo::ViewTreeClient* client_; |
| 33 | 33 |
| 34 DISALLOW_COPY_AND_ASSIGN(ClientConnection); | 34 DISALLOW_COPY_AND_ASSIGN(ClientConnection); |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 // Bindings implementation of ClientConnection. | 37 // Bindings implementation of ClientConnection. |
| 38 class DefaultClientConnection : public ClientConnection { | 38 class DefaultClientConnection : public ClientConnection { |
| 39 public: | 39 public: |
| 40 DefaultClientConnection( | 40 DefaultClientConnection( |
| 41 scoped_ptr<ViewManagerServiceImpl> service_impl, | 41 scoped_ptr<ViewTreeImpl> service_impl, |
| 42 ConnectionManager* connection_manager, | 42 ConnectionManager* connection_manager, |
| 43 mojo::InterfaceRequest<mojo::ViewManagerService> service_request, | 43 mojo::InterfaceRequest<mojo::ViewTree> service_request, |
| 44 mojo::ViewManagerClientPtr client); | 44 mojo::ViewTreeClientPtr client); |
| 45 ~DefaultClientConnection() override; | 45 ~DefaultClientConnection() override; |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 ConnectionManager* connection_manager_; | 48 ConnectionManager* connection_manager_; |
| 49 mojo::Binding<mojo::ViewManagerService> binding_; | 49 mojo::Binding<mojo::ViewTree> binding_; |
| 50 mojo::ViewManagerClientPtr client_; | 50 mojo::ViewTreeClientPtr client_; |
| 51 | 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(DefaultClientConnection); | 52 DISALLOW_COPY_AND_ASSIGN(DefaultClientConnection); |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 } // namespace view_manager | 55 } // namespace view_manager |
| 56 | 56 |
| 57 #endif // COMPONENTS_VIEW_MANAGER_CLIENT_CONNECTION_H_ | 57 #endif // COMPONENTS_VIEW_MANAGER_CLIENT_CONNECTION_H_ |
| OLD | NEW |