| 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 |
| 52 virtual ~CrosDBusService(); | 56 virtual ~CrosDBusService(); |
| 53 | 57 |
| 54 protected: | 58 protected: |
| 55 CrosDBusService(); | 59 CrosDBusService(); |
| 56 | 60 |
| 57 private: | 61 private: |
| 58 friend class CrosDBusServiceTest; | 62 friend class CrosDBusServiceTest; |
| 59 | 63 |
| 60 // Creates, starts, and returns a real implementation of CrosDBusService that | 64 // Creates, starts, and returns a real implementation of CrosDBusService that |
| 61 // uses |bus|. Called by Create(), but can also be called directly by tests | 65 // uses |bus|. Called by Create(), but can also be called directly by tests |
| 62 // that need a non-stub implementation even when not running on a device. | 66 // that need a non-stub implementation even when not running on a device. |
| 63 static std::unique_ptr<CrosDBusService> CreateRealImpl( | 67 static std::unique_ptr<CrosDBusService> CreateRealImpl( |
| 64 dbus::Bus* bus, | 68 dbus::Bus* bus, |
| 65 const std::string& service_name, | 69 const std::string& service_name, |
| 66 const dbus::ObjectPath& object_path, | 70 const dbus::ObjectPath& object_path, |
| 67 ServiceProviderList service_providers); | 71 ServiceProviderList service_providers); |
| 68 | 72 |
| 69 DISALLOW_COPY_AND_ASSIGN(CrosDBusService); | 73 DISALLOW_COPY_AND_ASSIGN(CrosDBusService); |
| 70 }; | 74 }; |
| 71 | 75 |
| 72 } // namespace chromeos | 76 } // namespace chromeos |
| 73 | 77 |
| 74 #endif // CHROMEOS_DBUS_SERVICES_CROS_DBUS_SERVICE_H_ | 78 #endif // CHROMEOS_DBUS_SERVICES_CROS_DBUS_SERVICE_H_ |
| OLD | NEW |