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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_DBUS_CROS_DBUS_SERVICE_H_
6 #define CHROME_BROWSER_CHROMEOS_DBUS_CROS_DBUS_SERVICE_H_
10 #include "base/memory/ref_counted.h"
11 #include "base/threading/platform_thread.h"
20 // CrosDBusService is used to run a D-Bus service inside Chrome for Chrome
21 // OS. The service will be registered as follows:
23 // Service name: org.chromium.LibCrosService (kLibCrosServiceName)
24 // Object path: chromium/LibCrosService (kLibCrosServicePath)
26 // For historical reasons, the rather irrelevant name "LibCrosService" is
27 // used in the D-Bus constants such as the service name.
29 // CrosDBusService exports D-Bus methods through service provider classes
30 // that implement CrosDBusService::ServiceProviderInterface.
32 class CrosDBusService
{
34 // CrosDBusService consists of service providers that implement this
36 class ServiceProviderInterface
{
38 // Starts the service provider. |exported_object| is used to export
41 scoped_refptr
<dbus::ExportedObject
> exported_object
) = 0;
43 virtual ~ServiceProviderInterface();
46 // Initializes the global instance.
47 static void Initialize();
48 // Destroys the global instance.
49 static void Shutdown();
52 virtual ~CrosDBusService();
55 // Initializes the global instance for testing. Takes ownership of
56 // |proxy_resolution_service|.
57 friend class CrosDBusServiceTest
;
58 static void InitializeForTesting(
60 ServiceProviderInterface
* proxy_resolution_service
);
65 #endif // CHROME_BROWSER_CHROMEOS_DBUS_CROS_DBUS_SERVICE_H_