| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROMEOS_DBUS_SERVICES_LIVENESS_SERVICE_PROVIDER_H_ | 5 #ifndef CHROMEOS_DBUS_SERVICES_LIVENESS_SERVICE_PROVIDER_H_ |
| 6 #define CHROMEOS_DBUS_SERVICES_LIVENESS_SERVICE_PROVIDER_H_ | 6 #define CHROMEOS_DBUS_SERVICES_LIVENESS_SERVICE_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // --dest=org.chromium.LibCrosService | 29 // --dest=org.chromium.LibCrosService |
| 30 // /org/chromium/LibCrosService | 30 // /org/chromium/LibCrosService |
| 31 // org.chromium.LibCrosServiceInterface.CheckLiveness | 31 // org.chromium.LibCrosServiceInterface.CheckLiveness |
| 32 // | 32 // |
| 33 // -> method return sender=:1.9 -> dest=:1.27 reply_serial=2 | 33 // -> method return sender=:1.9 -> dest=:1.27 reply_serial=2 |
| 34 // | 34 // |
| 35 // (An empty response should be returned.) | 35 // (An empty response should be returned.) |
| 36 class CHROMEOS_EXPORT LivenessServiceProvider | 36 class CHROMEOS_EXPORT LivenessServiceProvider |
| 37 : public CrosDBusService::ServiceProviderInterface { | 37 : public CrosDBusService::ServiceProviderInterface { |
| 38 public: | 38 public: |
| 39 LivenessServiceProvider(); | 39 explicit LivenessServiceProvider(const std::string& service_interface); |
| 40 ~LivenessServiceProvider() override; | 40 ~LivenessServiceProvider() override; |
| 41 | 41 |
| 42 // CrosDBusService::ServiceProviderInterface overrides: | 42 // CrosDBusService::ServiceProviderInterface overrides: |
| 43 void Start(scoped_refptr<dbus::ExportedObject> exported_object) override; | 43 void Start(scoped_refptr<dbus::ExportedObject> exported_object) override; |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 // Called from ExportedObject when CheckLiveness() is exported as a D-Bus | 46 // Called from ExportedObject when CheckLiveness() is exported as a D-Bus |
| 47 // method or failed to be exported. | 47 // method or failed to be exported. |
| 48 void OnExported(const std::string& interface_name, | 48 void OnExported(const std::string& interface_name, |
| 49 const std::string& method_name, | 49 const std::string& method_name, |
| 50 bool success); | 50 bool success); |
| 51 | 51 |
| 52 // Called on UI thread in response to a D-Bus request. | 52 // Called on UI thread in response to a D-Bus request. |
| 53 void CheckLiveness(dbus::MethodCall* method_call, | 53 void CheckLiveness(dbus::MethodCall* method_call, |
| 54 dbus::ExportedObject::ResponseSender response_sender); | 54 dbus::ExportedObject::ResponseSender response_sender); |
| 55 | 55 |
| 56 // Name of the service interface to install LivenessService on. |
| 57 // TODO(teravest): Remove this once CheckLiveness is removed from |
| 58 // LibCrosService. |
| 59 const std::string service_interface_; |
| 60 |
| 56 // Keep this last so that all weak pointers will be invalidated at the | 61 // Keep this last so that all weak pointers will be invalidated at the |
| 57 // beginning of destruction. | 62 // beginning of destruction. |
| 58 base::WeakPtrFactory<LivenessServiceProvider> weak_ptr_factory_; | 63 base::WeakPtrFactory<LivenessServiceProvider> weak_ptr_factory_; |
| 59 | 64 |
| 60 DISALLOW_COPY_AND_ASSIGN(LivenessServiceProvider); | 65 DISALLOW_COPY_AND_ASSIGN(LivenessServiceProvider); |
| 61 }; | 66 }; |
| 62 | 67 |
| 63 } // namespace chromeos | 68 } // namespace chromeos |
| 64 | 69 |
| 65 #endif // CHROMEOS_DBUS_SERVICES_LIVENESS_SERVICE_PROVIDER_H_ | 70 #endif // CHROMEOS_DBUS_SERVICES_LIVENESS_SERVICE_PROVIDER_H_ |
| OLD | NEW |