v8_value_converter.h 906 B

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright 2022 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 PDF_V8_VALUE_CONVERTER_H_
  5. #define PDF_V8_VALUE_CONVERTER_H_
  6. #include <memory>
  7. #include "v8/include/v8-forward.h"
  8. namespace base {
  9. class Value;
  10. } // namespace base
  11. namespace chrome_pdf {
  12. // Abstraction layer for base::Value from/to V8::Value conversions.
  13. // Necessary because //pdf should not directly depend on //content. If the V8
  14. // V8 value conversion code ever moves into Blink, remove this and use the
  15. // conversion code from Blink directly.
  16. class V8ValueConverter {
  17. public:
  18. virtual std::unique_ptr<base::Value> FromV8Value(
  19. v8::Local<v8::Value> value,
  20. v8::Local<v8::Context> context) = 0;
  21. protected:
  22. ~V8ValueConverter() = default;
  23. };
  24. } // namespace chrome_pdf
  25. #endif // PDF_V8_VALUE_CONVERTER_H_