Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.h

Issue 2353133005: Add the chrome.bluetoothLowEnergy.setAdvertisingInterval API. (Closed)
Patch Set: . Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_ API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_ API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_ API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_ API_H_
7 7
8 #include <memory>
8 #include <string> 9 #include <string>
9 10
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
12 #include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_api_adver tisement.h" 13 #include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_api_adver tisement.h"
13 #include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energ y_event_router.h" 14 #include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energ y_event_router.h"
14 #include "content/public/browser/browser_context.h" 15 #include "content/public/browser/browser_context.h"
15 #include "device/bluetooth/bluetooth_advertisement.h" 16 #include "device/bluetooth/bluetooth_advertisement.h"
16 #include "extensions/browser/api/api_resource_manager.h" 17 #include "extensions/browser/api/api_resource_manager.h"
17 #include "extensions/browser/browser_context_keyed_api_factory.h" 18 #include "extensions/browser/browser_context_keyed_api_factory.h"
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 458
458 protected: 459 protected:
459 ~BluetoothLowEnergyRegisterAdvertisementFunction() override {} 460 ~BluetoothLowEnergyRegisterAdvertisementFunction() override {}
460 461
461 // BluetoothLowEnergyExtensionFunctionDeprecated override. 462 // BluetoothLowEnergyExtensionFunctionDeprecated override.
462 bool DoWork() override; 463 bool DoWork() override;
463 464
464 private: 465 private:
465 void SuccessCallback(scoped_refptr<device::BluetoothAdvertisement>); 466 void SuccessCallback(scoped_refptr<device::BluetoothAdvertisement>);
466 void ErrorCallback(device::BluetoothAdvertisement::ErrorCode status); 467 void ErrorCallback(device::BluetoothAdvertisement::ErrorCode status);
467
468 // The instance ID of the requested descriptor.
469 std::string instance_id_;
470 }; 468 };
471 469
472 class BluetoothLowEnergyUnregisterAdvertisementFunction 470 class BluetoothLowEnergyUnregisterAdvertisementFunction
473 : public BluetoothLowEnergyAdvertisementFunction { 471 : public BluetoothLowEnergyAdvertisementFunction {
474 public: 472 public:
475 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.unregisterAdvertisement", 473 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.unregisterAdvertisement",
476 BLUETOOTHLOWENERGY_UNREGISTERADVERTISEMENT); 474 BLUETOOTHLOWENERGY_UNREGISTERADVERTISEMENT);
477 475
478 protected: 476 protected:
479 ~BluetoothLowEnergyUnregisterAdvertisementFunction() override {} 477 ~BluetoothLowEnergyUnregisterAdvertisementFunction() override {}
480 478
481 // BluetoothLowEnergyExtensionFunctionDeprecated override. 479 // BluetoothLowEnergyExtensionFunctionDeprecated override.
482 bool DoWork() override; 480 bool DoWork() override;
483 481
484 private: 482 private:
485 void SuccessCallback(int advertisement_id); 483 void SuccessCallback(int advertisement_id);
486 void ErrorCallback(int advertisement_id, 484 void ErrorCallback(int advertisement_id,
487 device::BluetoothAdvertisement::ErrorCode status); 485 device::BluetoothAdvertisement::ErrorCode status);
486 };
488 487
489 // The instance ID of the requested descriptor. 488 class BluetoothLowEnergySetAdvertisingIntervalFunction
490 std::string instance_id_; 489 : public BLEPeripheralExtensionFunction<
490 extensions::api::bluetooth_low_energy::SetAdvertisingInterval::
491 Params> {
492 public:
493 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.setAdvertisingInterval",
494 BLUETOOTHLOWENERGY_SETADVERTISINGINTERVAL);
495
496 protected:
497 ~BluetoothLowEnergySetAdvertisingIntervalFunction() override {}
498
499 // BluetoothLowEnergyExtensionFunctionDeprecated override.
500 void DoWork() override;
501
502 private:
503 void SuccessCallback();
504 void ErrorCallback(device::BluetoothAdvertisement::ErrorCode status);
491 }; 505 };
492 506
493 class BluetoothLowEnergyCreateServiceFunction 507 class BluetoothLowEnergyCreateServiceFunction
494 : public BLEPeripheralExtensionFunction< 508 : public BLEPeripheralExtensionFunction<
495 extensions::api::bluetooth_low_energy::CreateService::Params> { 509 extensions::api::bluetooth_low_energy::CreateService::Params> {
496 public: 510 public:
497 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.createService", 511 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.createService",
498 BLUETOOTHLOWENERGY_CREATESERVICE); 512 BLUETOOTHLOWENERGY_CREATESERVICE);
499 513
500 protected: 514 protected:
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 ~BluetoothLowEnergySendRequestResponseFunction() override {} 625 ~BluetoothLowEnergySendRequestResponseFunction() override {}
612 626
613 // BluetoothLowEnergyPeripheralExtensionFunction override. 627 // BluetoothLowEnergyPeripheralExtensionFunction override.
614 void DoWork() override; 628 void DoWork() override;
615 }; 629 };
616 630
617 } // namespace api 631 } // namespace api
618 } // namespace extensions 632 } // namespace extensions
619 633
620 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENER GY_API_H_ 634 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENER GY_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698