Transferable.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (c) 2023, Andrew Kaster <akaster@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Vector.h>
  8. #include <LibIPC/Forward.h>
  9. #include <LibWeb/HTML/StructuredSerialize.h>
  10. #include <LibWeb/WebIDL/ExceptionOr.h>
  11. namespace Web::Bindings {
  12. // https://html.spec.whatwg.org/multipage/structured-data.html#transferable-objects
  13. class Transferable {
  14. public:
  15. virtual ~Transferable() = default;
  16. // NOTE: It is an error to call Base::transfer_steps in your impl
  17. virtual WebIDL::ExceptionOr<void> transfer_steps(HTML::TransferDataHolder&) = 0;
  18. // NOTE: It is an error to call Base::transfer_receiving_steps in your impl
  19. virtual WebIDL::ExceptionOr<void> transfer_receiving_steps(HTML::TransferDataHolder&) = 0;
  20. virtual HTML::TransferType primary_interface() const = 0;
  21. bool is_detached() const { return m_detached; }
  22. void set_detached(bool b) { m_detached = b; }
  23. private:
  24. // https://html.spec.whatwg.org/multipage/structured-data.html#detached
  25. bool m_detached = false;
  26. };
  27. }