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

Side by Side Diff: services/service_manager/tests/connect/connect_test_class_app.cc

Issue 2420253002: Rename shell namespace to service_manager (Closed)
Patch Set: . 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
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/cpp/bindings/binding_set.h" 9 #include "mojo/public/cpp/bindings/binding_set.h"
10 #include "services/service_manager/public/c/main.h" 10 #include "services/service_manager/public/c/main.h"
11 #include "services/service_manager/public/cpp/connector.h" 11 #include "services/service_manager/public/cpp/connector.h"
12 #include "services/service_manager/public/cpp/interface_factory.h" 12 #include "services/service_manager/public/cpp/interface_factory.h"
13 #include "services/service_manager/public/cpp/interface_registry.h" 13 #include "services/service_manager/public/cpp/interface_registry.h"
14 #include "services/service_manager/public/cpp/service.h" 14 #include "services/service_manager/public/cpp/service.h"
15 #include "services/service_manager/public/cpp/service_runner.h" 15 #include "services/service_manager/public/cpp/service_runner.h"
16 #include "services/service_manager/public/interfaces/connector.mojom.h" 16 #include "services/service_manager/public/interfaces/connector.mojom.h"
17 #include "services/service_manager/tests/connect/connect_test.mojom.h" 17 #include "services/service_manager/tests/connect/connect_test.mojom.h"
18 18
19 namespace shell { 19 namespace service_manager {
20 20
21 using GetTitleCallback = test::mojom::ConnectTestService::GetTitleCallback; 21 using GetTitleCallback = test::mojom::ConnectTestService::GetTitleCallback;
22 22
23 class ConnectTestClassApp 23 class ConnectTestClassApp
24 : public Service, 24 : public Service,
25 public InterfaceFactory<test::mojom::ConnectTestService>, 25 public InterfaceFactory<test::mojom::ConnectTestService>,
26 public InterfaceFactory<test::mojom::ClassInterface>, 26 public InterfaceFactory<test::mojom::ClassInterface>,
27 public test::mojom::ConnectTestService, 27 public test::mojom::ConnectTestService,
28 public test::mojom::ClassInterface { 28 public test::mojom::ClassInterface {
29 public: 29 public:
30 ConnectTestClassApp() {} 30 ConnectTestClassApp() {}
31 ~ConnectTestClassApp() override {} 31 ~ConnectTestClassApp() override {}
32 32
33 private: 33 private:
34 // shell::Service: 34 // service_manager::Service:
35 void OnStart(const Identity& identity) override { 35 void OnStart(const Identity& identity) override {
36 identity_ = identity; 36 identity_ = identity;
37 } 37 }
38 bool OnConnect(const Identity& remote_identity, 38 bool OnConnect(const Identity& remote_identity,
39 InterfaceRegistry* registry) override { 39 InterfaceRegistry* registry) override {
40 registry->AddInterface<test::mojom::ConnectTestService>(this); 40 registry->AddInterface<test::mojom::ConnectTestService>(this);
41 registry->AddInterface<test::mojom::ClassInterface>(this); 41 registry->AddInterface<test::mojom::ClassInterface>(this);
42 inbound_connections_.insert(registry); 42 inbound_connections_.insert(registry);
43 registry->SetConnectionLostClosure( 43 registry->SetConnectionLostClosure(
44 base::Bind(&ConnectTestClassApp::OnConnectionError, 44 base::Bind(&ConnectTestClassApp::OnConnectionError,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 80 }
81 81
82 Identity identity_; 82 Identity identity_;
83 std::set<InterfaceRegistry*> inbound_connections_; 83 std::set<InterfaceRegistry*> inbound_connections_;
84 mojo::BindingSet<test::mojom::ConnectTestService> bindings_; 84 mojo::BindingSet<test::mojom::ConnectTestService> bindings_;
85 mojo::BindingSet<test::mojom::ClassInterface> class_interface_bindings_; 85 mojo::BindingSet<test::mojom::ClassInterface> class_interface_bindings_;
86 86
87 DISALLOW_COPY_AND_ASSIGN(ConnectTestClassApp); 87 DISALLOW_COPY_AND_ASSIGN(ConnectTestClassApp);
88 }; 88 };
89 89
90 } // namespace shell 90 } // namespace service_manager
91
92 91
93 MojoResult ServiceMain(MojoHandle service_request_handle) { 92 MojoResult ServiceMain(MojoHandle service_request_handle) {
94 shell::ServiceRunner runner(new shell::ConnectTestClassApp); 93 service_manager::ServiceRunner runner(
94 new service_manager::ConnectTestClassApp);
95 return runner.Run(service_request_handle); 95 return runner.Run(service_request_handle);
96 } 96 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698