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