| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // If true, Function objects are converted into DictionaryValues with whatever | 93 // If true, Function objects are converted into DictionaryValues with whatever |
| 94 // additional properties has been set on them. | 94 // additional properties has been set on them. |
| 95 // | 95 // |
| 96 // Otherwise they are treated as unsupported, see FromV8Value. | 96 // Otherwise they are treated as unsupported, see FromV8Value. |
| 97 virtual void SetFunctionAllowed(bool val) = 0; | 97 virtual void SetFunctionAllowed(bool val) = 0; |
| 98 | 98 |
| 99 // If true, null values are stripped from objects. This is often useful when | 99 // If true, null values are stripped from objects. This is often useful when |
| 100 // converting arguments to extension APIs. | 100 // converting arguments to extension APIs. |
| 101 virtual void SetStripNullFromObjects(bool val) = 0; | 101 virtual void SetStripNullFromObjects(bool val) = 0; |
| 102 | 102 |
| 103 // If true, treats -0 as an integer. Otherwise, -0 is converted to a double. |
| 104 virtual void SetConvertNegativeZeroToInt(bool val) = 0; |
| 105 |
| 103 // Extend default behavior of V8ValueConverter. | 106 // Extend default behavior of V8ValueConverter. |
| 104 virtual void SetStrategy(Strategy* strategy) = 0; | 107 virtual void SetStrategy(Strategy* strategy) = 0; |
| 105 | 108 |
| 106 // Converts a base::Value to a v8::Value. | 109 // Converts a base::Value to a v8::Value. |
| 107 // | 110 // |
| 108 // Unsupported types are replaced with null. If an array or object throws | 111 // Unsupported types are replaced with null. If an array or object throws |
| 109 // while setting a value, that property or item is skipped, leaving a hole in | 112 // while setting a value, that property or item is skipped, leaving a hole in |
| 110 // the case of arrays. | 113 // the case of arrays. |
| 111 // TODO(dcheng): This should just take a const reference. | 114 // TODO(dcheng): This should just take a const reference. |
| 112 virtual v8::Local<v8::Value> ToV8Value( | 115 virtual v8::Local<v8::Value> ToV8Value( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 123 // 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 |
| 124 // converted to Value(Type::NONE). | 127 // converted to Value(Type::NONE). |
| 125 virtual std::unique_ptr<base::Value> FromV8Value( | 128 virtual std::unique_ptr<base::Value> FromV8Value( |
| 126 v8::Local<v8::Value> value, | 129 v8::Local<v8::Value> value, |
| 127 v8::Local<v8::Context> context) const = 0; | 130 v8::Local<v8::Context> context) const = 0; |
| 128 }; | 131 }; |
| 129 | 132 |
| 130 } // namespace content | 133 } // namespace content |
| 131 | 134 |
| 132 #endif // CONTENT_PUBLIC_CHILD_V8_VALUE_CONVERTER_H_ | 135 #endif // CONTENT_PUBLIC_CHILD_V8_VALUE_CONVERTER_H_ |
| OLD | NEW |