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(m_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), |
| 295 m_reason(reason) {} |
| 296 |
| 297 int m_reason; |
305 }; | 298 }; |
306 | 299 |
307 class ScheduledFormSubmission final : public ScheduledNavigation { | 300 class ScheduledFormSubmission final : public ScheduledNavigation { |
308 public: | 301 public: |
309 static ScheduledFormSubmission* create(Document* document, | 302 static ScheduledFormSubmission* create(Document* document, |
310 FormSubmission* submission, | 303 FormSubmission* submission, |
311 bool replacesCurrentItem) { | 304 bool replacesCurrentItem) { |
312 return new ScheduledFormSubmission(document, submission, | 305 return new ScheduledFormSubmission(document, submission, |
313 replacesCurrentItem); | 306 replacesCurrentItem); |
314 } | 307 } |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 request.setClientRedirect(ClientRedirectPolicy::ClientRedirect); | 448 request.setClientRedirect(ClientRedirectPolicy::ClientRedirect); |
456 m_frame->loader().load(request); | 449 m_frame->loader().load(request); |
457 return; | 450 return; |
458 } | 451 } |
459 } | 452 } |
460 | 453 |
461 schedule(ScheduledLocationChange::create(originDocument, url, | 454 schedule(ScheduledLocationChange::create(originDocument, url, |
462 replacesCurrentItem)); | 455 replacesCurrentItem)); |
463 } | 456 } |
464 | 457 |
465 void NavigationScheduler::schedulePageBlock(Document* originDocument) { | 458 void NavigationScheduler::schedulePageBlock(Document* originDocument, |
| 459 int reason) { |
466 DCHECK(m_frame->page()); | 460 DCHECK(m_frame->page()); |
467 const KURL& url = m_frame->document()->url(); | 461 schedule(ScheduledPageBlock::create(originDocument, reason)); |
468 schedule(ScheduledPageBlock::create(originDocument, url)); | |
469 } | 462 } |
470 | 463 |
471 void NavigationScheduler::scheduleFormSubmission(Document* document, | 464 void NavigationScheduler::scheduleFormSubmission(Document* document, |
472 FormSubmission* submission) { | 465 FormSubmission* submission) { |
473 DCHECK(m_frame->page()); | 466 DCHECK(m_frame->page()); |
474 schedule(ScheduledFormSubmission::create(document, submission, | 467 schedule(ScheduledFormSubmission::create(document, submission, |
475 mustReplaceCurrentItem(m_frame))); | 468 mustReplaceCurrentItem(m_frame))); |
476 } | 469 } |
477 | 470 |
478 void NavigationScheduler::scheduleReload() { | 471 void NavigationScheduler::scheduleReload() { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 m_navigateTaskFactory->cancel(); | 542 m_navigateTaskFactory->cancel(); |
550 m_redirect.clear(); | 543 m_redirect.clear(); |
551 } | 544 } |
552 | 545 |
553 DEFINE_TRACE(NavigationScheduler) { | 546 DEFINE_TRACE(NavigationScheduler) { |
554 visitor->trace(m_frame); | 547 visitor->trace(m_frame); |
555 visitor->trace(m_redirect); | 548 visitor->trace(m_redirect); |
556 } | 549 } |
557 | 550 |
558 } // namespace blink | 551 } // namespace blink |
OLD | NEW |