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