| 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_CHILD_V8_VALUE_CONVERTER_H_ | 5 #ifndef CONTENT_PUBLIC_CHILD_V8_VALUE_CONVERTER_H_ |
| 6 #define CONTENT_PUBLIC_CHILD_V8_VALUE_CONVERTER_H_ | 6 #define CONTENT_PUBLIC_CHILD_V8_VALUE_CONVERTER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // behavior. This allows to intercept "non-finite" values and do something | 65 // behavior. This allows to intercept "non-finite" values and do something |
| 66 // with them. | 66 // with them. |
| 67 virtual bool FromV8Number(v8::Local<v8::Number> value, | 67 virtual bool FromV8Number(v8::Local<v8::Number> value, |
| 68 std::unique_ptr<base::Value>* out) const; | 68 std::unique_ptr<base::Value>* out) const; |
| 69 | 69 |
| 70 // If false is returned, V8ValueConverter proceeds with the default | 70 // If false is returned, V8ValueConverter proceeds with the default |
| 71 // behavior. | 71 // behavior. |
| 72 virtual bool FromV8Undefined(std::unique_ptr<base::Value>* out) const; | 72 virtual bool FromV8Undefined(std::unique_ptr<base::Value>* out) const; |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 static V8ValueConverter* create(); | 75 static std::unique_ptr<V8ValueConverter> Create(); |
| 76 | 76 |
| 77 virtual ~V8ValueConverter() {} | 77 virtual ~V8ValueConverter() {} |
| 78 | 78 |
| 79 // If true, Date objects are converted into DoubleValues with the number of | 79 // If true, Date objects are converted into DoubleValues with the number of |
| 80 // seconds since Unix epoch. | 80 // seconds since Unix epoch. |
| 81 // | 81 // |
| 82 // Otherwise they are converted into DictionaryValues with whatever additional | 82 // Otherwise they are converted into DictionaryValues with whatever additional |
| 83 // properties has been set on them. | 83 // properties has been set on them. |
| 84 virtual void SetDateAllowed(bool val) = 0; | 84 virtual void SetDateAllowed(bool val) = 0; |
| 85 | 85 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // converted, whereas if an array throws while converting an item it will be | 126 // converted, whereas if an array throws while converting an item it will be |
| 127 // converted to Value(Type::NONE). | 127 // converted to Value(Type::NONE). |
| 128 virtual std::unique_ptr<base::Value> FromV8Value( | 128 virtual std::unique_ptr<base::Value> FromV8Value( |
| 129 v8::Local<v8::Value> value, | 129 v8::Local<v8::Value> value, |
| 130 v8::Local<v8::Context> context) const = 0; | 130 v8::Local<v8::Context> context) const = 0; |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 } // namespace content | 133 } // namespace content |
| 134 | 134 |
| 135 #endif // CONTENT_PUBLIC_CHILD_V8_VALUE_CONVERTER_H_ | 135 #endif // CONTENT_PUBLIC_CHILD_V8_VALUE_CONVERTER_H_ |
| OLD | NEW |