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

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

Issue 2617883002: Add a new BindInterface() method to Connector. (Closed)
Patch Set: . Created 3 years, 11 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 <memory> 5 #include <memory>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/guid.h" 8 #include "base/guid.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 registry->AddInterface<test::mojom::StandaloneApp>(this); 69 registry->AddInterface<test::mojom::StandaloneApp>(this);
70 registry->AddInterface<test::mojom::BlockedInterface>(this); 70 registry->AddInterface<test::mojom::BlockedInterface>(this);
71 registry->AddInterface<test::mojom::UserIdTest>(this); 71 registry->AddInterface<test::mojom::UserIdTest>(this);
72 72
73 test::mojom::ConnectionStatePtr state(test::mojom::ConnectionState::New()); 73 test::mojom::ConnectionStatePtr state(test::mojom::ConnectionState::New());
74 state->connection_remote_name = remote_info.identity.name(); 74 state->connection_remote_name = remote_info.identity.name();
75 state->connection_remote_userid = remote_info.identity.user_id(); 75 state->connection_remote_userid = remote_info.identity.user_id();
76 state->initialize_local_name = context()->identity().name(); 76 state->initialize_local_name = context()->identity().name();
77 state->initialize_userid = context()->identity().user_id(); 77 state->initialize_userid = context()->identity().user_id();
78 78
79 context()->connector()->ConnectToInterface(remote_info.identity, &caller_); 79 context()->connector()->BindInterface(remote_info.identity, &caller_);
80 caller_->ConnectionAccepted(std::move(state)); 80 caller_->ConnectionAccepted(std::move(state));
81 81
82 return true; 82 return true;
83 } 83 }
84 84
85 // InterfaceFactory<test::mojom::ConnectTestService>: 85 // InterfaceFactory<test::mojom::ConnectTestService>:
86 void Create(const Identity& remote_identity, 86 void Create(const Identity& remote_identity,
87 test::mojom::ConnectTestServiceRequest request) override { 87 test::mojom::ConnectTestServiceRequest request) override {
88 bindings_.AddBinding(this, std::move(request)); 88 bindings_.AddBinding(this, std::move(request));
89 } 89 }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 213
214 DISALLOW_COPY_AND_ASSIGN(ConnectTestApp); 214 DISALLOW_COPY_AND_ASSIGN(ConnectTestApp);
215 }; 215 };
216 216
217 } // namespace service_manager 217 } // namespace service_manager
218 218
219 MojoResult ServiceMain(MojoHandle service_request_handle) { 219 MojoResult ServiceMain(MojoHandle service_request_handle) {
220 service_manager::ServiceRunner runner(new service_manager::ConnectTestApp); 220 service_manager::ServiceRunner runner(new service_manager::ConnectTestApp);
221 return runner.Run(service_request_handle); 221 return runner.Run(service_request_handle);
222 } 222 }
OLDNEW
« no previous file with comments | « services/service_manager/standalone/context.cc ('k') | services/service_manager/tests/connect/connect_test_package.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698