OLD | NEW |
1 // Copyright (c) 2012 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_CHILD_V8_VALUE_CONVERTER_IMPL_H_ | 5 #ifndef CONTENT_CHILD_V8_VALUE_CONVERTER_IMPL_H_ |
6 #define CONTENT_CHILD_V8_VALUE_CONVERTER_IMPL_H_ | 6 #define CONTENT_CHILD_V8_VALUE_CONVERTER_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 class CONTENT_EXPORT V8ValueConverterImpl : public V8ValueConverter { | 24 class CONTENT_EXPORT V8ValueConverterImpl : public V8ValueConverter { |
25 public: | 25 public: |
26 V8ValueConverterImpl(); | 26 V8ValueConverterImpl(); |
27 | 27 |
28 // V8ValueConverter implementation. | 28 // V8ValueConverter implementation. |
29 void SetDateAllowed(bool val) override; | 29 void SetDateAllowed(bool val) override; |
30 void SetRegExpAllowed(bool val) override; | 30 void SetRegExpAllowed(bool val) override; |
31 void SetFunctionAllowed(bool val) override; | 31 void SetFunctionAllowed(bool val) override; |
32 void SetStripNullFromObjects(bool val) override; | 32 void SetStripNullFromObjects(bool val) override; |
33 void SetStrategy(Strategy* strategy) override; | 33 void SetStrategy(Strategy* strategy) override; |
34 v8::Handle<v8::Value> ToV8Value( | 34 v8::Local<v8::Value> ToV8Value( |
35 const base::Value* value, | 35 const base::Value* value, |
36 v8::Handle<v8::Context> context) const override; | 36 v8::Local<v8::Context> context) const override; |
37 base::Value* FromV8Value(v8::Handle<v8::Value> value, | 37 base::Value* FromV8Value(v8::Local<v8::Value> value, |
38 v8::Handle<v8::Context> context) const override; | 38 v8::Local<v8::Context> context) const override; |
39 | 39 |
40 private: | 40 private: |
41 friend class ScopedAvoidIdentityHashForTesting; | 41 friend class ScopedAvoidIdentityHashForTesting; |
42 | 42 |
43 class FromV8ValueState; | 43 class FromV8ValueState; |
44 | 44 |
45 v8::Local<v8::Value> ToV8ValueImpl(v8::Isolate* isolate, | 45 v8::Local<v8::Value> ToV8ValueImpl(v8::Isolate* isolate, |
46 v8::Handle<v8::Object> creation_context, | 46 v8::Local<v8::Object> creation_context, |
47 const base::Value* value) const; | 47 const base::Value* value) const; |
48 v8::Handle<v8::Value> ToV8Array(v8::Isolate* isolate, | 48 v8::Local<v8::Value> ToV8Array(v8::Isolate* isolate, |
49 v8::Handle<v8::Object> creation_context, | 49 v8::Local<v8::Object> creation_context, |
50 const base::ListValue* list) const; | 50 const base::ListValue* list) const; |
51 v8::Handle<v8::Value> ToV8Object( | 51 v8::Local<v8::Value> ToV8Object( |
52 v8::Isolate* isolate, | 52 v8::Isolate* isolate, |
53 v8::Handle<v8::Object> creation_context, | 53 v8::Local<v8::Object> creation_context, |
54 const base::DictionaryValue* dictionary) const; | 54 const base::DictionaryValue* dictionary) const; |
55 v8::Handle<v8::Value> ToArrayBuffer(v8::Isolate* isolate, | 55 v8::Local<v8::Value> ToArrayBuffer(v8::Isolate* isolate, |
56 v8::Handle<v8::Object> creation_context, | 56 v8::Local<v8::Object> creation_context, |
57 const base::BinaryValue* value) const; | 57 const base::BinaryValue* value) const; |
58 | 58 |
59 base::Value* FromV8ValueImpl(FromV8ValueState* state, | 59 base::Value* FromV8ValueImpl(FromV8ValueState* state, |
60 v8::Handle<v8::Value> value, | 60 v8::Local<v8::Value> value, |
61 v8::Isolate* isolate) const; | 61 v8::Isolate* isolate) const; |
62 base::Value* FromV8Array(v8::Handle<v8::Array> array, | 62 base::Value* FromV8Array(v8::Local<v8::Array> array, |
63 FromV8ValueState* state, | 63 FromV8ValueState* state, |
64 v8::Isolate* isolate) const; | 64 v8::Isolate* isolate) const; |
65 | 65 |
66 // This will convert objects of type ArrayBuffer or any of the | 66 // This will convert objects of type ArrayBuffer or any of the |
67 // ArrayBufferView subclasses. | 67 // ArrayBufferView subclasses. |
68 base::Value* FromV8ArrayBuffer(v8::Handle<v8::Object> val, | 68 base::Value* FromV8ArrayBuffer(v8::Local<v8::Object> val, |
69 v8::Isolate* isolate) const; | 69 v8::Isolate* isolate) const; |
70 | 70 |
71 base::Value* FromV8Object(v8::Handle<v8::Object> object, | 71 base::Value* FromV8Object(v8::Local<v8::Object> object, |
72 FromV8ValueState* state, | 72 FromV8ValueState* state, |
73 v8::Isolate* isolate) const; | 73 v8::Isolate* isolate) const; |
74 | 74 |
75 // If true, we will convert Date JavaScript objects to doubles. | 75 // If true, we will convert Date JavaScript objects to doubles. |
76 bool date_allowed_; | 76 bool date_allowed_; |
77 | 77 |
78 // If true, we will convert RegExp JavaScript objects to string. | 78 // If true, we will convert RegExp JavaScript objects to string. |
79 bool reg_exp_allowed_; | 79 bool reg_exp_allowed_; |
80 | 80 |
81 // If true, we will convert Function JavaScript objects to dictionaries. | 81 // If true, we will convert Function JavaScript objects to dictionaries. |
82 bool function_allowed_; | 82 bool function_allowed_; |
83 | 83 |
84 // If true, undefined and null values are ignored when converting v8 objects | 84 // If true, undefined and null values are ignored when converting v8 objects |
85 // into Values. | 85 // into Values. |
86 bool strip_null_from_objects_; | 86 bool strip_null_from_objects_; |
87 | 87 |
88 bool avoid_identity_hash_for_testing_; | 88 bool avoid_identity_hash_for_testing_; |
89 | 89 |
90 // Strategy object that changes the converter's behavior. | 90 // Strategy object that changes the converter's behavior. |
91 Strategy* strategy_; | 91 Strategy* strategy_; |
92 | 92 |
93 DISALLOW_COPY_AND_ASSIGN(V8ValueConverterImpl); | 93 DISALLOW_COPY_AND_ASSIGN(V8ValueConverterImpl); |
94 }; | 94 }; |
95 | 95 |
96 } // namespace content | 96 } // namespace content |
97 | 97 |
98 #endif // CONTENT_CHILD_V8_VALUE_CONVERTER_IMPL_H_ | 98 #endif // CONTENT_CHILD_V8_VALUE_CONVERTER_IMPL_H_ |
OLD | NEW |