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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 } | 46 } |
47 ~ProvidedApplicationDelegate() override { | 47 ~ProvidedApplicationDelegate() override { |
48 Join(); | 48 Join(); |
49 destruct_callback_.Run(); | 49 destruct_callback_.Run(); |
50 } | 50 } |
51 | 51 |
52 private: | 52 private: |
53 // mojo::ShellClient: | 53 // mojo::ShellClient: |
54 void Initialize(Shell* shell, const std::string& url, uint32_t id) override {} | 54 void Initialize(Shell* shell, const std::string& url, uint32_t id) override {} |
55 bool AcceptConnection(Connection* connection) override { | 55 bool AcceptConnection(Connection* connection) override { |
56 connection->AddService<test::mojom::ApplicationPackageApptestService>(this); | 56 connection->AddInterface<test::mojom::ApplicationPackageApptestService>( |
| 57 this); |
57 return true; | 58 return true; |
58 } | 59 } |
59 | 60 |
60 // InterfaceFactory<test::mojom::ApplicationPackageApptestService>: | 61 // InterfaceFactory<test::mojom::ApplicationPackageApptestService>: |
61 void Create( | 62 void Create( |
62 Connection* connection, | 63 Connection* connection, |
63 InterfaceRequest<test::mojom::ApplicationPackageApptestService> request) | 64 InterfaceRequest<test::mojom::ApplicationPackageApptestService> request) |
64 override { | 65 override { |
65 bindings_.AddBinding(this, std::move(request)); | 66 bindings_.AddBinding(this, std::move(request)); |
66 } | 67 } |
(...skipping 25 matching lines...) Expand all Loading... |
92 public mojom::ContentHandler, | 93 public mojom::ContentHandler, |
93 public test::mojom::ApplicationPackageApptestService { | 94 public test::mojom::ApplicationPackageApptestService { |
94 public: | 95 public: |
95 ApplicationPackageApptestDelegate() {} | 96 ApplicationPackageApptestDelegate() {} |
96 ~ApplicationPackageApptestDelegate() override {} | 97 ~ApplicationPackageApptestDelegate() override {} |
97 | 98 |
98 private: | 99 private: |
99 // mojo::ShellClient: | 100 // mojo::ShellClient: |
100 void Initialize(Shell* shell, const std::string& url, uint32_t id) override {} | 101 void Initialize(Shell* shell, const std::string& url, uint32_t id) override {} |
101 bool AcceptConnection(Connection* connection) override { | 102 bool AcceptConnection(Connection* connection) override { |
102 connection->AddService<ContentHandler>(this); | 103 connection->AddInterface<ContentHandler>(this); |
103 connection->AddService<test::mojom::ApplicationPackageApptestService>(this); | 104 connection->AddInterface<test::mojom::ApplicationPackageApptestService>( |
| 105 this); |
104 return true; | 106 return true; |
105 } | 107 } |
106 | 108 |
107 // InterfaceFactory<mojom::ContentHandler>: | 109 // InterfaceFactory<mojom::ContentHandler>: |
108 void Create(Connection* connection, | 110 void Create(Connection* connection, |
109 InterfaceRequest<mojom::ContentHandler> request) override { | 111 InterfaceRequest<mojom::ContentHandler> request) override { |
110 content_handler_bindings_.AddBinding(this, std::move(request)); | 112 content_handler_bindings_.AddBinding(this, std::move(request)); |
111 } | 113 } |
112 | 114 |
113 // InterfaceFactory<test::mojom::ApplicationPackageApptestService>: | 115 // InterfaceFactory<test::mojom::ApplicationPackageApptestService>: |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 base::RunLoop run_loop; | 201 base::RunLoop run_loop; |
200 std::string b_name; | 202 std::string b_name; |
201 service_b->GetName(base::Bind(&ReceiveName, &b_name, &run_loop)); | 203 service_b->GetName(base::Bind(&ReceiveName, &b_name, &run_loop)); |
202 run_loop.Run(); | 204 run_loop.Run(); |
203 EXPECT_EQ("B", b_name); | 205 EXPECT_EQ("B", b_name); |
204 } | 206 } |
205 } | 207 } |
206 | 208 |
207 } // namespace shell | 209 } // namespace shell |
208 } // namespace mojo | 210 } // namespace mojo |
OLD | NEW |