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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 return result; | 42 return result; |
43 } | 43 } |
44 | 44 |
45 CFTypeID result_type = CFGetTypeID(wk_result); | 45 CFTypeID result_type = CFGetTypeID(wk_result); |
46 if (result_type == CFStringGetTypeID()) { | 46 if (result_type == CFStringGetTypeID()) { |
47 result.reset(new base::StringValue(base::SysNSStringToUTF16(wk_result))); | 47 result.reset(new base::StringValue(base::SysNSStringToUTF16(wk_result))); |
48 DCHECK(result->IsType(base::Value::TYPE_STRING)); | 48 DCHECK(result->IsType(base::Value::TYPE_STRING)); |
49 } else if (result_type == CFNumberGetTypeID()) { | 49 } else if (result_type == CFNumberGetTypeID()) { |
50 // Different implementation is here. | 50 // Different implementation is here. |
51 if ([wk_result intValue] != [wk_result doubleValue]) { | 51 if ([wk_result intValue] != [wk_result doubleValue]) { |
52 result.reset(new base::FundamentalValue([wk_result doubleValue])); | 52 result.reset(new base::Value([wk_result doubleValue])); |
53 DCHECK(result->IsType(base::Value::TYPE_DOUBLE)); | 53 DCHECK(result->IsType(base::Value::TYPE_DOUBLE)); |
54 } else { | 54 } else { |
55 result.reset(new base::FundamentalValue([wk_result intValue])); | 55 result.reset(new base::Value([wk_result intValue])); |
56 DCHECK(result->IsType(base::Value::TYPE_INTEGER)); | 56 DCHECK(result->IsType(base::Value::TYPE_INTEGER)); |
57 } | 57 } |
58 // End of different implementation. | 58 // End of different implementation. |
59 } else if (result_type == CFBooleanGetTypeID()) { | 59 } else if (result_type == CFBooleanGetTypeID()) { |
60 result.reset( | 60 result.reset( |
61 new base::FundamentalValue(static_cast<bool>([wk_result boolValue]))); | 61 new base::Value(static_cast<bool>([wk_result boolValue]))); |
62 DCHECK(result->IsType(base::Value::TYPE_BOOLEAN)); | 62 DCHECK(result->IsType(base::Value::TYPE_BOOLEAN)); |
63 } else if (result_type == CFNullGetTypeID()) { | 63 } else if (result_type == CFNullGetTypeID()) { |
64 result = base::Value::CreateNullValue(); | 64 result = base::Value::CreateNullValue(); |
65 DCHECK(result->IsType(base::Value::TYPE_NULL)); | 65 DCHECK(result->IsType(base::Value::TYPE_NULL)); |
66 } else if (result_type == CFDictionaryGetTypeID()) { | 66 } else if (result_type == CFDictionaryGetTypeID()) { |
67 std::unique_ptr<base::DictionaryValue> dictionary = | 67 std::unique_ptr<base::DictionaryValue> dictionary = |
68 base::MakeUnique<base::DictionaryValue>(); | 68 base::MakeUnique<base::DictionaryValue>(); |
69 for (id key in wk_result) { | 69 for (id key in wk_result) { |
70 NSString* obj_c_string = base::mac::ObjCCast<NSString>(key); | 70 NSString* obj_c_string = base::mac::ObjCCast<NSString>(key); |
71 const std::string path = base::SysNSStringToUTF8(obj_c_string); | 71 const std::string path = base::SysNSStringToUTF8(obj_c_string); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 } | 186 } |
187 OnDistillationDone(url_, resultValue.get()); | 187 OnDistillationDone(url_, resultValue.get()); |
188 } | 188 } |
189 | 189 |
190 std::unique_ptr<base::Value> DistillerPageIOS::ValueResultFromScriptResult( | 190 std::unique_ptr<base::Value> DistillerPageIOS::ValueResultFromScriptResult( |
191 id wk_result) { | 191 id wk_result) { |
192 return ::ValueResultFromScriptResult(wk_result, | 192 return ::ValueResultFromScriptResult(wk_result, |
193 kMaximumParsingRecursionDepth); | 193 kMaximumParsingRecursionDepth); |
194 } | 194 } |
195 } // namespace dom_distiller | 195 } // namespace dom_distiller |
OLD | NEW |