| 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> |
| 10 |
| 9 #include "base/json/json_reader.h" | 11 #include "base/json/json_reader.h" |
| 10 #include "base/logging.h" | 12 #include "base/logging.h" |
| 11 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
| 12 #include "base/values.h" | 14 #include "base/values.h" |
| 13 #include "ios/public/provider/web/web_controller_provider.h" | 15 #include "ios/public/provider/web/web_controller_provider.h" |
| 14 #include "ios/web/public/browser_state.h" | 16 #include "ios/web/public/browser_state.h" |
| 15 | 17 |
| 16 namespace dom_distiller { | 18 namespace dom_distiller { |
| 17 | 19 |
| 18 // Helper class for observing the loading of URLs to distill. | 20 // Helper class for observing the loading of URLs to distill. |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 }); | 102 }); |
| 101 } | 103 } |
| 102 | 104 |
| 103 void DistillerPageIOS::HandleJavaScriptResultString(NSString* result) { | 105 void DistillerPageIOS::HandleJavaScriptResultString(NSString* result) { |
| 104 scoped_ptr<base::Value> resultValue = base::Value::CreateNullValue(); | 106 scoped_ptr<base::Value> resultValue = base::Value::CreateNullValue(); |
| 105 if (result.length) { | 107 if (result.length) { |
| 106 scoped_ptr<base::Value> dictionaryValue = | 108 scoped_ptr<base::Value> dictionaryValue = |
| 107 base::JSONReader::Read(base::SysNSStringToUTF8(result)); | 109 base::JSONReader::Read(base::SysNSStringToUTF8(result)); |
| 108 if (dictionaryValue && | 110 if (dictionaryValue && |
| 109 dictionaryValue->IsType(base::Value::TYPE_DICTIONARY)) { | 111 dictionaryValue->IsType(base::Value::TYPE_DICTIONARY)) { |
| 110 resultValue = dictionaryValue.Pass(); | 112 resultValue = std::move(dictionaryValue); |
| 111 } | 113 } |
| 112 } | 114 } |
| 113 OnDistillationDone(url_, resultValue.get()); | 115 OnDistillationDone(url_, resultValue.get()); |
| 114 } | 116 } |
| 115 | 117 |
| 116 } // namespace dom_distiller | 118 } // namespace dom_distiller |
| OLD | NEW |