OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "services/service_manager/public/cpp/service.h" | 5 #include "services/service_manager/public/cpp/service.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "services/service_manager/public/cpp/service_context.h" | 8 #include "services/service_manager/public/cpp/service_context.h" |
9 | 9 |
10 namespace service_manager { | 10 namespace service_manager { |
11 | 11 |
12 Service::Service() = default; | 12 Service::Service() = default; |
13 | 13 |
14 Service::~Service() = default; | 14 Service::~Service() = default; |
15 | 15 |
16 void Service::OnStart() {} | 16 void Service::OnStart() {} |
17 | 17 |
18 void Service::OnBindInterface(const ServiceInfo& source_info, | 18 void Service::OnBindInterface(const BindSourceInfo& source, |
19 const std::string& interface_name, | 19 const std::string& interface_name, |
20 mojo::ScopedMessagePipeHandle interface_pipe) {} | 20 mojo::ScopedMessagePipeHandle interface_pipe) {} |
21 | 21 |
22 bool Service::OnServiceManagerConnectionLost() { | 22 bool Service::OnServiceManagerConnectionLost() { |
23 return true; | 23 return true; |
24 } | 24 } |
25 | 25 |
26 ServiceContext* Service::context() const { | 26 ServiceContext* Service::context() const { |
27 DCHECK(service_context_) | 27 DCHECK(service_context_) |
28 << "Service::context() may only be called after the Service constructor."; | 28 << "Service::context() may only be called after the Service constructor."; |
29 return service_context_; | 29 return service_context_; |
30 } | 30 } |
31 | 31 |
32 void Service::SetContext(ServiceContext* context) { | 32 void Service::SetContext(ServiceContext* context) { |
33 service_context_ = context; | 33 service_context_ = context; |
34 } | 34 } |
35 | 35 |
36 ForwardingService::ForwardingService(Service* target) : target_(target) {} | 36 ForwardingService::ForwardingService(Service* target) : target_(target) {} |
37 | 37 |
38 ForwardingService::~ForwardingService() {} | 38 ForwardingService::~ForwardingService() {} |
39 | 39 |
40 void ForwardingService::OnStart() { | 40 void ForwardingService::OnStart() { |
41 target_->OnStart(); | 41 target_->OnStart(); |
42 } | 42 } |
43 | 43 |
44 void ForwardingService::OnBindInterface( | 44 void ForwardingService::OnBindInterface( |
45 const ServiceInfo& remote_info, | 45 const BindSourceInfo& source, |
46 const std::string& interface_name, | 46 const std::string& interface_name, |
47 mojo::ScopedMessagePipeHandle interface_pipe) { | 47 mojo::ScopedMessagePipeHandle interface_pipe) { |
48 target_->OnBindInterface(remote_info, interface_name, | 48 target_->OnBindInterface(source, interface_name, std::move(interface_pipe)); |
49 std::move(interface_pipe)); | |
50 } | 49 } |
51 | 50 |
52 bool ForwardingService::OnServiceManagerConnectionLost() { | 51 bool ForwardingService::OnServiceManagerConnectionLost() { |
53 return target_->OnServiceManagerConnectionLost(); | 52 return target_->OnServiceManagerConnectionLost(); |
54 } | 53 } |
55 | 54 |
56 void ForwardingService::SetContext(ServiceContext* context) { | 55 void ForwardingService::SetContext(ServiceContext* context) { |
57 target_->SetContext(context); | 56 target_->SetContext(context); |
58 } | 57 } |
59 | 58 |
60 } // namespace service_manager | 59 } // namespace service_manager |
OLD | NEW |