multidevice_setup_base.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2018 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_MULTIDEVICE_SETUP_MULTIDEVICE_SETUP_BASE_H_
  5. #define ASH_SERVICES_MULTIDEVICE_SETUP_MULTIDEVICE_SETUP_BASE_H_
  6. #include "ash/services/multidevice_setup/public/mojom/multidevice_setup.mojom.h"
  7. #include "mojo/public/cpp/bindings/pending_receiver.h"
  8. #include "mojo/public/cpp/bindings/receiver_set.h"
  9. namespace ash {
  10. namespace multidevice_setup {
  11. // MultiDeviceSetup implementation which accepts receivers to bind to it.
  12. class MultiDeviceSetupBase : public mojom::MultiDeviceSetup {
  13. public:
  14. MultiDeviceSetupBase(const MultiDeviceSetupBase&) = delete;
  15. MultiDeviceSetupBase& operator=(const MultiDeviceSetupBase&) = delete;
  16. ~MultiDeviceSetupBase() override;
  17. void BindReceiver(mojo::PendingReceiver<mojom::MultiDeviceSetup> receiver);
  18. void CloseAllReceivers();
  19. // Sets the device with the given ID as the multi-device host for this
  20. // account.
  21. // TODO(https://crbug.com/1019206): When v1 DeviceSync is turned off, only
  22. // use Instance ID since all devices are guaranteed to have one.
  23. virtual void SetHostDeviceWithoutAuthToken(
  24. const std::string& host_instance_id_or_legacy_device_id,
  25. mojom::PrivilegedHostDeviceSetter::SetHostDeviceCallback callback) = 0;
  26. protected:
  27. MultiDeviceSetupBase();
  28. private:
  29. mojo::ReceiverSet<mojom::MultiDeviceSetup> receivers_;
  30. };
  31. } // namespace multidevice_setup
  32. } // namespace ash
  33. #endif // ASH_SERVICES_MULTIDEVICE_SETUP_MULTIDEVICE_SETUP_BASE_H_