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

Side by Side Diff: services/shell/tests/shutdown/shutdown_service_app.cc

Issue 2419723002: Move services/shell to services/service_manager (Closed)
Patch Set: rebase Created 4 years, 2 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
OLDNEW
(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 #include "base/macros.h"
6 #include "mojo/public/cpp/bindings/binding_set.h"
7 #include "services/shell/public/c/main.h"
8 #include "services/shell/public/cpp/interface_factory.h"
9 #include "services/shell/public/cpp/interface_registry.h"
10 #include "services/shell/public/cpp/service.h"
11 #include "services/shell/public/cpp/service_runner.h"
12 #include "services/shell/tests/shutdown/shutdown_unittest.mojom.h"
13
14 namespace shell {
15 namespace {
16
17 shell::ServiceRunner* g_app = nullptr;
18
19 class ShutdownServiceApp
20 : public Service,
21 public InterfaceFactory<mojom::ShutdownTestService>,
22 public mojom::ShutdownTestService {
23 public:
24 ShutdownServiceApp() {}
25 ~ShutdownServiceApp() override {}
26
27 private:
28 // shell::Service:
29 bool OnConnect(const Identity& remote_identity,
30 InterfaceRegistry* registry) override {
31 registry->AddInterface<mojom::ShutdownTestService>(this);
32 return true;
33 }
34
35 // InterfaceFactory<mojom::ShutdownTestService>:
36 void Create(const Identity& remote_identity,
37 mojom::ShutdownTestServiceRequest request) override {
38 bindings_.AddBinding(this, std::move(request));
39 }
40
41 // mojom::ShutdownTestService:
42 void SetClient(mojom::ShutdownTestClientPtr client) override {}
43 void ShutDown() override { g_app->Quit(); }
44
45 mojo::BindingSet<mojom::ShutdownTestService> bindings_;
46
47 DISALLOW_COPY_AND_ASSIGN(ShutdownServiceApp);
48 };
49
50 } // namespace
51 } // namespace shell
52
53
54 MojoResult ServiceMain(MojoHandle service_request_handle) {
55 shell::ServiceRunner runner(new shell::ShutdownServiceApp);
56 shell::g_app = &runner;
57 return runner.Run(service_request_handle);
58 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698