Avi Drissman | db497b3 | 2022-09-15 19:47:28 | [diff] [blame] | 1 | // Copyright 2022 The Chromium Authors |
Lei Zhang | b6b710f4 | 2022-02-26 06:03:22 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef PDF_V8_VALUE_CONVERTER_H_ |
| 6 | #define PDF_V8_VALUE_CONVERTER_H_ |
| 7 | |
| 8 | #include <memory> |
| 9 | |
| 10 | #include "v8/include/v8-forward.h" |
| 11 | |
| 12 | namespace base { |
| 13 | class Value; |
| 14 | } // namespace base |
| 15 | |
| 16 | namespace chrome_pdf { |
| 17 | |
| 18 | // Abstraction layer for base::Value from/to V8::Value conversions. |
| 19 | // Necessary because //pdf should not directly depend on //content. If the V8 |
| 20 | // V8 value conversion code ever moves into Blink, remove this and use the |
| 21 | // conversion code from Blink directly. |
| 22 | |
| 23 | class V8ValueConverter { |
| 24 | public: |
| 25 | virtual std::unique_ptr<base::Value> FromV8Value( |
| 26 | v8::Local<v8::Value> value, |
| 27 | v8::Local<v8::Context> context) = 0; |
Lei Zhang | b6b710f4 | 2022-02-26 06:03:22 | [diff] [blame] | 28 | |
| 29 | protected: |
| 30 | ~V8ValueConverter() = default; |
| 31 | }; |
| 32 | |
| 33 | } // namespace chrome_pdf |
| 34 | |
| 35 | #endif // PDF_V8_VALUE_CONVERTER_H_ |