1 // Copyright (c) 2012 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.
5 #include "chromeos/dbus/services/liveness_service_provider.h"
9 #include "dbus/message.h"
10 #include "third_party/cros_system_api/dbus/service_constants.h"
14 LivenessServiceProvider::LivenessServiceProvider() : weak_ptr_factory_(this) {}
16 LivenessServiceProvider::~LivenessServiceProvider() {}
18 void LivenessServiceProvider::Start(
19 scoped_refptr
<dbus::ExportedObject
> exported_object
) {
20 exported_object
->ExportMethod(
21 kLibCrosServiceInterface
,
23 base::Bind(&LivenessServiceProvider::CheckLiveness
,
24 weak_ptr_factory_
.GetWeakPtr()),
25 base::Bind(&LivenessServiceProvider::OnExported
,
26 weak_ptr_factory_
.GetWeakPtr()));
29 void LivenessServiceProvider::OnExported(const std::string
& interface_name
,
30 const std::string
& method_name
,
33 LOG(ERROR
) << "Failed to export " << interface_name
<< "."
38 void LivenessServiceProvider::CheckLiveness(
39 dbus::MethodCall
* method_call
,
40 dbus::ExportedObject::ResponseSender response_sender
) {
41 response_sender
.Run(dbus::Response::FromMethodCall(method_call
));
44 } // namespace chromeos