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

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

Issue 2435153004: Change Service contract to pass ServiceInfo instead of Identity (Closed)
Patch Set: . Created 4 years, 1 month 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 public test::mojom::ConnectTestService, 46 public test::mojom::ConnectTestService,
47 public test::mojom::StandaloneApp, 47 public test::mojom::StandaloneApp,
48 public test::mojom::BlockedInterface, 48 public test::mojom::BlockedInterface,
49 public test::mojom::UserIdTest { 49 public test::mojom::UserIdTest {
50 public: 50 public:
51 ConnectTestApp() {} 51 ConnectTestApp() {}
52 ~ConnectTestApp() override {} 52 ~ConnectTestApp() override {}
53 53
54 private: 54 private:
55 // service_manager::Service: 55 // service_manager::Service:
56 void OnStart(const Identity& identity) override { 56 void OnStart(const ServiceInfo& info) override {
57 identity_ = identity; 57 identity_ = info.identity;
58 bindings_.set_connection_error_handler( 58 bindings_.set_connection_error_handler(
59 base::Bind(&ConnectTestApp::OnConnectionError, 59 base::Bind(&ConnectTestApp::OnConnectionError,
60 base::Unretained(this))); 60 base::Unretained(this)));
61 standalone_bindings_.set_connection_error_handler( 61 standalone_bindings_.set_connection_error_handler(
62 base::Bind(&ConnectTestApp::OnConnectionError, 62 base::Bind(&ConnectTestApp::OnConnectionError,
63 base::Unretained(this))); 63 base::Unretained(this)));
64 } 64 }
65 bool OnConnect(const Identity& remote_identity, 65 bool OnConnect(const ServiceInfo& remote_info,
66 InterfaceRegistry* registry) override { 66 InterfaceRegistry* registry) override {
67 registry->AddInterface<test::mojom::ConnectTestService>(this); 67 registry->AddInterface<test::mojom::ConnectTestService>(this);
68 registry->AddInterface<test::mojom::StandaloneApp>(this); 68 registry->AddInterface<test::mojom::StandaloneApp>(this);
69 registry->AddInterface<test::mojom::BlockedInterface>(this); 69 registry->AddInterface<test::mojom::BlockedInterface>(this);
70 registry->AddInterface<test::mojom::UserIdTest>(this); 70 registry->AddInterface<test::mojom::UserIdTest>(this);
71 71
72 test::mojom::ConnectionStatePtr state(test::mojom::ConnectionState::New()); 72 test::mojom::ConnectionStatePtr state(test::mojom::ConnectionState::New());
73 state->connection_remote_name = remote_identity.name(); 73 state->connection_remote_name = remote_info.identity.name();
74 state->connection_remote_userid = remote_identity.user_id(); 74 state->connection_remote_userid = remote_info.identity.user_id();
75 state->initialize_local_name = identity_.name(); 75 state->initialize_local_name = identity_.name();
76 state->initialize_userid = identity_.user_id(); 76 state->initialize_userid = identity_.user_id();
77 77
78 connector()->ConnectToInterface(remote_identity, &caller_); 78 connector()->ConnectToInterface(remote_identity, &caller_);
kuzminruslan 2016/10/25 17:24:32 not sure - remote_identity is argument old functio
79 caller_->ConnectionAccepted(std::move(state)); 79 caller_->ConnectionAccepted(std::move(state));
80 80
81 return true; 81 return true;
82 } 82 }
83 83
84 // InterfaceFactory<test::mojom::ConnectTestService>: 84 // InterfaceFactory<test::mojom::ConnectTestService>:
85 void Create(const Identity& remote_identity, 85 void Create(const Identity& remote_identity,
86 test::mojom::ConnectTestServiceRequest request) override { 86 test::mojom::ConnectTestServiceRequest request) override {
87 bindings_.AddBinding(this, std::move(request)); 87 bindings_.AddBinding(this, std::move(request));
88 } 88 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 214
215 DISALLOW_COPY_AND_ASSIGN(ConnectTestApp); 215 DISALLOW_COPY_AND_ASSIGN(ConnectTestApp);
216 }; 216 };
217 217
218 } // namespace service_manager 218 } // namespace service_manager
219 219
220 MojoResult ServiceMain(MojoHandle service_request_handle) { 220 MojoResult ServiceMain(MojoHandle service_request_handle) {
221 service_manager::ServiceRunner runner(new service_manager::ConnectTestApp); 221 service_manager::ServiceRunner runner(new service_manager::ConnectTestApp);
222 return runner.Run(service_request_handle); 222 return runner.Run(service_request_handle);
223 } 223 }
OLDNEW
« no previous file with comments | « services/service_manager/service_manager.cc ('k') | services/service_manager/tests/connect/connect_test_class_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698