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 DEVICE_BLUETOOTH_DBUS_BLUEZ_DBUS_MANAGER_H_ | 5 #ifndef DEVICE_BLUETOOTH_DBUS_BLUEZ_DBUS_MANAGER_H_ |
6 #define DEVICE_BLUETOOTH_DBUS_BLUEZ_DBUS_MANAGER_H_ | 6 #define DEVICE_BLUETOOTH_DBUS_BLUEZ_DBUS_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // shutdown. However, to be extra cautious, clients should use | 50 // shutdown. However, to be extra cautious, clients should use |
51 // WeakPtrFactory when creating callbacks that run on UI thread. See | 51 // WeakPtrFactory when creating callbacks that run on UI thread. See |
52 // session_manager_client.cc for examples. | 52 // session_manager_client.cc for examples. |
53 // | 53 // |
54 class DEVICE_BLUETOOTH_EXPORT BluezDBusManager { | 54 class DEVICE_BLUETOOTH_EXPORT BluezDBusManager { |
55 public: | 55 public: |
56 // Sets the global instance. Must be called before any calls to Get(). | 56 // Sets the global instance. Must be called before any calls to Get(). |
57 // We explicitly initialize and shut down the global object, rather than | 57 // We explicitly initialize and shut down the global object, rather than |
58 // making it a Singleton, to ensure clean startup and shutdown. | 58 // making it a Singleton, to ensure clean startup and shutdown. |
59 // This will initialize real or stub DBusClients depending on command-line | 59 // This will initialize real or stub DBusClients depending on command-line |
60 // arguments and whether this process runs in a ChromeOS environment. | 60 // arguments and whether this process runs in a real or test environment. |
61 static void Initialize(dbus::Bus* bus, bool use_dbus_stub); | 61 static void Initialize(dbus::Bus* bus, bool use_dbus_stub); |
62 | 62 |
63 // Returns a BluezDBusManagerSetter instance that allows tests to | 63 // Returns a BluezDBusManagerSetter instance that allows tests to |
64 // replace individual D-Bus clients with their own implementations. | 64 // replace individual D-Bus clients with their own implementations. |
65 // Also initializes the main BluezDBusManager for testing if necessary. | 65 // Also initializes the main BluezDBusManager for testing if necessary. |
66 static scoped_ptr<BluezDBusManagerSetter> GetSetterForTesting(); | 66 static scoped_ptr<BluezDBusManagerSetter> GetSetterForTesting(); |
67 | 67 |
68 // Returns true if BluezDBusManager has been initialized. Call this to | 68 // Returns true if BluezDBusManager has been initialized. Call this to |
69 // avoid initializing + shutting down BluezDBusManager more than once. | 69 // avoid initializing + shutting down BluezDBusManager more than once. |
70 static bool IsInitialized(); | 70 static bool IsInitialized(); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 friend class BluezDBusManager; | 149 friend class BluezDBusManager; |
150 | 150 |
151 BluezDBusManagerSetter(); | 151 BluezDBusManagerSetter(); |
152 | 152 |
153 DISALLOW_COPY_AND_ASSIGN(BluezDBusManagerSetter); | 153 DISALLOW_COPY_AND_ASSIGN(BluezDBusManagerSetter); |
154 }; | 154 }; |
155 | 155 |
156 } // namespace bluez | 156 } // namespace bluez |
157 | 157 |
158 #endif // DEVICE_BLUETOOTH_DBUS_BLUEZ_DBUS_MANAGER_H_ | 158 #endif // DEVICE_BLUETOOTH_DBUS_BLUEZ_DBUS_MANAGER_H_ |
OLD | NEW |