| 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 namespace chromeos { | 12 namespace chromeos { |
| 13 | 13 |
| 14 class BluetoothAdapter; | 14 class BluetoothAdapter; |
| 15 class BluetoothDevice; | 15 class BluetoothDevice; |
| 16 | 16 |
| 17 } // namespace chromeos | 17 } // namespace chromeos |
| 18 #endif | 18 #endif |
| 19 | 19 |
| 20 namespace extensions { | 20 namespace extensions { |
| 21 namespace api { | 21 namespace api { |
| 22 | 22 |
| 23 class BluetoothExtensionFunction : public SyncExtensionFunction { | 23 class BluetoothExtensionFunction : public SyncExtensionFunction { |
| 24 protected: | 24 protected: |
| 25 virtual ~BluetoothExtensionFunction() {} |
| 26 |
| 25 #if defined(OS_CHROMEOS) | 27 #if defined(OS_CHROMEOS) |
| 26 const chromeos::BluetoothAdapter* adapter() const; | 28 const chromeos::BluetoothAdapter* adapter() const; |
| 27 chromeos::BluetoothAdapter* GetMutableAdapter(); | 29 chromeos::BluetoothAdapter* GetMutableAdapter(); |
| 28 #endif | 30 #endif |
| 29 }; | 31 }; |
| 30 | 32 |
| 31 class AsyncBluetoothExtensionFunction : public AsyncExtensionFunction { | 33 class AsyncBluetoothExtensionFunction : public AsyncExtensionFunction { |
| 32 protected: | 34 protected: |
| 35 virtual ~AsyncBluetoothExtensionFunction() {} |
| 36 |
| 33 #if defined(OS_CHROMEOS) | 37 #if defined(OS_CHROMEOS) |
| 34 const chromeos::BluetoothAdapter* adapter() const; | 38 const chromeos::BluetoothAdapter* adapter() const; |
| 35 chromeos::BluetoothAdapter* GetMutableAdapter(); | 39 chromeos::BluetoothAdapter* GetMutableAdapter(); |
| 36 #endif | 40 #endif |
| 37 }; | 41 }; |
| 38 | 42 |
| 39 class BluetoothIsAvailableFunction : public BluetoothExtensionFunction { | 43 class BluetoothIsAvailableFunction : public BluetoothExtensionFunction { |
| 40 public: | 44 public: |
| 45 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.isAvailable") |
| 46 |
| 47 protected: |
| 48 virtual ~BluetoothIsAvailableFunction() {} |
| 49 |
| 50 // ExtensionFunction: |
| 41 virtual bool RunImpl() OVERRIDE; | 51 virtual bool RunImpl() OVERRIDE; |
| 42 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.isAvailable") | |
| 43 }; | 52 }; |
| 44 | 53 |
| 45 class BluetoothIsPoweredFunction : public BluetoothExtensionFunction { | 54 class BluetoothIsPoweredFunction : public BluetoothExtensionFunction { |
| 46 public: | 55 public: |
| 56 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.isPowered") |
| 57 |
| 58 protected: |
| 59 virtual ~BluetoothIsPoweredFunction() {} |
| 60 |
| 61 // ExtensionFunction: |
| 47 virtual bool RunImpl() OVERRIDE; | 62 virtual bool RunImpl() OVERRIDE; |
| 48 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.isPowered") | |
| 49 }; | 63 }; |
| 50 | 64 |
| 51 class BluetoothGetAddressFunction : public BluetoothExtensionFunction { | 65 class BluetoothGetAddressFunction : public BluetoothExtensionFunction { |
| 52 public: | 66 public: |
| 67 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.getAddress") |
| 68 |
| 69 protected: |
| 70 virtual ~BluetoothGetAddressFunction() {} |
| 71 |
| 72 // ExtensionFunction: |
| 53 virtual bool RunImpl() OVERRIDE; | 73 virtual bool RunImpl() OVERRIDE; |
| 54 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.getAddress") | |
| 55 }; | 74 }; |
| 56 | 75 |
| 57 class BluetoothGetDevicesWithServiceUUIDFunction | 76 class BluetoothGetDevicesWithServiceUUIDFunction |
| 58 : public BluetoothExtensionFunction { | 77 : public BluetoothExtensionFunction { |
| 59 public: | 78 public: |
| 60 virtual bool RunImpl() OVERRIDE; | |
| 61 DECLARE_EXTENSION_FUNCTION_NAME( | 79 DECLARE_EXTENSION_FUNCTION_NAME( |
| 62 "experimental.bluetooth.getDevicesWithServiceUUID") | 80 "experimental.bluetooth.getDevicesWithServiceUUID") |
| 81 |
| 82 protected: |
| 83 virtual ~BluetoothGetDevicesWithServiceUUIDFunction() {} |
| 84 |
| 85 // ExtensionFunction: |
| 86 virtual bool RunImpl() OVERRIDE; |
| 63 }; | 87 }; |
| 64 | 88 |
| 65 class BluetoothGetDevicesWithServiceNameFunction | 89 class BluetoothGetDevicesWithServiceNameFunction |
| 66 : public AsyncBluetoothExtensionFunction { | 90 : public AsyncBluetoothExtensionFunction { |
| 67 public: | 91 public: |
| 68 virtual bool RunImpl() OVERRIDE; | |
| 69 DECLARE_EXTENSION_FUNCTION_NAME( | 92 DECLARE_EXTENSION_FUNCTION_NAME( |
| 70 "experimental.bluetooth.getDevicesWithServiceName") | 93 "experimental.bluetooth.getDevicesWithServiceName") |
| 71 | 94 |
| 72 #if defined(OS_CHROMEOS) | 95 #if defined(OS_CHROMEOS) |
| 73 BluetoothGetDevicesWithServiceNameFunction(); | 96 BluetoothGetDevicesWithServiceNameFunction(); |
| 97 #endif |
| 74 | 98 |
| 99 protected: |
| 100 virtual ~BluetoothGetDevicesWithServiceNameFunction() {} |
| 101 |
| 102 // ExtensionFunction: |
| 103 virtual bool RunImpl() OVERRIDE; |
| 104 |
| 105 #if defined(OS_CHROMEOS) |
| 75 private: | 106 private: |
| 76 void AddDeviceIfTrue( | 107 void AddDeviceIfTrue( |
| 77 ListValue* list, const chromeos::BluetoothDevice* device, bool result); | 108 ListValue* list, const chromeos::BluetoothDevice* device, bool result); |
| 78 | 109 |
| 79 int callbacks_pending_; | 110 int callbacks_pending_; |
| 80 #endif | 111 #endif |
| 81 }; | 112 }; |
| 82 | 113 |
| 83 class BluetoothDisconnectFunction : public BluetoothExtensionFunction { | 114 class BluetoothDisconnectFunction : public BluetoothExtensionFunction { |
| 84 public: | 115 public: |
| 116 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.disconnect") |
| 117 |
| 118 protected: |
| 119 virtual ~BluetoothDisconnectFunction() {} |
| 120 |
| 121 // ExtensionFunction: |
| 85 virtual bool RunImpl() OVERRIDE; | 122 virtual bool RunImpl() OVERRIDE; |
| 86 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.disconnect") | |
| 87 }; | 123 }; |
| 88 | 124 |
| 89 class BluetoothReadFunction : public BluetoothExtensionFunction { | 125 class BluetoothReadFunction : public BluetoothExtensionFunction { |
| 90 public: | 126 public: |
| 127 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.read") |
| 128 |
| 129 protected: |
| 130 virtual ~BluetoothReadFunction() {} |
| 131 |
| 132 // ExtensionFunction: |
| 91 virtual bool RunImpl() OVERRIDE; | 133 virtual bool RunImpl() OVERRIDE; |
| 92 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.read") | |
| 93 }; | 134 }; |
| 94 | 135 |
| 95 class BluetoothSetOutOfBandPairingDataFunction | 136 class BluetoothSetOutOfBandPairingDataFunction |
| 96 : public BluetoothExtensionFunction { | 137 : public BluetoothExtensionFunction { |
| 97 public: | 138 public: |
| 98 virtual bool RunImpl() OVERRIDE; | |
| 99 DECLARE_EXTENSION_FUNCTION_NAME( | 139 DECLARE_EXTENSION_FUNCTION_NAME( |
| 100 "experimental.bluetooth.setOutOfBandPairingData") | 140 "experimental.bluetooth.setOutOfBandPairingData") |
| 141 |
| 142 protected: |
| 143 virtual ~BluetoothSetOutOfBandPairingDataFunction() {} |
| 144 |
| 145 // ExtensionFunction: |
| 146 virtual bool RunImpl() OVERRIDE; |
| 101 }; | 147 }; |
| 102 | 148 |
| 103 class BluetoothGetOutOfBandPairingDataFunction | 149 class BluetoothGetOutOfBandPairingDataFunction |
| 104 : public BluetoothExtensionFunction { | 150 : public BluetoothExtensionFunction { |
| 105 public: | 151 public: |
| 106 virtual bool RunImpl() OVERRIDE; | |
| 107 DECLARE_EXTENSION_FUNCTION_NAME( | 152 DECLARE_EXTENSION_FUNCTION_NAME( |
| 108 "experimental.bluetooth.getOutOfBandPairingData") | 153 "experimental.bluetooth.getOutOfBandPairingData") |
| 154 |
| 155 protected: |
| 156 virtual ~BluetoothGetOutOfBandPairingDataFunction() {} |
| 157 |
| 158 // ExtensionFunction: |
| 159 virtual bool RunImpl() OVERRIDE; |
| 109 }; | 160 }; |
| 110 | 161 |
| 111 class BluetoothWriteFunction : public BluetoothExtensionFunction { | 162 class BluetoothWriteFunction : public BluetoothExtensionFunction { |
| 112 public: | 163 public: |
| 164 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.write") |
| 165 |
| 166 private: |
| 167 virtual ~BluetoothWriteFunction() {} |
| 168 |
| 169 // ExtensionFunction: |
| 113 virtual bool RunImpl() OVERRIDE; | 170 virtual bool RunImpl() OVERRIDE; |
| 114 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.write") | |
| 115 }; | 171 }; |
| 116 | 172 |
| 117 class BluetoothConnectFunction : public BluetoothExtensionFunction { | 173 class BluetoothConnectFunction : public BluetoothExtensionFunction { |
| 118 public: | 174 public: |
| 175 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.connect") |
| 176 |
| 177 protected: |
| 178 virtual ~BluetoothConnectFunction() {} |
| 179 |
| 180 // ExtensionFunction: |
| 119 virtual bool RunImpl() OVERRIDE; | 181 virtual bool RunImpl() OVERRIDE; |
| 120 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.connect") | |
| 121 }; | 182 }; |
| 122 | 183 |
| 123 } // namespace api | 184 } // namespace api |
| 124 } // namespace extensions | 185 } // namespace extensions |
| 125 | 186 |
| 126 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_H_ | 187 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_H_ |
| OLD | NEW |