OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1692 if (!webframe_child) | 1692 if (!webframe_child) |
1693 return nullptr; | 1693 return nullptr; |
1694 | 1694 |
1695 webframe_child->InitializeCoreFrame(*GetFrame()->GetPage(), owner_element, | 1695 webframe_child->InitializeCoreFrame(*GetFrame()->GetPage(), owner_element, |
1696 name); | 1696 name); |
1697 // Initializing the core frame may cause the new child to be detached, since | 1697 // Initializing the core frame may cause the new child to be detached, since |
1698 // it may dispatch a load event in the parent. | 1698 // it may dispatch a load event in the parent. |
1699 if (!webframe_child->Parent()) | 1699 if (!webframe_child->Parent()) |
1700 return nullptr; | 1700 return nullptr; |
1701 | 1701 |
1702 // If we're moving in the back/forward list, we might want to replace the | 1702 FrameLoadRequest new_request = request; |
1703 // content of this child frame with whatever was there at that point. | 1703 FrameLoadType child_load_type = kFrameLoadTypeStandard; |
1704 HistoryItem* child_item = nullptr; | 1704 HistoryItem* child_item = nullptr; |
1705 if (IsBackForwardLoadType( | |
1706 GetFrame()->Loader().GetDocumentLoader()->LoadType()) && | |
1707 !GetFrame()->GetDocument()->LoadEventFinished()) | |
1708 child_item = webframe_child->Client()->HistoryItemForNewChildFrame(); | |
1709 | 1705 |
1710 FrameLoadRequest new_request = request; | 1706 if (!GetFrame()->GetDocument()->LoadEventFinished()) { |
1711 FrameLoadType load_type = kFrameLoadTypeStandard; | 1707 FrameLoadType load_type = |
1712 if (child_item) { | 1708 GetFrame()->Loader().GetDocumentLoader()->LoadType(); |
1713 new_request = FrameLoadRequest( | 1709 switch (load_type) { |
1714 request.OriginDocument(), child_item->GenerateResourceRequest( | 1710 case kFrameLoadTypeStandard: |
1715 WebCachePolicy::kUseProtocolCachePolicy)); | 1711 case kFrameLoadTypeReplaceCurrentItem: |
1716 load_type = kFrameLoadTypeInitialHistoryLoad; | 1712 case kFrameLoadTypeInitialInChildFrame: |
| 1713 break; |
| 1714 |
| 1715 // If we're moving in the back/forward list, we might want to replace the |
| 1716 // content of this child frame with whatever was there at that point. |
| 1717 case kFrameLoadTypeBackForward: |
| 1718 case kFrameLoadTypeInitialHistoryLoad: |
| 1719 child_item = webframe_child->Client()->HistoryItemForNewChildFrame(); |
| 1720 if (child_item) { |
| 1721 child_load_type = kFrameLoadTypeInitialHistoryLoad; |
| 1722 new_request = |
| 1723 FrameLoadRequest(request.OriginDocument(), |
| 1724 child_item->GenerateResourceRequest( |
| 1725 WebCachePolicy::kUseProtocolCachePolicy)); |
| 1726 } |
| 1727 break; |
| 1728 |
| 1729 // We're in a middle of a reload. The FrameLoadType is propagated to its |
| 1730 // children only if it is a ReloadBypassingCache, else it becomes a |
| 1731 // standard load. |
| 1732 case kFrameLoadTypeReload: |
| 1733 break; |
| 1734 case kFrameLoadTypeReloadBypassingCache: |
| 1735 child_load_type = kFrameLoadTypeReloadBypassingCache; |
| 1736 new_request.GetResourceRequest().SetCachePolicy( |
| 1737 WebCachePolicy::kBypassingCache); |
| 1738 break; |
| 1739 } |
1717 } | 1740 } |
1718 webframe_child->GetFrame()->Loader().Load(new_request, load_type, child_item); | 1741 |
| 1742 webframe_child->GetFrame()->Loader().Load(new_request, child_load_type, |
| 1743 child_item); |
1719 | 1744 |
1720 // Note a synchronous navigation (about:blank) would have already processed | 1745 // Note a synchronous navigation (about:blank) would have already processed |
1721 // onload, so it is possible for the child frame to have already been | 1746 // onload, so it is possible for the child frame to have already been |
1722 // detached by script in the page. | 1747 // detached by script in the page. |
1723 if (!webframe_child->Parent()) | 1748 if (!webframe_child->Parent()) |
1724 return nullptr; | 1749 return nullptr; |
1725 return webframe_child->GetFrame(); | 1750 return webframe_child->GetFrame(); |
1726 } | 1751 } |
1727 | 1752 |
1728 void WebLocalFrameImpl::DidChangeContentsSize(const IntSize& size) { | 1753 void WebLocalFrameImpl::DidChangeContentsSize(const IntSize& size) { |
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2573 TextCheckerClient& WebLocalFrameImpl::GetTextCheckerClient() const { | 2598 TextCheckerClient& WebLocalFrameImpl::GetTextCheckerClient() const { |
2574 return *text_checker_client_; | 2599 return *text_checker_client_; |
2575 } | 2600 } |
2576 | 2601 |
2577 void WebLocalFrameImpl::SetTextCheckClient( | 2602 void WebLocalFrameImpl::SetTextCheckClient( |
2578 WebTextCheckClient* text_check_client) { | 2603 WebTextCheckClient* text_check_client) { |
2579 text_check_client_ = text_check_client; | 2604 text_check_client_ = text_check_client; |
2580 } | 2605 } |
2581 | 2606 |
2582 } // namespace blink | 2607 } // namespace blink |
OLD | NEW |