| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/dom_distiller/ios/distiller_page_ios.h" | 5 #include "components/dom_distiller/ios/distiller_page_ios.h" |
| 6 | 6 |
| 7 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 std::unique_ptr<base::Value> result; | 44 std::unique_ptr<base::Value> result; |
| 45 | 45 |
| 46 if (max_depth < 0) { | 46 if (max_depth < 0) { |
| 47 DLOG(WARNING) << "JS maximum recursion depth exceeded."; | 47 DLOG(WARNING) << "JS maximum recursion depth exceeded."; |
| 48 return result; | 48 return result; |
| 49 } | 49 } |
| 50 | 50 |
| 51 CFTypeID result_type = CFGetTypeID(wk_result); | 51 CFTypeID result_type = CFGetTypeID(wk_result); |
| 52 if (result_type == CFStringGetTypeID()) { | 52 if (result_type == CFStringGetTypeID()) { |
| 53 result.reset(new base::StringValue(base::SysNSStringToUTF16(wk_result))); | 53 result.reset(new base::Value(base::SysNSStringToUTF16(wk_result))); |
| 54 DCHECK(result->IsType(base::Value::Type::STRING)); | 54 DCHECK(result->IsType(base::Value::Type::STRING)); |
| 55 } else if (result_type == CFNumberGetTypeID()) { | 55 } else if (result_type == CFNumberGetTypeID()) { |
| 56 // Different implementation is here. | 56 // Different implementation is here. |
| 57 if ([wk_result intValue] != [wk_result doubleValue]) { | 57 if ([wk_result intValue] != [wk_result doubleValue]) { |
| 58 result.reset(new base::Value([wk_result doubleValue])); | 58 result.reset(new base::Value([wk_result doubleValue])); |
| 59 DCHECK(result->IsType(base::Value::Type::DOUBLE)); | 59 DCHECK(result->IsType(base::Value::Type::DOUBLE)); |
| 60 } else { | 60 } else { |
| 61 result.reset(new base::Value([wk_result intValue])); | 61 result.reset(new base::Value([wk_result intValue])); |
| 62 DCHECK(result->IsType(base::Value::Type::INTEGER)); | 62 DCHECK(result->IsType(base::Value::Type::INTEGER)); |
| 63 } | 63 } |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 } | 238 } |
| 239 OnDistillationDone(url_, resultValue.get()); | 239 OnDistillationDone(url_, resultValue.get()); |
| 240 } | 240 } |
| 241 | 241 |
| 242 std::unique_ptr<base::Value> DistillerPageIOS::ValueResultFromScriptResult( | 242 std::unique_ptr<base::Value> DistillerPageIOS::ValueResultFromScriptResult( |
| 243 id wk_result) { | 243 id wk_result) { |
| 244 return ::ValueResultFromScriptResult(wk_result, | 244 return ::ValueResultFromScriptResult(wk_result, |
| 245 kMaximumParsingRecursionDepth); | 245 kMaximumParsingRecursionDepth); |
| 246 } | 246 } |
| 247 } // namespace dom_distiller | 247 } // namespace dom_distiller |
| OLD | NEW |