| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_V8_VALUE_CONVERTER_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_V8_VALUE_CONVERTER_IMPL_H_ |
| 6 #define CONTENT_RENDERER_V8_VALUE_CONVERTER_IMPL_H_ | 6 #define CONTENT_RENDERER_V8_VALUE_CONVERTER_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
| 10 #include "content/public/renderer/v8_value_converter.h" | 10 #include "content/public/renderer/v8_value_converter.h" |
| 11 | 11 |
| 12 namespace base { | 12 namespace base { |
| 13 class BinaryValue; |
| 13 class DictionaryValue; | 14 class DictionaryValue; |
| 14 class ListValue; | 15 class ListValue; |
| 15 class Value; | 16 class Value; |
| 16 } | 17 } |
| 17 | 18 |
| 18 class CONTENT_EXPORT V8ValueConverterImpl : public content::V8ValueConverter { | 19 class CONTENT_EXPORT V8ValueConverterImpl : public content::V8ValueConverter { |
| 19 public: | 20 public: |
| 20 V8ValueConverterImpl(); | 21 V8ValueConverterImpl(); |
| 21 | 22 |
| 22 // Use the following setters to support additional types other than the | 23 // Use the following setters to support additional types other than the |
| (...skipping 13 matching lines...) Expand all Loading... |
| 36 v8::Handle<v8::Context> context) const OVERRIDE; | 37 v8::Handle<v8::Context> context) const OVERRIDE; |
| 37 virtual base::Value* FromV8Value( | 38 virtual base::Value* FromV8Value( |
| 38 v8::Handle<v8::Value> value, | 39 v8::Handle<v8::Value> value, |
| 39 v8::Handle<v8::Context> context) const OVERRIDE; | 40 v8::Handle<v8::Context> context) const OVERRIDE; |
| 40 | 41 |
| 41 private: | 42 private: |
| 42 v8::Handle<v8::Value> ToV8ValueImpl(const base::Value* value) const; | 43 v8::Handle<v8::Value> ToV8ValueImpl(const base::Value* value) const; |
| 43 v8::Handle<v8::Value> ToV8Array(const base::ListValue* list) const; | 44 v8::Handle<v8::Value> ToV8Array(const base::ListValue* list) const; |
| 44 v8::Handle<v8::Value> ToV8Object( | 45 v8::Handle<v8::Value> ToV8Object( |
| 45 const base::DictionaryValue* dictionary) const; | 46 const base::DictionaryValue* dictionary) const; |
| 47 v8::Handle<v8::Value> ToArrayBuffer(const base::BinaryValue* value) const; |
| 46 | 48 |
| 47 base::Value* FromV8ValueImpl(v8::Handle<v8::Value> value) const; | 49 base::Value* FromV8ValueImpl(v8::Handle<v8::Value> value) const; |
| 48 base::ListValue* FromV8Array(v8::Handle<v8::Array> array) const; | 50 base::ListValue* FromV8Array(v8::Handle<v8::Array> array) const; |
| 51 |
| 52 // This will convert objects of type ArrayBuffer or any of the |
| 53 // ArrayBufferView subclasses. The return value will be NULL if |value| is |
| 54 // not one of these types. |
| 55 base::BinaryValue* FromV8Buffer(v8::Handle<v8::Value> value) const; |
| 56 |
| 49 base::DictionaryValue* FromV8Object(v8::Handle<v8::Object> object) const; | 57 base::DictionaryValue* FromV8Object(v8::Handle<v8::Object> object) const; |
| 50 | 58 |
| 51 // If true, we will convert undefined JavaScript values to null. | 59 // If true, we will convert undefined JavaScript values to null. |
| 52 bool allow_undefined_; | 60 bool allow_undefined_; |
| 53 | 61 |
| 54 // If true, we will convert Date JavaScript objects to doubles. | 62 // If true, we will convert Date JavaScript objects to doubles. |
| 55 bool allow_date_; | 63 bool allow_date_; |
| 56 | 64 |
| 57 // If true, we will convet RegExp JavaScript objects to string. | 65 // If true, we will convet RegExp JavaScript objects to string. |
| 58 bool allow_regexp_; | 66 bool allow_regexp_; |
| 59 }; | 67 }; |
| 60 | 68 |
| 61 #endif // CONTENT_RENDERER_V8_VALUE_CONVERTER_IMPL_H_ | 69 #endif // CONTENT_RENDERER_V8_VALUE_CONVERTER_IMPL_H_ |
| OLD | NEW |