bluetooth_chooser.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright (c) 2016 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef ATOM_BROWSER_LIB_BLUETOOTH_CHOOSER_H_
  5. #define ATOM_BROWSER_LIB_BLUETOOTH_CHOOSER_H_
  6. #include <string>
  7. #include <vector>
  8. #include "atom/browser/api/atom_api_web_contents.h"
  9. #include "content/public/browser/bluetooth_chooser.h"
  10. namespace atom {
  11. class BluetoothChooser : public content::BluetoothChooser {
  12. public:
  13. struct DeviceInfo {
  14. std::string device_id;
  15. base::string16 device_name;
  16. };
  17. explicit BluetoothChooser(api::WebContents* contents,
  18. const EventHandler& handler);
  19. ~BluetoothChooser() override;
  20. // content::BluetoothChooser:
  21. void SetAdapterPresence(AdapterPresence presence) override;
  22. void ShowDiscoveryState(DiscoveryState state) override;
  23. void AddOrUpdateDevice(const std::string& device_id,
  24. bool should_update_name,
  25. const base::string16& device_name,
  26. bool is_gatt_connected,
  27. bool is_paired,
  28. int signal_strength_level) override;
  29. void RemoveDevice(const std::string& device_id);
  30. private:
  31. std::vector<DeviceInfo> device_list_;
  32. api::WebContents* api_web_contents_;
  33. EventHandler event_handler_;
  34. int num_retries_ = 0;
  35. DISALLOW_COPY_AND_ASSIGN(BluetoothChooser);
  36. };
  37. } // namespace atom
  38. #endif // ATOM_BROWSER_LIB_BLUETOOTH_CHOOSER_H_