frame_converter.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright (c) 2020 Samuel Maddock <[email protected]>.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef ELECTRON_SHELL_COMMON_GIN_CONVERTERS_FRAME_CONVERTER_H_
  5. #define ELECTRON_SHELL_COMMON_GIN_CONVERTERS_FRAME_CONVERTER_H_
  6. #include "content/public/browser/frame_tree_node_id.h"
  7. #include "gin/converter.h"
  8. #include "shell/common/gin_helper/accessor.h"
  9. namespace content {
  10. class RenderFrameHost;
  11. }
  12. namespace gin {
  13. template <>
  14. struct Converter<content::FrameTreeNodeId> {
  15. static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
  16. const content::FrameTreeNodeId& val);
  17. };
  18. template <>
  19. struct Converter<content::RenderFrameHost*> {
  20. static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
  21. content::RenderFrameHost* val);
  22. static bool FromV8(v8::Isolate* isolate,
  23. v8::Local<v8::Value> val,
  24. content::RenderFrameHost** out);
  25. };
  26. template <>
  27. struct Converter<gin_helper::AccessorValue<content::RenderFrameHost*>> {
  28. static v8::Local<v8::Value> ToV8(
  29. v8::Isolate* isolate,
  30. gin_helper::AccessorValue<content::RenderFrameHost*> val);
  31. static bool FromV8(v8::Isolate* isolate,
  32. v8::Local<v8::Value> val,
  33. gin_helper::AccessorValue<content::RenderFrameHost*>* out);
  34. };
  35. } // namespace gin
  36. #endif // ELECTRON_SHELL_COMMON_GIN_CONVERTERS_FRAME_CONVERTER_H_