| 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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/extensions/api/api_function.h" | 10 #include "chrome/browser/extensions/api/api_function.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 public: | 124 public: |
| 125 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.disconnect") | 125 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.disconnect") |
| 126 | 126 |
| 127 protected: | 127 protected: |
| 128 virtual ~BluetoothDisconnectFunction() {} | 128 virtual ~BluetoothDisconnectFunction() {} |
| 129 | 129 |
| 130 // ExtensionFunction: | 130 // ExtensionFunction: |
| 131 virtual bool RunImpl() OVERRIDE; | 131 virtual bool RunImpl() OVERRIDE; |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 class BluetoothReadFunction : public AsyncAPIFunction { | 134 class BluetoothReadFunction : public AsyncApiFunction { |
| 135 public: | 135 public: |
| 136 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.read") | 136 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.read") |
| 137 BluetoothReadFunction(); | 137 BluetoothReadFunction(); |
| 138 | 138 |
| 139 protected: | 139 protected: |
| 140 virtual ~BluetoothReadFunction(); | 140 virtual ~BluetoothReadFunction(); |
| 141 | 141 |
| 142 // AsyncAPIFunction: | 142 // AsyncApiFunction: |
| 143 virtual bool Prepare() OVERRIDE; | 143 virtual bool Prepare() OVERRIDE; |
| 144 virtual bool Respond() OVERRIDE; | 144 virtual bool Respond() OVERRIDE; |
| 145 virtual void Work() OVERRIDE; | 145 virtual void Work() OVERRIDE; |
| 146 | 146 |
| 147 private: | 147 private: |
| 148 #if defined(OS_CHROMEOS) | 148 #if defined(OS_CHROMEOS) |
| 149 bool success_; | 149 bool success_; |
| 150 scoped_refptr<chromeos::BluetoothSocket> socket_; | 150 scoped_refptr<chromeos::BluetoothSocket> socket_; |
| 151 #endif | 151 #endif |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 class BluetoothWriteFunction : public AsyncAPIFunction { | 154 class BluetoothWriteFunction : public AsyncApiFunction { |
| 155 public: | 155 public: |
| 156 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.write") | 156 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bluetooth.write") |
| 157 BluetoothWriteFunction(); | 157 BluetoothWriteFunction(); |
| 158 | 158 |
| 159 protected: | 159 protected: |
| 160 virtual ~BluetoothWriteFunction(); | 160 virtual ~BluetoothWriteFunction(); |
| 161 | 161 |
| 162 // AsyncAPIFunction: | 162 // AsyncApiFunction: |
| 163 virtual bool Prepare() OVERRIDE; | 163 virtual bool Prepare() OVERRIDE; |
| 164 virtual bool Respond() OVERRIDE; | 164 virtual bool Respond() OVERRIDE; |
| 165 virtual void Work() OVERRIDE; | 165 virtual void Work() OVERRIDE; |
| 166 | 166 |
| 167 private: | 167 private: |
| 168 #if defined(OS_CHROMEOS) | 168 #if defined(OS_CHROMEOS) |
| 169 bool success_; | 169 bool success_; |
| 170 const base::BinaryValue* data_to_write_; // memory is owned by args_ | 170 const base::BinaryValue* data_to_write_; // memory is owned by args_ |
| 171 scoped_refptr<chromeos::BluetoothSocket> socket_; | 171 scoped_refptr<chromeos::BluetoothSocket> socket_; |
| 172 #endif | 172 #endif |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 private: | 239 private: |
| 240 void OnSuccessCallback(); | 240 void OnSuccessCallback(); |
| 241 void OnErrorCallback(); | 241 void OnErrorCallback(); |
| 242 #endif | 242 #endif |
| 243 }; | 243 }; |
| 244 | 244 |
| 245 } // namespace api | 245 } // namespace api |
| 246 } // namespace extensions | 246 } // namespace extensions |
| 247 | 247 |
| 248 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_H_ | 248 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_H_ |
| OLD | NEW |