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_PUBLIC_RENDERER_V8_VALUE_CONVERTER_H_ | 5 #ifndef CONTENT_PUBLIC_RENDERER_V8_VALUE_CONVERTER_H_ |
6 #define CONTENT_PUBLIC_RENDERER_V8_VALUE_CONVERTER_H_ | 6 #define CONTENT_PUBLIC_RENDERER_V8_VALUE_CONVERTER_H_ |
7 | 7 |
8 #include "content/common/content_export.h" | 8 #include "content/common/content_export.h" |
9 #include "v8/include/v8.h" | 9 #include "v8/include/v8.h" |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... | |
21 // The JSON types (null, boolean, string, number, array, and object) as well as | 21 // The JSON types (null, boolean, string, number, array, and object) as well as |
22 // binary values are supported. For binary values, we convert to WebKit | 22 // binary values are supported. For binary values, we convert to WebKit |
23 // ArrayBuffers, and support converting from an ArrayBuffer or any of the | 23 // ArrayBuffers, and support converting from an ArrayBuffer or any of the |
24 // ArrayBufferView subclasses (Uint8Array, etc.). | 24 // ArrayBufferView subclasses (Uint8Array, etc.). |
25 class CONTENT_EXPORT V8ValueConverter { | 25 class CONTENT_EXPORT V8ValueConverter { |
26 public: | 26 public: |
27 static V8ValueConverter* create(); | 27 static V8ValueConverter* create(); |
28 | 28 |
29 virtual ~V8ValueConverter() {} | 29 virtual ~V8ValueConverter() {} |
30 | 30 |
31 // Use the following setters to support additional types other than the | |
32 // default ones. | |
33 virtual bool IsAllowIndefined() const = 0; | |
asargent_no_longer_on_chrome
2012/05/10 20:17:08
Indefined -> Undefined
Also, "IsAllow" sounds ver
battre
2012/05/11 12:16:28
Done.
| |
34 virtual void SetAllowUndefined(bool val) = 0; | |
35 | |
36 virtual bool IsAllowDate() const = 0; | |
37 virtual void SetAllowDate(bool val) = 0; | |
38 | |
39 virtual bool IsAllowRegexp() const = 0; | |
40 virtual void SetAllowRegexp(bool val) = 0; | |
41 | |
31 // Converts Value to v8::Value. Unsupported types are replaced with null. | 42 // Converts Value to v8::Value. Unsupported types are replaced with null. |
32 // If an array or object throws while setting a value, that property or item | 43 // If an array or object throws while setting a value, that property or item |
33 // is skipped, leaving a hole in the case of arrays. | 44 // is skipped, leaving a hole in the case of arrays. |
34 virtual v8::Handle<v8::Value> ToV8Value( | 45 virtual v8::Handle<v8::Value> ToV8Value( |
35 const base::Value* value, | 46 const base::Value* value, |
36 v8::Handle<v8::Context> context) const = 0; | 47 v8::Handle<v8::Context> context) const = 0; |
37 | 48 |
38 // Converts v8::Value to Value. Unsupported types are replaced with null. | 49 // Converts v8::Value to Value. Unsupported types are replaced with null. |
39 // If an array or object throws while getting a value, that property or item | 50 // If an array or object throws while getting a value, that property or item |
40 // is replaced with null. | 51 // is replaced with null. |
41 virtual base::Value* FromV8Value(v8::Handle<v8::Value> value, | 52 virtual base::Value* FromV8Value(v8::Handle<v8::Value> value, |
42 v8::Handle<v8::Context> context) const = 0; | 53 v8::Handle<v8::Context> context) const = 0; |
43 }; | 54 }; |
44 | 55 |
45 } // namespace content | 56 } // namespace content |
46 | 57 |
47 #endif // CONTENT_PUBLIC_RENDERER_V8_VALUE_CONVERTER_H_ | 58 #endif // CONTENT_PUBLIC_RENDERER_V8_VALUE_CONVERTER_H_ |
OLD | NEW |