| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 | 158 |
| 159 std::unique_ptr<web::WebState> DistillerPageIOS::DetachWebState() { | 159 std::unique_ptr<web::WebState> DistillerPageIOS::DetachWebState() { |
| 160 std::unique_ptr<web::WebState> old_web_state = std::move(web_state_); | 160 std::unique_ptr<web::WebState> old_web_state = std::move(web_state_); |
| 161 web_state_observer_.reset(); | 161 web_state_observer_.reset(); |
| 162 web_state_.reset(); | 162 web_state_.reset(); |
| 163 return old_web_state; | 163 return old_web_state; |
| 164 } | 164 } |
| 165 | 165 |
| 166 web::WebState* DistillerPageIOS::CurrentWebState() { |
| 167 return web_state_.get(); |
| 168 } |
| 169 |
| 166 void DistillerPageIOS::DistillPageImpl(const GURL& url, | 170 void DistillerPageIOS::DistillPageImpl(const GURL& url, |
| 167 const std::string& script) { | 171 const std::string& script) { |
| 168 if (!url.is_valid() || !script.length()) | 172 if (!url.is_valid() || !script.length()) |
| 169 return; | 173 return; |
| 170 url_ = url; | 174 url_ = url; |
| 171 script_ = script; | 175 script_ = script; |
| 172 | 176 |
| 173 if (!web_state_) { | 177 if (!web_state_) { |
| 174 const web::WebState::CreateParams web_state_create_params(browser_state_); | 178 const web::WebState::CreateParams web_state_create_params(browser_state_); |
| 175 std::unique_ptr<web::WebState> web_state_unique = | 179 std::unique_ptr<web::WebState> web_state_unique = |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 } | 217 } |
| 214 OnDistillationDone(url_, resultValue.get()); | 218 OnDistillationDone(url_, resultValue.get()); |
| 215 } | 219 } |
| 216 | 220 |
| 217 std::unique_ptr<base::Value> DistillerPageIOS::ValueResultFromScriptResult( | 221 std::unique_ptr<base::Value> DistillerPageIOS::ValueResultFromScriptResult( |
| 218 id wk_result) { | 222 id wk_result) { |
| 219 return ::ValueResultFromScriptResult(wk_result, | 223 return ::ValueResultFromScriptResult(wk_result, |
| 220 kMaximumParsingRecursionDepth); | 224 kMaximumParsingRecursionDepth); |
| 221 } | 225 } |
| 222 } // namespace dom_distiller | 226 } // namespace dom_distiller |
| OLD | NEW |