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