| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_VALUE_CONVERTER_H_ | 5 #ifndef CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_VALUE_CONVERTER_H_ |
| 6 #define CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_VALUE_CONVERTER_H_ | 6 #define CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_VALUE_CONVERTER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 12 #include "content/public/child/v8_value_converter.h" | 12 #include "content/public/child/v8_value_converter.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 class GinJavaBridgeValueConverter : public content::V8ValueConverter::Strategy { | 16 class GinJavaBridgeValueConverter : public content::V8ValueConverter::Strategy { |
| 17 public: | 17 public: |
| 18 CONTENT_EXPORT GinJavaBridgeValueConverter(); | 18 CONTENT_EXPORT GinJavaBridgeValueConverter(); |
| 19 CONTENT_EXPORT ~GinJavaBridgeValueConverter() override; | 19 CONTENT_EXPORT ~GinJavaBridgeValueConverter() override; |
| 20 | 20 |
| 21 CONTENT_EXPORT v8::Local<v8::Value> ToV8Value( | 21 CONTENT_EXPORT v8::Local<v8::Value> ToV8Value( |
| 22 const base::Value* value, | 22 const base::Value* value, |
| 23 v8::Local<v8::Context> context) const; | 23 v8::Local<v8::Context> context) const; |
| 24 CONTENT_EXPORT std::unique_ptr<base::Value> FromV8Value( | 24 CONTENT_EXPORT std::unique_ptr<base::Value> FromV8Value( |
| 25 v8::Local<v8::Value> value, | 25 v8::Local<v8::Value> value, |
| 26 v8::Local<v8::Context> context) const; | 26 v8::Local<v8::Context> context) const; |
| 27 | 27 |
| 28 // content::V8ValueConverter::Strategy | 28 // content::V8ValueConverter::Strategy |
| 29 bool FromV8Object(v8::Local<v8::Object> value, | 29 bool FromV8Object(v8::Local<v8::Object> value, |
| 30 base::Value** out, | 30 std::unique_ptr<base::Value>* out, |
| 31 v8::Isolate* isolate, | 31 v8::Isolate* isolate, |
| 32 const FromV8ValueCallback& callback) const override; | 32 const FromV8ValueCallback& callback) const override; |
| 33 bool FromV8ArrayBuffer(v8::Local<v8::Object> value, | 33 bool FromV8ArrayBuffer(v8::Local<v8::Object> value, |
| 34 base::Value** out, | 34 std::unique_ptr<base::Value>* out, |
| 35 v8::Isolate* isolate) const override; | 35 v8::Isolate* isolate) const override; |
| 36 bool FromV8Number(v8::Local<v8::Number> value, | 36 bool FromV8Number(v8::Local<v8::Number> value, |
| 37 base::Value** out) const override; | 37 std::unique_ptr<base::Value>* out) const override; |
| 38 bool FromV8Undefined(base::Value** out) const override; | 38 bool FromV8Undefined(std::unique_ptr<base::Value>* out) const override; |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 std::unique_ptr<V8ValueConverter> converter_; | 41 std::unique_ptr<V8ValueConverter> converter_; |
| 42 | 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(GinJavaBridgeValueConverter); | 43 DISALLOW_COPY_AND_ASSIGN(GinJavaBridgeValueConverter); |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 } // namespace content | 46 } // namespace content |
| 47 | 47 |
| 48 #endif // CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_VALUE_CONVERTER_H_ | 48 #endif // CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_VALUE_CONVERTER_H_ |
| OLD | NEW |