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 3 // found in the LICENSE file. 4 5 #ifndef CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_VALUE_CONVERTER_H_ 6 #define CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_VALUE_CONVERTER_H_ 7 8 #include "base/memory/scoped_ptr.h" 9 #include "content/common/content_export.h" 10 #include "content/public/renderer/v8_value_converter.h" 11 12 namespace content { 13 14 class GinJavaBridgeValueConverter : public content::V8ValueConverter::Strategy { 15 public: 16 CONTENT_EXPORT GinJavaBridgeValueConverter(); 17 CONTENT_EXPORT virtual ~GinJavaBridgeValueConverter(); 18 19 CONTENT_EXPORT v8::Handle<v8::Value> ToV8Value( 20 const base::Value* value, 21 v8::Handle<v8::Context> context) const; 22 CONTENT_EXPORT scoped_ptr<base::Value> FromV8Value( 23 v8::Handle<v8::Value> value, 24 v8::Handle<v8::Context> context) const; 25 26 // content::V8ValueConverter::Strategy 27 virtual bool FromV8Object(v8::Handle<v8::Object> value, 28 base::Value** out, 29 v8::Isolate* isolate, 30 const FromV8ValueCallback& callback) const OVERRIDE; 31 virtual bool FromV8ArrayBuffer(v8::Handle<v8::Object> value, 32 base::Value** out, 33 v8::Isolate* isolate) const OVERRIDE; 34 virtual bool FromV8Number(v8::Handle<v8::Number> value, 35 base::Value** out) const OVERRIDE; 36 virtual bool FromV8Undefined(base::Value** out) const OVERRIDE; 37 38 private: 39 scoped_ptr<V8ValueConverter> converter_; 40 41 DISALLOW_COPY_AND_ASSIGN(GinJavaBridgeValueConverter); 42 }; 43 44 } // namespace content 45 46 #endif // CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_VALUE_CONVERTER_H_ 47