OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_CROS_DBUS_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DBUS_CROS_DBUS_SERVICE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DBUS_CROS_DBUS_SERVICE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DBUS_CROS_DBUS_SERVICE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 class ServiceProviderInterface { | 38 class ServiceProviderInterface { |
39 public: | 39 public: |
40 // Starts the service provider. |exported_object| is used to export | 40 // Starts the service provider. |exported_object| is used to export |
41 // D-Bus methods. | 41 // D-Bus methods. |
42 virtual void Start( | 42 virtual void Start( |
43 scoped_refptr<dbus::ExportedObject> exported_object) = 0; | 43 scoped_refptr<dbus::ExportedObject> exported_object) = 0; |
44 | 44 |
45 virtual ~ServiceProviderInterface(); | 45 virtual ~ServiceProviderInterface(); |
46 }; | 46 }; |
47 | 47 |
| 48 // Initializes the global instance. |
| 49 static void Initialize(); |
| 50 // Destroys the global instance. |
| 51 static void Shutdown(); |
| 52 |
| 53 protected: |
48 virtual ~CrosDBusService(); | 54 virtual ~CrosDBusService(); |
49 | 55 |
50 // Starts the D-Bus service. | |
51 virtual void Start() = 0; | |
52 | |
53 // Creates the instance. | |
54 static CrosDBusService* Create(dbus::Bus* bus); | |
55 | |
56 private: | 56 private: |
57 // Creates the instance for testing. Takes the ownership of | 57 // Initializes the global instance for testing. Takes the ownership of |
58 // |proxy_resolution_service|. | 58 // |proxy_resolution_service|. |
59 friend class CrosDBusServiceTest; | 59 friend class CrosDBusServiceTest; |
60 static CrosDBusService* CreateForTesting( | 60 static void InitializeForTesting( |
61 dbus::Bus* bus, | 61 dbus::Bus* bus, |
62 ServiceProviderInterface* proxy_resolution_service); | 62 ServiceProviderInterface* proxy_resolution_service); |
63 }; | 63 }; |
64 | 64 |
65 } // namespace | 65 } // namespace |
66 | 66 |
67 #endif // CHROME_BROWSER_CHROMEOS_DBUS_CROS_DBUS_SERVICE_H_ | 67 #endif // CHROME_BROWSER_CHROMEOS_DBUS_CROS_DBUS_SERVICE_H_ |
OLD | NEW |