Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(418)

Side by Side Diff: chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_connection.h

Issue 2370373002: Move chrome.bluetoothLowEnergy out of //chrome. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 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.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_ CONNECTION_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_ CONNECTION_H_
7
8 #include <memory>
9
10 #include "base/macros.h"
11 #include "device/bluetooth/bluetooth_gatt_connection.h"
12 #include "extensions/browser/api/api_resource.h"
13 #include "extensions/browser/api/api_resource_manager.h"
14
15 namespace extensions {
16
17 // An ApiResource wrapper for a device::BluetoothGattConnection.
18 class BluetoothLowEnergyConnection : public ApiResource {
19 public:
20 explicit BluetoothLowEnergyConnection(
21 bool persistent,
22 const std::string& owner_extension_id,
23 std::unique_ptr<device::BluetoothGattConnection> connection);
24 ~BluetoothLowEnergyConnection() override;
25
26 // Returns a pointer to the underlying connection object.
27 device::BluetoothGattConnection* GetConnection() const;
28
29 // ApiResource override.
30 bool IsPersistent() const override;
31
32 // This resource should be managed on the UI thread.
33 static const content::BrowserThread::ID kThreadId =
34 content::BrowserThread::UI;
35
36 private:
37 friend class ApiResourceManager<BluetoothLowEnergyConnection>;
38 static const char* service_name() {
39 return "BluetoothLowEnergyConnectionManager";
40 }
41
42 // True, if this resource should be persistent.
43 bool persistent_;
44
45 // The connection is owned by this instance and will automatically disconnect
46 // when deleted.
47 std::unique_ptr<device::BluetoothGattConnection> connection_;
48
49 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyConnection);
50 };
51
52 } // namespace extensions
53
54 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENER GY_CONNECTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698