Fix infinite recursion on hiding panel when created during fullscreen mode.
[chromium-blink-merge.git] / chrome / browser / chromeos / dbus / cros_dbus_service.h
blob26e4ffc944e9f87cc426048a8cae932715e1c9d9
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_
8 #include <vector>
10 #include "base/memory/ref_counted.h"
11 #include "base/threading/platform_thread.h"
13 namespace dbus {
14 class Bus;
15 class ExportedObject;
18 namespace chromeos {
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 {
33 public:
34 // CrosDBusService consists of service providers that implement this
35 // interface.
36 class ServiceProviderInterface {
37 public:
38 // Starts the service provider. |exported_object| is used to export
39 // D-Bus methods.
40 virtual void Start(
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();
51 protected:
52 virtual ~CrosDBusService();
54 private:
55 // Initializes the global instance for testing. Takes ownership of
56 // |proxy_resolution_service|.
57 friend class CrosDBusServiceTest;
58 static void InitializeForTesting(
59 dbus::Bus* bus,
60 ServiceProviderInterface* proxy_resolution_service);
63 } // namespace
65 #endif // CHROME_BROWSER_CHROMEOS_DBUS_CROS_DBUS_SERVICE_H_