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 CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/extensions/extension_function.h" | 9 #include "chrome/browser/extensions/extension_function.h" |
10 | 10 |
11 #if defined(OS_CHROMEOS) | 11 #if defined(OS_CHROMEOS) |
| 12 #include "base/memory/ref_counted.h" |
12 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
13 | 14 |
14 namespace chromeos { | 15 namespace chromeos { |
15 | 16 |
16 class BluetoothAdapter; | 17 class BluetoothAdapter; |
17 class BluetoothDevice; | 18 class BluetoothDevice; |
| 19 class BluetoothSocket; |
18 | 20 |
19 } // namespace chromeos | 21 } // namespace chromeos |
20 #endif | 22 #endif |
21 | 23 |
22 namespace extensions { | 24 namespace extensions { |
23 namespace api { | 25 namespace api { |
24 | 26 |
25 class BluetoothExtensionFunction : public SyncExtensionFunction { | 27 class BluetoothExtensionFunction : public SyncExtensionFunction { |
26 protected: | 28 protected: |
27 #if defined(OS_CHROMEOS) | 29 #if defined(OS_CHROMEOS) |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // Protection for callbacks_pending_ and results_ | 83 // Protection for callbacks_pending_ and results_ |
82 base::Lock lock_; | 84 base::Lock lock_; |
83 | 85 |
84 base::WeakPtrFactory<BluetoothGetDevicesWithServiceNameFunction> | 86 base::WeakPtrFactory<BluetoothGetDevicesWithServiceNameFunction> |
85 weak_ptr_factory_; | 87 weak_ptr_factory_; |
86 | 88 |
87 int callbacks_pending_; | 89 int callbacks_pending_; |
88 #endif | 90 #endif |
89 }; | 91 }; |
90 | 92 |
| 93 class BluetoothConnectFunction : public BluetoothExtensionFunction { |
| 94 public: |
| 95 virtual bool RunImpl() OVERRIDE; |
| 96 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.connect") |
| 97 |
| 98 private: |
| 99 #if defined(OS_CHROMEOS) |
| 100 void ConnectToServiceCallback( |
| 101 const chromeos::BluetoothDevice* device, |
| 102 const std::string& service_uuid, |
| 103 scoped_refptr<chromeos::BluetoothSocket> socket); |
| 104 #endif |
| 105 }; |
| 106 |
91 class BluetoothDisconnectFunction : public BluetoothExtensionFunction { | 107 class BluetoothDisconnectFunction : public BluetoothExtensionFunction { |
92 public: | 108 public: |
93 virtual bool RunImpl() OVERRIDE; | 109 virtual bool RunImpl() OVERRIDE; |
94 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.disconnect") | 110 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.disconnect") |
95 }; | 111 }; |
96 | 112 |
97 class BluetoothReadFunction : public BluetoothExtensionFunction { | 113 class BluetoothReadFunction : public BluetoothExtensionFunction { |
98 public: | 114 public: |
99 virtual bool RunImpl() OVERRIDE; | 115 virtual bool RunImpl() OVERRIDE; |
100 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.read") | 116 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.read") |
(...skipping 14 matching lines...) Expand all Loading... |
115 DECLARE_EXTENSION_FUNCTION_NAME( | 131 DECLARE_EXTENSION_FUNCTION_NAME( |
116 "experimental.bluetooth.getOutOfBandPairingData") | 132 "experimental.bluetooth.getOutOfBandPairingData") |
117 }; | 133 }; |
118 | 134 |
119 class BluetoothWriteFunction : public BluetoothExtensionFunction { | 135 class BluetoothWriteFunction : public BluetoothExtensionFunction { |
120 public: | 136 public: |
121 virtual bool RunImpl() OVERRIDE; | 137 virtual bool RunImpl() OVERRIDE; |
122 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.write") | 138 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.write") |
123 }; | 139 }; |
124 | 140 |
125 class BluetoothConnectFunction : public BluetoothExtensionFunction { | |
126 public: | |
127 virtual bool RunImpl() OVERRIDE; | |
128 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.connect") | |
129 }; | |
130 | |
131 } // namespace api | 141 } // namespace api |
132 } // namespace extensions | 142 } // namespace extensions |
133 | 143 |
134 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_H_ | 144 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_H_ |
OLD | NEW |