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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // the case of arrays. | 110 // the case of arrays. |
111 // TODO(dcheng): This should just take a const reference. | 111 // TODO(dcheng): This should just take a const reference. |
112 virtual v8::Local<v8::Value> ToV8Value( | 112 virtual v8::Local<v8::Value> ToV8Value( |
113 const base::Value* value, | 113 const base::Value* value, |
114 v8::Local<v8::Context> context) const = 0; | 114 v8::Local<v8::Context> context) const = 0; |
115 | 115 |
116 // Converts a v8::Value to base::Value. | 116 // Converts a v8::Value to base::Value. |
117 // | 117 // |
118 // Unsupported types (unless explicitly configured) are not converted, so | 118 // Unsupported types (unless explicitly configured) are not converted, so |
119 // this method may return NULL -- the exception is when converting arrays, | 119 // this method may return NULL -- the exception is when converting arrays, |
120 // where unsupported types are converted to Value(TYPE_NULL). | 120 // where unsupported types are converted to Value(Type::NONE). |
121 // | 121 // |
122 // Likewise, if an object throws while converting a property it will not be | 122 // Likewise, if an object throws while converting a property it will not be |
123 // converted, whereas if an array throws while converting an item it will be | 123 // converted, whereas if an array throws while converting an item it will be |
124 // converted to Value(TYPE_NULL). | 124 // converted to Value(Type::NONE). |
125 virtual std::unique_ptr<base::Value> FromV8Value( | 125 virtual std::unique_ptr<base::Value> FromV8Value( |
126 v8::Local<v8::Value> value, | 126 v8::Local<v8::Value> value, |
127 v8::Local<v8::Context> context) const = 0; | 127 v8::Local<v8::Context> context) const = 0; |
128 }; | 128 }; |
129 | 129 |
130 } // namespace content | 130 } // namespace content |
131 | 131 |
132 #endif // CONTENT_PUBLIC_CHILD_V8_VALUE_CONVERTER_H_ | 132 #endif // CONTENT_PUBLIC_CHILD_V8_VALUE_CONVERTER_H_ |
OLD | NEW |