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_CROS_DBUS_SERVICE_H_ | 5 #ifndef CHROMEOS_DBUS_SERVICES_CROS_DBUS_SERVICE_H_ |
6 #define CHROMEOS_DBUS_SERVICES_CROS_DBUS_SERVICE_H_ | 6 #define CHROMEOS_DBUS_SERVICES_CROS_DBUS_SERVICE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 std::vector<std::unique_ptr<ServiceProviderInterface>>; | 42 std::vector<std::unique_ptr<ServiceProviderInterface>>; |
43 | 43 |
44 // Creates, starts, and returns a new instance owning |service_name| and | 44 // Creates, starts, and returns a new instance owning |service_name| and |
45 // exporting |service_providers|'s methods on |object_path|. Static so a stub | 45 // exporting |service_providers|'s methods on |object_path|. Static so a stub |
46 // implementation can be used when not running on a device. | 46 // implementation can be used when not running on a device. |
47 static std::unique_ptr<CrosDBusService> Create( | 47 static std::unique_ptr<CrosDBusService> Create( |
48 const std::string& service_name, | 48 const std::string& service_name, |
49 const dbus::ObjectPath& object_path, | 49 const dbus::ObjectPath& object_path, |
50 ServiceProviderList service_providers); | 50 ServiceProviderList service_providers); |
51 | 51 |
52 // Creates a ServiceProviderList containing a single provider. | |
53 static ServiceProviderList CreateServiceProviderList( | |
54 std::unique_ptr<ServiceProviderInterface> provider); | |
55 | |
56 virtual ~CrosDBusService(); | 52 virtual ~CrosDBusService(); |
57 | 53 |
58 protected: | 54 protected: |
59 CrosDBusService(); | 55 CrosDBusService(); |
60 | 56 |
61 private: | 57 private: |
62 friend class CrosDBusServiceTest; | 58 friend class CrosDBusServiceTest; |
63 | 59 |
64 // Creates, starts, and returns a real implementation of CrosDBusService that | 60 // Creates, starts, and returns a real implementation of CrosDBusService that |
65 // uses |bus|. Called by Create(), but can also be called directly by tests | 61 // uses |bus|. Called by Create(), but can also be called directly by tests |
66 // that need a non-stub implementation even when not running on a device. | 62 // that need a non-stub implementation even when not running on a device. |
67 static std::unique_ptr<CrosDBusService> CreateRealImpl( | 63 static std::unique_ptr<CrosDBusService> CreateRealImpl( |
68 dbus::Bus* bus, | 64 dbus::Bus* bus, |
69 const std::string& service_name, | 65 const std::string& service_name, |
70 const dbus::ObjectPath& object_path, | 66 const dbus::ObjectPath& object_path, |
71 ServiceProviderList service_providers); | 67 ServiceProviderList service_providers); |
72 | 68 |
73 DISALLOW_COPY_AND_ASSIGN(CrosDBusService); | 69 DISALLOW_COPY_AND_ASSIGN(CrosDBusService); |
74 }; | 70 }; |
75 | 71 |
76 } // namespace chromeos | 72 } // namespace chromeos |
77 | 73 |
78 #endif // CHROMEOS_DBUS_SERVICES_CROS_DBUS_SERVICE_H_ | 74 #endif // CHROMEOS_DBUS_SERVICES_CROS_DBUS_SERVICE_H_ |
OLD | NEW |