| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_API_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_API_H_ |
| 6 #define EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_API_H_ | 6 #define EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_API_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 public: | 431 public: |
| 432 BluetoothLowEnergyAdvertisementFunction(); | 432 BluetoothLowEnergyAdvertisementFunction(); |
| 433 | 433 |
| 434 protected: | 434 protected: |
| 435 ~BluetoothLowEnergyAdvertisementFunction() override; | 435 ~BluetoothLowEnergyAdvertisementFunction() override; |
| 436 | 436 |
| 437 // Takes ownership. | 437 // Takes ownership. |
| 438 int AddAdvertisement(BluetoothApiAdvertisement* advertisement); | 438 int AddAdvertisement(BluetoothApiAdvertisement* advertisement); |
| 439 BluetoothApiAdvertisement* GetAdvertisement(int advertisement_id); | 439 BluetoothApiAdvertisement* GetAdvertisement(int advertisement_id); |
| 440 void RemoveAdvertisement(int advertisement_id); | 440 void RemoveAdvertisement(int advertisement_id); |
| 441 const base::hash_set<int>* GetAdvertisementIds(); |
| 441 | 442 |
| 442 // ExtensionFunction override. | 443 // ExtensionFunction override. |
| 443 bool RunAsync() override; | 444 bool RunAsync() override; |
| 444 | 445 |
| 445 private: | 446 private: |
| 446 void Initialize(); | 447 void Initialize(); |
| 447 | 448 |
| 448 ApiResourceManager<BluetoothApiAdvertisement>* advertisements_manager_; | 449 ApiResourceManager<BluetoothApiAdvertisement>* advertisements_manager_; |
| 449 | 450 |
| 450 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyAdvertisementFunction); | 451 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyAdvertisementFunction); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 478 | 479 |
| 479 // BluetoothLowEnergyExtensionFunctionDeprecated override. | 480 // BluetoothLowEnergyExtensionFunctionDeprecated override. |
| 480 bool DoWork() override; | 481 bool DoWork() override; |
| 481 | 482 |
| 482 private: | 483 private: |
| 483 void SuccessCallback(int advertisement_id); | 484 void SuccessCallback(int advertisement_id); |
| 484 void ErrorCallback(int advertisement_id, | 485 void ErrorCallback(int advertisement_id, |
| 485 device::BluetoothAdvertisement::ErrorCode status); | 486 device::BluetoothAdvertisement::ErrorCode status); |
| 486 }; | 487 }; |
| 487 | 488 |
| 489 class BluetoothLowEnergyResetAdvertisingFunction |
| 490 : public BluetoothLowEnergyAdvertisementFunction { |
| 491 public: |
| 492 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.resetAdvertising", |
| 493 BLUETOOTHLOWENERGY_RESETADVERTISING); |
| 494 |
| 495 protected: |
| 496 ~BluetoothLowEnergyResetAdvertisingFunction() override {} |
| 497 |
| 498 // BluetoothLowEnergyExtensionFunctionDeprecated override. |
| 499 bool DoWork() override; |
| 500 |
| 501 private: |
| 502 void SuccessCallback(); |
| 503 void ErrorCallback(device::BluetoothAdvertisement::ErrorCode status); |
| 504 }; |
| 505 |
| 488 class BluetoothLowEnergySetAdvertisingIntervalFunction | 506 class BluetoothLowEnergySetAdvertisingIntervalFunction |
| 489 : public BLEPeripheralExtensionFunction< | 507 : public BLEPeripheralExtensionFunction< |
| 490 extensions::api::bluetooth_low_energy::SetAdvertisingInterval:: | 508 extensions::api::bluetooth_low_energy::SetAdvertisingInterval:: |
| 491 Params> { | 509 Params> { |
| 492 public: | 510 public: |
| 493 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.setAdvertisingInterval", | 511 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.setAdvertisingInterval", |
| 494 BLUETOOTHLOWENERGY_SETADVERTISINGINTERVAL); | 512 BLUETOOTHLOWENERGY_SETADVERTISINGINTERVAL); |
| 495 | 513 |
| 496 protected: | 514 protected: |
| 497 ~BluetoothLowEnergySetAdvertisingIntervalFunction() override {} | 515 ~BluetoothLowEnergySetAdvertisingIntervalFunction() override {} |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 ~BluetoothLowEnergySendRequestResponseFunction() override {} | 643 ~BluetoothLowEnergySendRequestResponseFunction() override {} |
| 626 | 644 |
| 627 // BluetoothLowEnergyPeripheralExtensionFunction override. | 645 // BluetoothLowEnergyPeripheralExtensionFunction override. |
| 628 void DoWork() override; | 646 void DoWork() override; |
| 629 }; | 647 }; |
| 630 | 648 |
| 631 } // namespace api | 649 } // namespace api |
| 632 } // namespace extensions | 650 } // namespace extensions |
| 633 | 651 |
| 634 #endif // EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_API_
H_ | 652 #endif // EXTENSIONS_BROWSER_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_API_
H_ |
| OLD | NEW |