| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CONTENT_COMMON_MOJO_SHELL_CONNECTION_IMPL_H_ | 5 #ifndef CONTENT_COMMON_MOJO_SHELL_CONNECTION_IMPL_H_ |
| 6 #define CONTENT_COMMON_MOJO_SHELL_CONNECTION_IMPL_H_ | 6 #define CONTENT_COMMON_MOJO_SHELL_CONNECTION_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "content/public/common/mojo_shell_connection.h" | 12 #include "content/public/common/mojo_shell_connection.h" |
| 13 #include "mojo/public/cpp/bindings/binding_set.h" | 13 #include "mojo/public/cpp/bindings/binding_set.h" |
| 14 #include "mojo/public/cpp/system/message_pipe.h" | 14 #include "mojo/public/cpp/system/message_pipe.h" |
| 15 #include "services/shell/public/cpp/service.h" | 15 #include "services/shell/public/cpp/service.h" |
| 16 #include "services/shell/public/cpp/shell_connection.h" | 16 #include "services/shell/public/cpp/service_context.h" |
| 17 #include "services/shell/public/interfaces/service_factory.mojom.h" | 17 #include "services/shell/public/interfaces/service_factory.mojom.h" |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 | 20 |
| 21 class EmbeddedApplicationRunner; | 21 class EmbeddedApplicationRunner; |
| 22 | 22 |
| 23 class MojoShellConnectionImpl | 23 class MojoShellConnectionImpl |
| 24 : public MojoShellConnection, | 24 : public MojoShellConnection, |
| 25 public shell::Service, | 25 public shell::Service, |
| 26 public shell::InterfaceFactory<shell::mojom::ServiceFactory>, | 26 public shell::InterfaceFactory<shell::mojom::ServiceFactory>, |
| 27 public shell::mojom::ServiceFactory { | 27 public shell::mojom::ServiceFactory { |
| 28 | 28 |
| 29 public: | 29 public: |
| 30 explicit MojoShellConnectionImpl(shell::mojom::ServiceRequest request); | 30 explicit MojoShellConnectionImpl(shell::mojom::ServiceRequest request); |
| 31 ~MojoShellConnectionImpl() override; | 31 ~MojoShellConnectionImpl() override; |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 // MojoShellConnection: | 34 // MojoShellConnection: |
| 35 shell::ShellConnection* GetShellConnection() override; | 35 shell::ServiceContext* GetShellConnection() override; |
| 36 shell::Connector* GetConnector() override; | 36 shell::Connector* GetConnector() override; |
| 37 const shell::Identity& GetIdentity() const override; | 37 const shell::Identity& GetIdentity() const override; |
| 38 void SetConnectionLostClosure(const base::Closure& closure) override; | 38 void SetConnectionLostClosure(const base::Closure& closure) override; |
| 39 void MergeService(std::unique_ptr<shell::Service> service) override; | 39 void MergeService(std::unique_ptr<shell::Service> service) override; |
| 40 void MergeService(shell::Service* service) override; | 40 void MergeService(shell::Service* service) override; |
| 41 void AddEmbeddedService(const std::string& name, | 41 void AddEmbeddedService(const std::string& name, |
| 42 const MojoApplicationInfo& info) override; | 42 const MojoApplicationInfo& info) override; |
| 43 void AddServiceRequestHandler( | 43 void AddServiceRequestHandler( |
| 44 const std::string& name, | 44 const std::string& name, |
| 45 const ServiceRequestHandler& handler) override; | 45 const ServiceRequestHandler& handler) override; |
| 46 | 46 |
| 47 // shell::Service: | 47 // shell::Service: |
| 48 void OnStart(shell::Connector* connector, | 48 void OnStart(shell::Connector* connector, |
| 49 const shell::Identity& identity, | 49 const shell::Identity& identity, |
| 50 uint32_t id) override; | 50 uint32_t id) override; |
| 51 bool OnConnect(shell::Connection* connection) override; | 51 bool OnConnect(shell::Connection* connection) override; |
| 52 shell::InterfaceRegistry* GetInterfaceRegistryForConnection() override; | 52 shell::InterfaceRegistry* GetInterfaceRegistryForConnection() override; |
| 53 shell::InterfaceProvider* GetInterfaceProviderForConnection() override; | 53 shell::InterfaceProvider* GetInterfaceProviderForConnection() override; |
| 54 | 54 |
| 55 // shell::InterfaceFactory<shell::mojom::ServiceFactory>: | 55 // shell::InterfaceFactory<shell::mojom::ServiceFactory>: |
| 56 void Create(shell::Connection* connection, | 56 void Create(shell::Connection* connection, |
| 57 shell::mojom::ServiceFactoryRequest request) override; | 57 shell::mojom::ServiceFactoryRequest request) override; |
| 58 | 58 |
| 59 // shell::mojom::ServiceFactory: | 59 // shell::mojom::ServiceFactory: |
| 60 void CreateService(shell::mojom::ServiceRequest request, | 60 void CreateService(shell::mojom::ServiceRequest request, |
| 61 const mojo::String& name) override; | 61 const mojo::String& name) override; |
| 62 | 62 |
| 63 std::unique_ptr<shell::ShellConnection> shell_connection_; | 63 std::unique_ptr<shell::ServiceContext> shell_connection_; |
| 64 mojo::BindingSet<shell::mojom::ServiceFactory> factory_bindings_; | 64 mojo::BindingSet<shell::mojom::ServiceFactory> factory_bindings_; |
| 65 std::vector<shell::Service*> embedded_services_; | 65 std::vector<shell::Service*> embedded_services_; |
| 66 std::vector<std::unique_ptr<shell::Service>> owned_services_; | 66 std::vector<std::unique_ptr<shell::Service>> owned_services_; |
| 67 std::unordered_map<std::string, std::unique_ptr<EmbeddedApplicationRunner>> | 67 std::unordered_map<std::string, std::unique_ptr<EmbeddedApplicationRunner>> |
| 68 embedded_apps_; | 68 embedded_apps_; |
| 69 std::unordered_map<std::string, ServiceRequestHandler> request_handlers_; | 69 std::unordered_map<std::string, ServiceRequestHandler> request_handlers_; |
| 70 | 70 |
| 71 DISALLOW_COPY_AND_ASSIGN(MojoShellConnectionImpl); | 71 DISALLOW_COPY_AND_ASSIGN(MojoShellConnectionImpl); |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 } // namespace content | 74 } // namespace content |
| 75 | 75 |
| 76 #endif // CONTENT_COMMON_MOJO_SHELL_CONNECTION_IMPL_H_ | 76 #endif // CONTENT_COMMON_MOJO_SHELL_CONNECTION_IMPL_H_ |
| OLD | NEW |