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 #include "content/renderer/v8_value_converter_impl.h" | 5 #include "content/renderer/v8_value_converter_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 } | 27 } |
28 | 28 |
29 } | 29 } |
30 | 30 |
31 V8ValueConverterImpl::V8ValueConverterImpl() | 31 V8ValueConverterImpl::V8ValueConverterImpl() |
32 : allow_undefined_(false), | 32 : allow_undefined_(false), |
33 allow_date_(false), | 33 allow_date_(false), |
34 allow_regexp_(false) { | 34 allow_regexp_(false) { |
35 } | 35 } |
36 | 36 |
| 37 |
| 38 bool V8ValueConverterImpl::IsAllowIndefined() const { |
| 39 return allow_undefined_; |
| 40 } |
| 41 |
| 42 void V8ValueConverterImpl::SetAllowUndefined(bool val) { |
| 43 allow_undefined_ = val; |
| 44 } |
| 45 |
| 46 bool V8ValueConverterImpl::IsAllowDate() const { |
| 47 return allow_date_; |
| 48 } |
| 49 |
| 50 void V8ValueConverterImpl::SetAllowDate(bool val) { |
| 51 allow_date_ = val; |
| 52 } |
| 53 |
| 54 bool V8ValueConverterImpl::IsAllowRegexp() const { |
| 55 return allow_regexp_; |
| 56 } |
| 57 |
| 58 void V8ValueConverterImpl::SetAllowRegexp(bool val) { |
| 59 allow_regexp_ = val; |
| 60 } |
| 61 |
37 v8::Handle<v8::Value> V8ValueConverterImpl::ToV8Value( | 62 v8::Handle<v8::Value> V8ValueConverterImpl::ToV8Value( |
38 const Value* value, v8::Handle<v8::Context> context) const { | 63 const Value* value, v8::Handle<v8::Context> context) const { |
39 v8::Context::Scope context_scope(context); | 64 v8::Context::Scope context_scope(context); |
40 v8::HandleScope handle_scope; | 65 v8::HandleScope handle_scope; |
41 return handle_scope.Close(ToV8ValueImpl(value)); | 66 return handle_scope.Close(ToV8ValueImpl(value)); |
42 } | 67 } |
43 | 68 |
44 Value* V8ValueConverterImpl::FromV8Value( | 69 Value* V8ValueConverterImpl::FromV8Value( |
45 v8::Handle<v8::Value> val, | 70 v8::Handle<v8::Value> val, |
46 v8::Handle<v8::Context> context) const { | 71 v8::Handle<v8::Context> context) const { |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 } | 292 } |
268 | 293 |
269 Value* child = FromV8ValueImpl(child_v8); | 294 Value* child = FromV8ValueImpl(child_v8); |
270 CHECK(child); | 295 CHECK(child); |
271 | 296 |
272 result->SetWithoutPathExpansion(std::string(*name_utf8, name_utf8.length()), | 297 result->SetWithoutPathExpansion(std::string(*name_utf8, name_utf8.length()), |
273 child); | 298 child); |
274 } | 299 } |
275 return result; | 300 return result; |
276 } | 301 } |
OLD | NEW |