| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_RENDERER_V8_VALUE_CONVERTER_H_ | 5 #ifndef CHROME_RENDERER_V8_VALUE_CONVERTER_H_ |
| 6 #define CHROME_RENDERER_V8_VALUE_CONVERTER_H_ | 6 #define CHROME_RENDERER_V8_VALUE_CONVERTER_H_ |
| 7 | 7 |
| 8 #include "content/common/content_export.h" |
| 8 #include "v8/include/v8.h" | 9 #include "v8/include/v8.h" |
| 9 | 10 |
| 10 namespace base { | 11 namespace base { |
| 11 class DictionaryValue; | 12 class DictionaryValue; |
| 12 class ListValue; | 13 class ListValue; |
| 13 class Value; | 14 class Value; |
| 14 } | 15 } |
| 15 | 16 |
| 16 // Converts between v8::Value (JavaScript values in the v8 heap) and Chrome's | 17 // Converts between v8::Value (JavaScript values in the v8 heap) and Chrome's |
| 17 // values (from base/values.h). Lists and dictionaries are converted | 18 // values (from base/values.h). Lists and dictionaries are converted |
| 18 // recursively. | 19 // recursively. |
| 19 // | 20 // |
| 20 // Only the JSON types (null, boolean, string, number, array, and object) are | 21 // Only the JSON types (null, boolean, string, number, array, and object) are |
| 21 // supported by default. Additional types can be allowed with e.g. | 22 // supported by default. Additional types can be allowed with e.g. |
| 22 // set_allow_date(), set_allow_regexp(). | 23 // set_allow_date(), set_allow_regexp(). |
| 23 class V8ValueConverter { | 24 class CONTENT_EXPORT V8ValueConverter { |
| 24 public: | 25 public: |
| 25 V8ValueConverter(); | 26 V8ValueConverter(); |
| 26 | 27 |
| 27 bool allow_undefined() const { return allow_undefined_; } | 28 bool allow_undefined() const { return allow_undefined_; } |
| 28 void set_allow_undefined(bool val) { allow_undefined_ = val; } | 29 void set_allow_undefined(bool val) { allow_undefined_ = val; } |
| 29 | 30 |
| 30 bool allow_date() const { return allow_date_; } | 31 bool allow_date() const { return allow_date_; } |
| 31 void set_allow_date(bool val) { allow_date_ = val; } | 32 void set_allow_date(bool val) { allow_date_ = val; } |
| 32 | 33 |
| 33 bool allow_regexp() const { return allow_regexp_; } | 34 bool allow_regexp() const { return allow_regexp_; } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 58 bool allow_undefined_; | 59 bool allow_undefined_; |
| 59 | 60 |
| 60 // If true, we will convert Date JavaScript objects to doubles. | 61 // If true, we will convert Date JavaScript objects to doubles. |
| 61 bool allow_date_; | 62 bool allow_date_; |
| 62 | 63 |
| 63 // If true, we will convet RegExp JavaScript objects to string. | 64 // If true, we will convet RegExp JavaScript objects to string. |
| 64 bool allow_regexp_; | 65 bool allow_regexp_; |
| 65 }; | 66 }; |
| 66 | 67 |
| 67 #endif // CHROME_RENDERER_V8_VALUE_CONVERTER_H_ | 68 #endif // CHROME_RENDERER_V8_VALUE_CONVERTER_H_ |
| OLD | NEW |