OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
5 * (http://www.torchmobile.com/) | 5 * (http://www.torchmobile.com/) |
6 * Copyright (C) 2009 Adam Barth. All rights reserved. | 6 * Copyright (C) 2009 Adam Barth. All rights reserved. |
7 * | 7 * |
8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
10 * are met: | 10 * are met: |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 request.setClientRedirect(ClientRedirectPolicy::ClientRedirect); | 272 request.setClientRedirect(ClientRedirectPolicy::ClientRedirect); |
273 maybeLogScheduledNavigationClobber(ScheduledNavigationType::ScheduledReload, | 273 maybeLogScheduledNavigationClobber(ScheduledNavigationType::ScheduledReload, |
274 frame); | 274 frame); |
275 frame->loader().load(request, FrameLoadTypeReload); | 275 frame->loader().load(request, FrameLoadTypeReload); |
276 } | 276 } |
277 | 277 |
278 private: | 278 private: |
279 ScheduledReload() : ScheduledNavigation(0.0, nullptr, true, true) {} | 279 ScheduledReload() : ScheduledNavigation(0.0, nullptr, true, true) {} |
280 }; | 280 }; |
281 | 281 |
282 class ScheduledPageBlock final : public ScheduledURLNavigation { | 282 class ScheduledPageBlock final : public ScheduledNavigation { |
283 public: | 283 public: |
284 static ScheduledPageBlock* create(Document* originDocument, | 284 static ScheduledPageBlock* create(Document* originDocument, int reason) { |
285 const String& url) { | 285 return new ScheduledPageBlock(originDocument, reason); |
286 return new ScheduledPageBlock(originDocument, url); | |
287 } | 286 } |
288 | 287 |
289 void fire(LocalFrame* frame) override { | 288 void fire(LocalFrame* frame) override { |
290 std::unique_ptr<UserGestureIndicator> gestureIndicator = | 289 frame->loader().client()->loadErrorPage(reason_); |
291 createUserGestureIndicator(); | |
292 SubstituteData substituteData(SharedBuffer::create(), "text/plain", "UTF-8", | |
293 KURL(), ForceSynchronousLoad); | |
294 FrameLoadRequest request(originDocument(), url(), substituteData); | |
295 request.setReplacesCurrentItem(true); | |
296 request.setClientRedirect(ClientRedirectPolicy::ClientRedirect); | |
297 maybeLogScheduledNavigationClobber( | |
298 ScheduledNavigationType::ScheduledPageBlock, frame); | |
299 frame->loader().load(request); | |
300 } | 290 } |
301 | 291 |
302 private: | 292 private: |
303 ScheduledPageBlock(Document* originDocument, const String& url) | 293 ScheduledPageBlock(Document* originDocument, int reason) |
304 : ScheduledURLNavigation(0.0, originDocument, url, true, true) {} | 294 : ScheduledNavigation(0.0, originDocument, true, true), reason_(reason) {} |
| 295 |
| 296 int reason_; |
305 }; | 297 }; |
306 | 298 |
307 class ScheduledFormSubmission final : public ScheduledNavigation { | 299 class ScheduledFormSubmission final : public ScheduledNavigation { |
308 public: | 300 public: |
309 static ScheduledFormSubmission* create(Document* document, | 301 static ScheduledFormSubmission* create(Document* document, |
310 FormSubmission* submission, | 302 FormSubmission* submission, |
311 bool replacesCurrentItem) { | 303 bool replacesCurrentItem) { |
312 return new ScheduledFormSubmission(document, submission, | 304 return new ScheduledFormSubmission(document, submission, |
313 replacesCurrentItem); | 305 replacesCurrentItem); |
314 } | 306 } |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 request.setClientRedirect(ClientRedirectPolicy::ClientRedirect); | 447 request.setClientRedirect(ClientRedirectPolicy::ClientRedirect); |
456 m_frame->loader().load(request); | 448 m_frame->loader().load(request); |
457 return; | 449 return; |
458 } | 450 } |
459 } | 451 } |
460 | 452 |
461 schedule(ScheduledLocationChange::create(originDocument, url, | 453 schedule(ScheduledLocationChange::create(originDocument, url, |
462 replacesCurrentItem)); | 454 replacesCurrentItem)); |
463 } | 455 } |
464 | 456 |
465 void NavigationScheduler::schedulePageBlock(Document* originDocument) { | 457 void NavigationScheduler::schedulePageBlock(Document* originDocument, |
| 458 int reason) { |
466 DCHECK(m_frame->page()); | 459 DCHECK(m_frame->page()); |
467 const KURL& url = m_frame->document()->url(); | 460 schedule(ScheduledPageBlock::create(originDocument, reason)); |
468 schedule(ScheduledPageBlock::create(originDocument, url)); | |
469 } | 461 } |
470 | 462 |
471 void NavigationScheduler::scheduleFormSubmission(Document* document, | 463 void NavigationScheduler::scheduleFormSubmission(Document* document, |
472 FormSubmission* submission) { | 464 FormSubmission* submission) { |
473 DCHECK(m_frame->page()); | 465 DCHECK(m_frame->page()); |
474 schedule(ScheduledFormSubmission::create(document, submission, | 466 schedule(ScheduledFormSubmission::create(document, submission, |
475 mustReplaceCurrentItem(m_frame))); | 467 mustReplaceCurrentItem(m_frame))); |
476 } | 468 } |
477 | 469 |
478 void NavigationScheduler::scheduleReload() { | 470 void NavigationScheduler::scheduleReload() { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 m_navigateTaskFactory->cancel(); | 541 m_navigateTaskFactory->cancel(); |
550 m_redirect.clear(); | 542 m_redirect.clear(); |
551 } | 543 } |
552 | 544 |
553 DEFINE_TRACE(NavigationScheduler) { | 545 DEFINE_TRACE(NavigationScheduler) { |
554 visitor->trace(m_frame); | 546 visitor->trace(m_frame); |
555 visitor->trace(m_redirect); | 547 visitor->trace(m_redirect); |
556 } | 548 } |
557 | 549 |
558 } // namespace blink | 550 } // namespace blink |
OLD | NEW |