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

Side by Side Diff: services/shell/tests/connect/connect_test_class_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
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/bind.h" 5 #include "base/bind.h"
6 #include "base/macros.h" 6 #include "base/macros.h"
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "mojo/public/c/system/main.h" 9 #include "mojo/public/c/system/main.h"
10 #include "mojo/public/cpp/bindings/binding_set.h" 10 #include "mojo/public/cpp/bindings/binding_set.h"
11 #include "services/shell/public/cpp/application_runner.h" 11 #include "services/shell/public/cpp/application_runner.h"
12 #include "services/shell/public/cpp/connector.h" 12 #include "services/shell/public/cpp/connector.h"
13 #include "services/shell/public/cpp/interface_factory.h" 13 #include "services/shell/public/cpp/interface_factory.h"
14 #include "services/shell/public/cpp/shell_client.h" 14 #include "services/shell/public/cpp/service.h"
15 #include "services/shell/public/interfaces/connector.mojom.h" 15 #include "services/shell/public/interfaces/connector.mojom.h"
16 #include "services/shell/tests/connect/connect_test.mojom.h" 16 #include "services/shell/tests/connect/connect_test.mojom.h"
17 17
18 namespace shell { 18 namespace shell {
19 19
20 using GetTitleCallback = test::mojom::ConnectTestService::GetTitleCallback; 20 using GetTitleCallback = test::mojom::ConnectTestService::GetTitleCallback;
21 21
22 class ConnectTestClassApp 22 class ConnectTestClassApp
23 : public ShellClient, 23 : public Service,
24 public InterfaceFactory<test::mojom::ConnectTestService>, 24 public InterfaceFactory<test::mojom::ConnectTestService>,
25 public InterfaceFactory<test::mojom::ClassInterface>, 25 public InterfaceFactory<test::mojom::ClassInterface>,
26 public test::mojom::ConnectTestService, 26 public test::mojom::ConnectTestService,
27 public test::mojom::ClassInterface { 27 public test::mojom::ClassInterface {
28 public: 28 public:
29 ConnectTestClassApp() {} 29 ConnectTestClassApp() {}
30 ~ConnectTestClassApp() override {} 30 ~ConnectTestClassApp() override {}
31 31
32 private: 32 private:
33 // shell::ShellClient: 33 // shell::Service:
34 void Initialize(Connector* connector, const Identity& identity, 34 void OnStart(Connector* connector, const Identity& identity,
35 uint32_t id) override { 35 uint32_t id) override {
36 connector_ = connector; 36 connector_ = connector;
37 identity_ = identity; 37 identity_ = identity;
38 } 38 }
39 bool AcceptConnection(Connection* connection) override { 39 bool OnConnect(Connection* connection) override {
40 connection->AddInterface<test::mojom::ConnectTestService>(this); 40 connection->AddInterface<test::mojom::ConnectTestService>(this);
41 connection->AddInterface<test::mojom::ClassInterface>(this); 41 connection->AddInterface<test::mojom::ClassInterface>(this);
42 inbound_connections_.insert(connection); 42 inbound_connections_.insert(connection);
43 connection->SetConnectionLostClosure( 43 connection->SetConnectionLostClosure(
44 base::Bind(&ConnectTestClassApp::OnConnectionError, 44 base::Bind(&ConnectTestClassApp::OnConnectionError,
45 base::Unretained(this), connection)); 45 base::Unretained(this), connection));
46 return true; 46 return true;
47 } 47 }
48 48
49 // InterfaceFactory<test::mojom::ConnectTestService>: 49 // InterfaceFactory<test::mojom::ConnectTestService>:
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 }; 89 };
90 90
91 } // namespace shell 91 } // namespace shell
92 92
93 93
94 MojoResult MojoMain(MojoHandle shell_handle) { 94 MojoResult MojoMain(MojoHandle shell_handle) {
95 MojoResult rv = shell::ApplicationRunner(new shell::ConnectTestClassApp) 95 MojoResult rv = shell::ApplicationRunner(new shell::ConnectTestClassApp)
96 .Run(shell_handle); 96 .Run(shell_handle);
97 return rv; 97 return rv;
98 } 98 }
OLDNEW
« no previous file with comments | « services/shell/tests/connect/connect_test_app.cc ('k') | services/shell/tests/connect/connect_test_driver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698