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 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" |
(...skipping 14 matching lines...) Expand all Loading... |
25 void set_allow_undefined(bool val) { allow_undefined_ = val; } | 25 void set_allow_undefined(bool val) { allow_undefined_ = val; } |
26 | 26 |
27 bool allow_date() const { return allow_date_; } | 27 bool allow_date() const { return allow_date_; } |
28 void set_allow_date(bool val) { allow_date_ = val; } | 28 void set_allow_date(bool val) { allow_date_ = val; } |
29 | 29 |
30 bool allow_regexp() const { return allow_regexp_; } | 30 bool allow_regexp() const { return allow_regexp_; } |
31 void set_allow_regexp(bool val) { allow_regexp_ = val; } | 31 void set_allow_regexp(bool val) { allow_regexp_ = val; } |
32 | 32 |
33 // V8ValueConverter implementation. | 33 // V8ValueConverter implementation. |
34 virtual v8::Handle<v8::Value> ToV8Value( | 34 virtual v8::Handle<v8::Value> ToV8Value( |
35 base::Value* value, | 35 const base::Value* value, |
36 v8::Handle<v8::Context> context) const OVERRIDE; | 36 v8::Handle<v8::Context> context) const OVERRIDE; |
37 virtual base::Value* FromV8Value( | 37 virtual base::Value* FromV8Value( |
38 v8::Handle<v8::Value> value, | 38 v8::Handle<v8::Value> value, |
39 v8::Handle<v8::Context> context) const OVERRIDE; | 39 v8::Handle<v8::Context> context) const OVERRIDE; |
40 | 40 |
41 private: | 41 private: |
42 v8::Handle<v8::Value> ToV8ValueImpl(base::Value* value) const; | 42 v8::Handle<v8::Value> ToV8ValueImpl(const base::Value* value) const; |
43 v8::Handle<v8::Value> ToV8Array(base::ListValue* list) const; | 43 v8::Handle<v8::Value> ToV8Array(const base::ListValue* list) const; |
44 v8::Handle<v8::Value> ToV8Object(base::DictionaryValue* dictionary) const; | 44 v8::Handle<v8::Value> ToV8Object( |
| 45 const base::DictionaryValue* dictionary) const; |
45 | 46 |
46 base::Value* FromV8ValueImpl(v8::Handle<v8::Value> value) const; | 47 base::Value* FromV8ValueImpl(v8::Handle<v8::Value> value) const; |
47 base::ListValue* FromV8Array(v8::Handle<v8::Array> array) const; | 48 base::ListValue* FromV8Array(v8::Handle<v8::Array> array) const; |
48 base::DictionaryValue* FromV8Object(v8::Handle<v8::Object> object) const; | 49 base::DictionaryValue* FromV8Object(v8::Handle<v8::Object> object) const; |
49 | 50 |
50 // If true, we will convert undefined JavaScript values to null. | 51 // If true, we will convert undefined JavaScript values to null. |
51 bool allow_undefined_; | 52 bool allow_undefined_; |
52 | 53 |
53 // If true, we will convert Date JavaScript objects to doubles. | 54 // If true, we will convert Date JavaScript objects to doubles. |
54 bool allow_date_; | 55 bool allow_date_; |
55 | 56 |
56 // If true, we will convet RegExp JavaScript objects to string. | 57 // If true, we will convet RegExp JavaScript objects to string. |
57 bool allow_regexp_; | 58 bool allow_regexp_; |
58 }; | 59 }; |
59 | 60 |
60 #endif // CONTENT_RENDERER_V8_VALUE_CONVERTER_IMPL_H_ | 61 #endif // CONTENT_RENDERER_V8_VALUE_CONVERTER_IMPL_H_ |
OLD | NEW |