| 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" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebArrayBuffer.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebArrayBuffer.h" |
| 13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebArrayBuff
erView.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebArrayBuff
erView.h" |
| 14 #include "v8/include/v8.h" | 14 #include "v8/include/v8.h" |
| 15 | 15 |
| 16 using base::BinaryValue; | 16 using base::BinaryValue; |
| 17 using base::DictionaryValue; | 17 using base::DictionaryValue; |
| 18 using base::ListValue; | 18 using base::ListValue; |
| 19 using base::StringValue; | 19 using base::StringValue; |
| 20 using base::Value; | 20 using base::Value; |
| 21 | 21 |
| 22 namespace content { | 22 namespace content { |
| 23 | 23 |
| 24 V8ValueConverter* V8ValueConverter::create() { | 24 V8ValueConverter* V8ValueConverter::create() { |
| 25 return new V8ValueConverterImpl(); | 25 return new V8ValueConverterImpl(); |
| 26 } | 26 } |
| 27 } // namespace content | |
| 28 | 27 |
| 29 V8ValueConverterImpl::V8ValueConverterImpl() | 28 V8ValueConverterImpl::V8ValueConverterImpl() |
| 30 : date_allowed_(false), | 29 : date_allowed_(false), |
| 31 reg_exp_allowed_(false), | 30 reg_exp_allowed_(false), |
| 32 function_allowed_(false), | 31 function_allowed_(false), |
| 33 strip_null_from_objects_(false) { | 32 strip_null_from_objects_(false) { |
| 34 } | 33 } |
| 35 | 34 |
| 36 void V8ValueConverterImpl::SetDateAllowed(bool val) { | 35 void V8ValueConverterImpl::SetDateAllowed(bool val) { |
| 37 date_allowed_ = val; | 36 date_allowed_ = val; |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 // We can avoid all bugs related to this by stripping null. | 363 // We can avoid all bugs related to this by stripping null. |
| 365 if (strip_null_from_objects_ && child->IsType(Value::TYPE_NULL)) | 364 if (strip_null_from_objects_ && child->IsType(Value::TYPE_NULL)) |
| 366 continue; | 365 continue; |
| 367 | 366 |
| 368 result->SetWithoutPathExpansion(std::string(*name_utf8, name_utf8.length()), | 367 result->SetWithoutPathExpansion(std::string(*name_utf8, name_utf8.length()), |
| 369 child.release()); | 368 child.release()); |
| 370 } | 369 } |
| 371 | 370 |
| 372 return result.release(); | 371 return result.release(); |
| 373 } | 372 } |
| 373 |
| 374 } // namespace content |
| OLD | NEW |