OLD | NEW |
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 #ifndef CHROME_BROWSER_CHROMEOS_DBUS_KIOSK_INFO_SERVICE_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DBUS_KIOSK_INFO_SERVICE_PROVIDER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DBUS_KIOSK_INFO_SERVICE_PROVIDER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DBUS_KIOSK_INFO_SERVICE_PROVIDER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "chromeos/dbus/services/cros_dbus_service.h" | 11 #include "chromeos/dbus/services/cros_dbus_service.h" |
12 #include "dbus/exported_object.h" | 12 #include "dbus/exported_object.h" |
13 | 13 |
14 namespace dbus { | 14 namespace dbus { |
15 class MethodCall; | 15 class MethodCall; |
16 } | 16 } |
17 | 17 |
18 namespace chromeos { | 18 namespace chromeos { |
19 | 19 |
20 // Exports a "GetKioskAppRequiredPlatformVersion" D-Bus method that | 20 // Exports a "GetKioskAppRequiredPlatformVersion" D-Bus method that |
21 // update_engine calls to get the required platform version of the | 21 // update_engine calls to get the required platform version of the |
22 // kiosk app that is configured to auto launch. | 22 // kiosk app that is configured to auto launch. |
23 // See http://crbug.com/577783 for details. | 23 // See http://crbug.com/577783 for details. |
24 // | 24 // |
25 class KioskInfoService : public CrosDBusService::ServiceProviderInterface { | 25 class KioskInfoService : public CrosDBusService::ServiceProviderInterface { |
26 public: | 26 public: |
27 // TODO(teravest): Remove these extra parameters once this interface is fully | 27 KioskInfoService(); |
28 // migrated off of LibCrosService. | |
29 KioskInfoService(const std::string& service_interface, | |
30 const std::string& method_name); | |
31 ~KioskInfoService() override; | 28 ~KioskInfoService() override; |
32 | 29 |
33 // CrosDBusService::ServiceProviderInterface | 30 // CrosDBusService::ServiceProviderInterface |
34 void Start(scoped_refptr<dbus::ExportedObject> exported_object) override; | 31 void Start(scoped_refptr<dbus::ExportedObject> exported_object) override; |
35 | 32 |
36 private: | 33 private: |
37 // Called from ExportedObject when CheckLiveness() is exported as a D-Bus | 34 // Called from ExportedObject when CheckLiveness() is exported as a D-Bus |
38 // method or failed to be exported. | 35 // method or failed to be exported. |
39 void OnExported(const std::string& interface_name, | 36 void OnExported(const std::string& interface_name, |
40 const std::string& method_name, | 37 const std::string& method_name, |
41 bool success); | 38 bool success); |
42 | 39 |
43 // Called on UI thread in response to a D-Bus request. | 40 // Called on UI thread in response to a D-Bus request. |
44 void GetKioskAppRequiredPlatformVersion( | 41 void GetKioskAppRequiredPlatformVersion( |
45 dbus::MethodCall* method_call, | 42 dbus::MethodCall* method_call, |
46 dbus::ExportedObject::ResponseSender response_sender); | 43 dbus::ExportedObject::ResponseSender response_sender); |
47 | 44 |
48 std::string service_interface_; | |
49 std::string method_name_; | |
50 | |
51 base::WeakPtrFactory<KioskInfoService> weak_ptr_factory_; | 45 base::WeakPtrFactory<KioskInfoService> weak_ptr_factory_; |
52 | 46 |
53 DISALLOW_COPY_AND_ASSIGN(KioskInfoService); | 47 DISALLOW_COPY_AND_ASSIGN(KioskInfoService); |
54 }; | 48 }; |
55 | 49 |
56 } // namespace chromeos | 50 } // namespace chromeos |
57 | 51 |
58 #endif // CHROME_BROWSER_CHROMEOS_DBUS_KIOSK_INFO_SERVICE_PROVIDER_H_ | 52 #endif // CHROME_BROWSER_CHROMEOS_DBUS_KIOSK_INFO_SERVICE_PROVIDER_H_ |
OLD | NEW |