quick_pair_service.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef ASH_SERVICES_QUICK_PAIR_QUICK_PAIR_SERVICE_H_
  5. #define ASH_SERVICES_QUICK_PAIR_QUICK_PAIR_SERVICE_H_
  6. #include <memory>
  7. #include "ash/services/quick_pair/public/mojom/fast_pair_data_parser.mojom-forward.h"
  8. #include "ash/services/quick_pair/public/mojom/quick_pair_service.mojom.h"
  9. #include "mojo/public/cpp/bindings/pending_receiver.h"
  10. #include "mojo/public/cpp/bindings/receiver.h"
  11. namespace ash {
  12. namespace quick_pair {
  13. class FastPairDataParser;
  14. // Class which implements the QuickPairService mojo interface to provide
  15. // functionality to the Quick Pair system which needs to run in a utility
  16. // process, e.g. parsing untrusted bytes.
  17. class QuickPairService : public mojom::QuickPairService {
  18. public:
  19. explicit QuickPairService(
  20. mojo::PendingReceiver<mojom::QuickPairService> receiver);
  21. QuickPairService(const QuickPairService&) = delete;
  22. QuickPairService& operator=(QuickPairService&) = delete;
  23. ~QuickPairService() override;
  24. // mojom::QuickPairService:
  25. void Connect(mojo::PendingReceiver<mojom::FastPairDataParser>
  26. fast_pair_data_parser) override;
  27. FastPairDataParser* fast_pair_data_parser() {
  28. return fast_pair_data_parser_.get();
  29. }
  30. private:
  31. mojo::Receiver<mojom::QuickPairService> receiver_;
  32. std::unique_ptr<FastPairDataParser> fast_pair_data_parser_;
  33. };
  34. } // namespace quick_pair
  35. } // namespace ash
  36. #endif // ASH_SERVICES_QUICK_PAIR_QUICK_PAIR_SERVICE_H_