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 "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 provider_->InjectScript(script_, ^(NSString* string, NSError* error) { | 104 provider_->InjectScript(script_, ^(NSString* string, NSError* error) { |
105 DistillerPageIOS* distiller_page = weak_this.get(); | 105 DistillerPageIOS* distiller_page = weak_this.get(); |
106 if (distiller_page) | 106 if (distiller_page) |
107 distiller_page->HandleJavaScriptResultString(string); | 107 distiller_page->HandleJavaScriptResultString(string); |
108 }); | 108 }); |
109 } | 109 } |
110 | 110 |
111 void DistillerPageIOS::HandleJavaScriptResultString(NSString* result) { | 111 void DistillerPageIOS::HandleJavaScriptResultString(NSString* result) { |
112 scoped_ptr<base::Value> resultValue = base::Value::CreateNullValue(); | 112 scoped_ptr<base::Value> resultValue = base::Value::CreateNullValue(); |
113 if (result.length) { | 113 if (result.length) { |
114 scoped_ptr<base::Value> dictionaryValue( | 114 scoped_ptr<base::Value> dictionaryValue = |
115 base::JSONReader::DeprecatedRead(base::SysNSStringToUTF8(result))); | 115 base::JSONReader::Read(base::SysNSStringToUTF8(result)); |
116 if (dictionaryValue && | 116 if (dictionaryValue && |
117 dictionaryValue->IsType(base::Value::TYPE_DICTIONARY)) { | 117 dictionaryValue->IsType(base::Value::TYPE_DICTIONARY)) { |
118 resultValue = dictionaryValue.Pass(); | 118 resultValue = dictionaryValue.Pass(); |
119 } | 119 } |
120 } | 120 } |
121 OnDistillationDone(url_, resultValue.get()); | 121 OnDistillationDone(url_, resultValue.get()); |
122 } | 122 } |
123 | 123 |
124 } // namespace dom_distiller | 124 } // namespace dom_distiller |
OLD | NEW |