Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: components/dom_distiller/ios/distiller_page_ios.mm

Issue 2777243004: Allow URL loading if WebState::GetView was not called. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ios/web/test/web_int_test.mm » ('j') | ios/web/web_state/ui/crw_web_controller.mm » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 if (!web_state_) { 198 if (!web_state_) {
199 const web::WebState::CreateParams web_state_create_params(browser_state_); 199 const web::WebState::CreateParams web_state_create_params(browser_state_);
200 std::unique_ptr<web::WebState> web_state_unique = 200 std::unique_ptr<web::WebState> web_state_unique =
201 web::WebState::Create(web_state_create_params); 201 web::WebState::Create(web_state_create_params);
202 AttachWebState(std::move(web_state_unique)); 202 AttachWebState(std::move(web_state_unique));
203 } 203 }
204 // Load page using WebState. 204 // Load page using WebState.
205 web::NavigationManager::WebLoadParams params(url_); 205 web::NavigationManager::WebLoadParams params(url_);
206 web_state_->SetWebUsageEnabled(true); 206 web_state_->SetWebUsageEnabled(true);
207 web_state_->GetNavigationManager()->LoadURLWithParams(params); 207 web_state_->GetNavigationManager()->LoadURLWithParams(params);
208 // GetView is needed because the view is not created (but needed) when
209 // loading the page.
210 web_state_->GetView();
211 } 208 }
212 209
213 void DistillerPageIOS::OnLoadURLDone( 210 void DistillerPageIOS::OnLoadURLDone(
214 web::PageLoadCompletionStatus load_completion_status) { 211 web::PageLoadCompletionStatus load_completion_status) {
215 // Don't attempt to distill if the page load failed or if there is no 212 // Don't attempt to distill if the page load failed or if there is no
216 // WebState. 213 // WebState.
217 if (load_completion_status == web::PageLoadCompletionStatus::FAILURE || 214 if (load_completion_status == web::PageLoadCompletionStatus::FAILURE ||
218 !web_state_) { 215 !web_state_) {
219 HandleJavaScriptResult(nil); 216 HandleJavaScriptResult(nil);
220 return; 217 return;
(...skipping 17 matching lines...) Expand all
238 } 235 }
239 OnDistillationDone(url_, resultValue.get()); 236 OnDistillationDone(url_, resultValue.get());
240 } 237 }
241 238
242 std::unique_ptr<base::Value> DistillerPageIOS::ValueResultFromScriptResult( 239 std::unique_ptr<base::Value> DistillerPageIOS::ValueResultFromScriptResult(
243 id wk_result) { 240 id wk_result) {
244 return ::ValueResultFromScriptResult(wk_result, 241 return ::ValueResultFromScriptResult(wk_result,
245 kMaximumParsingRecursionDepth); 242 kMaximumParsingRecursionDepth);
246 } 243 }
247 } // namespace dom_distiller 244 } // namespace dom_distiller
OLDNEW
« no previous file with comments | « no previous file | ios/web/test/web_int_test.mm » ('j') | ios/web/web_state/ui/crw_web_controller.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698