OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MASH_PACKAGE_MASH_PACKAGED_SERVICE_H_ |
| 6 #define MASH_PACKAGE_MASH_PACKAGED_SERVICE_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "mojo/public/cpp/bindings/binding_set.h" |
| 11 #include "services/shell/public/cpp/interface_factory.h" |
| 12 #include "services/shell/public/cpp/service.h" |
| 13 #include "services/shell/public/interfaces/service_factory.mojom.h" |
| 14 |
| 15 namespace mash { |
| 16 |
| 17 // MashPackagedService is a Service implementation that starts all the mash |
| 18 // apps. It's used when mash is packaged inside chrome or tests. To use you'll |
| 19 // need a manifest similar to what is used by chrome and browser_tests. |
| 20 class MashPackagedService |
| 21 : public shell::Service, |
| 22 public shell::mojom::ServiceFactory, |
| 23 public shell::InterfaceFactory<shell::mojom::ServiceFactory> { |
| 24 public: |
| 25 MashPackagedService(); |
| 26 ~MashPackagedService() override; |
| 27 |
| 28 // shell::Service: |
| 29 bool OnConnect(const shell::Identity& remote_identity, |
| 30 shell::InterfaceRegistry* registry) override; |
| 31 |
| 32 // shell::InterfaceFactory<ServiceFactory> |
| 33 void Create(const shell::Identity& remote_identity, |
| 34 mojo::InterfaceRequest<ServiceFactory> request) override; |
| 35 |
| 36 // ServiceFactory: |
| 37 void CreateService(shell::mojom::ServiceRequest request, |
| 38 const std::string& mojo_name) override; |
| 39 |
| 40 private: |
| 41 std::unique_ptr<shell::Service> CreateService(const std::string& name); |
| 42 |
| 43 mojo::BindingSet<ServiceFactory> service_factory_bindings_; |
| 44 std::unique_ptr<shell::Service> service_; |
| 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(MashPackagedService); |
| 47 }; |
| 48 |
| 49 } // namespace mash |
| 50 |
| 51 #endif // MASH_PACKAGE_MASH_PACKAGED_SERVICE_H_ |
OLD | NEW |