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

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

Issue 2118083002: ShellClient -> Service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mus2
Patch Set: . Created 4 years, 5 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
« no previous file with comments | « services/shell/tests/shutdown/shutdown_client_app.cc ('k') | services/shell/tests/util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/macros.h" 5 #include "base/macros.h"
6 #include "mojo/public/c/system/main.h" 6 #include "mojo/public/c/system/main.h"
7 #include "mojo/public/cpp/bindings/binding_set.h" 7 #include "mojo/public/cpp/bindings/binding_set.h"
8 #include "services/shell/public/cpp/application_runner.h" 8 #include "services/shell/public/cpp/application_runner.h"
9 #include "services/shell/public/cpp/shell_client.h" 9 #include "services/shell/public/cpp/service.h"
10 #include "services/shell/tests/shutdown/shutdown_unittest.mojom.h" 10 #include "services/shell/tests/shutdown/shutdown_unittest.mojom.h"
11 11
12 namespace shell { 12 namespace shell {
13 namespace { 13 namespace {
14 14
15 shell::ApplicationRunner* g_app = nullptr; 15 shell::ApplicationRunner* g_app = nullptr;
16 16
17 class ShutdownServiceApp 17 class ShutdownServiceApp
18 : public ShellClient, 18 : public Service,
19 public InterfaceFactory<mojom::ShutdownTestService>, 19 public InterfaceFactory<mojom::ShutdownTestService>,
20 public mojom::ShutdownTestService { 20 public mojom::ShutdownTestService {
21 public: 21 public:
22 ShutdownServiceApp() {} 22 ShutdownServiceApp() {}
23 ~ShutdownServiceApp() override {} 23 ~ShutdownServiceApp() override {}
24 24
25 private: 25 private:
26 // shell::ShellClient: 26 // shell::Service:
27 void Initialize(Connector* connector, const Identity& identity, 27 void OnStart(Connector* connector, const Identity& identity,
28 uint32_t id) override {} 28 uint32_t id) override {}
29 bool AcceptConnection(Connection* connection) override { 29 bool OnConnect(Connection* connection) override {
30 connection->AddInterface<mojom::ShutdownTestService>(this); 30 connection->AddInterface<mojom::ShutdownTestService>(this);
31 return true; 31 return true;
32 } 32 }
33 33
34 // InterfaceFactory<mojom::ShutdownTestService>: 34 // InterfaceFactory<mojom::ShutdownTestService>:
35 void Create(Connection* connection, 35 void Create(Connection* connection,
36 mojom::ShutdownTestServiceRequest request) override { 36 mojom::ShutdownTestServiceRequest request) override {
37 bindings_.AddBinding(this, std::move(request)); 37 bindings_.AddBinding(this, std::move(request));
38 } 38 }
39 39
40 // mojom::ShutdownTestService: 40 // mojom::ShutdownTestService:
41 void SetClient(mojom::ShutdownTestClientPtr client) override {} 41 void SetClient(mojom::ShutdownTestClientPtr client) override {}
42 void ShutDown() override { g_app->Quit(); } 42 void ShutDown() override { g_app->Quit(); }
43 43
44 mojo::BindingSet<mojom::ShutdownTestService> bindings_; 44 mojo::BindingSet<mojom::ShutdownTestService> bindings_;
45 45
46 DISALLOW_COPY_AND_ASSIGN(ShutdownServiceApp); 46 DISALLOW_COPY_AND_ASSIGN(ShutdownServiceApp);
47 }; 47 };
48 48
49 } // namespace 49 } // namespace
50 } // namespace shell 50 } // namespace shell
51 51
52 52
53 MojoResult MojoMain(MojoHandle shell_handle) { 53 MojoResult MojoMain(MojoHandle shell_handle) {
54 shell::ApplicationRunner runner(new shell::ShutdownServiceApp); 54 shell::ApplicationRunner runner(new shell::ShutdownServiceApp);
55 shell::g_app = &runner; 55 shell::g_app = &runner;
56 return runner.Run(shell_handle); 56 return runner.Run(shell_handle);
57 } 57 }
OLDNEW
« no previous file with comments | « services/shell/tests/shutdown/shutdown_client_app.cc ('k') | services/shell/tests/util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698