| 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 #include <algorithm> | 5 #include <algorithm> |
| 6 #include <memory> | 6 #include <memory> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "mojo/public/c/system/main.h" | 10 #include "mojo/public/c/system/main.h" |
| 11 #include "mojo/public/cpp/bindings/binding_set.h" | 11 #include "mojo/public/cpp/bindings/binding_set.h" |
| 12 #include "services/shell/public/cpp/application_runner.h" | |
| 13 #include "services/shell/public/cpp/service_context.h" | 12 #include "services/shell/public/cpp/service_context.h" |
| 13 #include "services/shell/public/cpp/service_runner.h" |
| 14 #include "services/shell/public/interfaces/service_factory.mojom.h" | 14 #include "services/shell/public/interfaces/service_factory.mojom.h" |
| 15 #include "services/shell/tests/lifecycle/app_client.h" | 15 #include "services/shell/tests/lifecycle/app_client.h" |
| 16 #include "services/shell/tests/lifecycle/lifecycle_unittest.mojom.h" | 16 #include "services/shell/tests/lifecycle/lifecycle_unittest.mojom.h" |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 class PackagedApp : public shell::Service, | 20 class PackagedApp : public shell::Service, |
| 21 public shell::InterfaceFactory<LifecycleControl>, | 21 public shell::InterfaceFactory<LifecycleControl>, |
| 22 public LifecycleControl { | 22 public LifecycleControl { |
| 23 public: | 23 public: |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 class Package | 88 class Package |
| 89 : public shell::Service, | 89 : public shell::Service, |
| 90 public shell::InterfaceFactory<shell::mojom::ServiceFactory>, | 90 public shell::InterfaceFactory<shell::mojom::ServiceFactory>, |
| 91 public shell::mojom::ServiceFactory { | 91 public shell::mojom::ServiceFactory { |
| 92 public: | 92 public: |
| 93 Package() {} | 93 Package() {} |
| 94 ~Package() override {} | 94 ~Package() override {} |
| 95 | 95 |
| 96 void set_runner(shell::ApplicationRunner* runner) { | 96 void set_runner(shell::ServiceRunner* runner) { |
| 97 app_client_.set_runner(runner); | 97 app_client_.set_runner(runner); |
| 98 } | 98 } |
| 99 | 99 |
| 100 private: | 100 private: |
| 101 // shell::test::AppClient: | 101 // shell::test::AppClient: |
| 102 bool OnConnect(shell::Connection* connection) override { | 102 bool OnConnect(shell::Connection* connection) override { |
| 103 connection->AddInterface<shell::mojom::ServiceFactory>(this); | 103 connection->AddInterface<shell::mojom::ServiceFactory>(this); |
| 104 return app_client_.OnConnect(connection); | 104 return app_client_.OnConnect(connection); |
| 105 } | 105 } |
| 106 | 106 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 mojo::BindingSet<shell::mojom::ServiceFactory> bindings_; | 140 mojo::BindingSet<shell::mojom::ServiceFactory> bindings_; |
| 141 std::vector<PackagedApp*> apps_; | 141 std::vector<PackagedApp*> apps_; |
| 142 | 142 |
| 143 DISALLOW_COPY_AND_ASSIGN(Package); | 143 DISALLOW_COPY_AND_ASSIGN(Package); |
| 144 }; | 144 }; |
| 145 | 145 |
| 146 } // namespace | 146 } // namespace |
| 147 | 147 |
| 148 MojoResult MojoMain(MojoHandle shell_handle) { | 148 MojoResult MojoMain(MojoHandle shell_handle) { |
| 149 Package* package = new Package; | 149 Package* package = new Package; |
| 150 shell::ApplicationRunner runner(package); | 150 shell::ServiceRunner runner(package); |
| 151 package->set_runner(&runner); | 151 package->set_runner(&runner); |
| 152 return runner.Run(shell_handle); | 152 return runner.Run(shell_handle); |
| 153 } | 153 } |
| OLD | NEW |