| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 std::unique_ptr<WebDocumentSubresourceFilter> subresourceFilter) { | 169 std::unique_ptr<WebDocumentSubresourceFilter> subresourceFilter) { |
| 170 m_subresourceFilter = std::move(subresourceFilter); | 170 m_subresourceFilter = std::move(subresourceFilter); |
| 171 } | 171 } |
| 172 | 172 |
| 173 Resource* DocumentLoader::startPreload(Resource::Type type, | 173 Resource* DocumentLoader::startPreload(Resource::Type type, |
| 174 FetchRequest& request) { | 174 FetchRequest& request) { |
| 175 Resource* resource = nullptr; | 175 Resource* resource = nullptr; |
| 176 switch (type) { | 176 switch (type) { |
| 177 case Resource::Image: | 177 case Resource::Image: |
| 178 if (m_frame && m_frame->settings() && | 178 if (m_frame && m_frame->settings() && |
| 179 m_frame->settings()->fetchImagePlaceholders()) { | 179 m_frame->settings()->GetFEtchImagePlaceholders()) { |
| 180 request.setAllowImagePlaceholder(); | 180 request.setAllowImagePlaceholder(); |
| 181 } | 181 } |
| 182 resource = ImageResource::fetch(request, fetcher()); | 182 resource = ImageResource::fetch(request, fetcher()); |
| 183 break; | 183 break; |
| 184 case Resource::Script: | 184 case Resource::Script: |
| 185 resource = ScriptResource::fetch(request, fetcher()); | 185 resource = ScriptResource::fetch(request, fetcher()); |
| 186 break; | 186 break; |
| 187 case Resource::CSSStyleSheet: | 187 case Resource::CSSStyleSheet: |
| 188 resource = CSSStyleSheetResource::fetch(request, fetcher()); | 188 resource = CSSStyleSheetResource::fetch(request, fetcher()); |
| 189 break; | 189 break; |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 DCHECK_EQ(m_state, NotStarted); | 723 DCHECK_EQ(m_state, NotStarted); |
| 724 m_state = Provisional; | 724 m_state = Provisional; |
| 725 | 725 |
| 726 if (maybeLoadEmpty()) | 726 if (maybeLoadEmpty()) |
| 727 return; | 727 return; |
| 728 | 728 |
| 729 DCHECK(timing().navigationStart()); | 729 DCHECK(timing().navigationStart()); |
| 730 | 730 |
| 731 // PlzNavigate: | 731 // PlzNavigate: |
| 732 // The fetch has already started in the browser. Don't mark it again. | 732 // The fetch has already started in the browser. Don't mark it again. |
| 733 if (!m_frame->settings()->browserSideNavigationEnabled()) { | 733 if (!m_frame->settings()->GetBrowserSideNavigationEnabled()) { |
| 734 DCHECK(!timing().fetchStart()); | 734 DCHECK(!timing().fetchStart()); |
| 735 timing().markFetchStart(); | 735 timing().markFetchStart(); |
| 736 } | 736 } |
| 737 | 737 |
| 738 DEFINE_STATIC_LOCAL( | 738 DEFINE_STATIC_LOCAL( |
| 739 ResourceLoaderOptions, mainResourceLoadOptions, | 739 ResourceLoaderOptions, mainResourceLoadOptions, |
| 740 (DoNotBufferData, AllowStoredCredentials, ClientRequestedCredentials, | 740 (DoNotBufferData, AllowStoredCredentials, ClientRequestedCredentials, |
| 741 CheckContentSecurityPolicy, DocumentContext)); | 741 CheckContentSecurityPolicy, DocumentContext)); |
| 742 FetchRequest fetchRequest(m_request, FetchInitiatorTypeNames::document, | 742 FetchRequest fetchRequest(m_request, FetchInitiatorTypeNames::document, |
| 743 mainResourceLoadOptions); | 743 mainResourceLoadOptions); |
| 744 m_mainResource = | 744 m_mainResource = |
| 745 RawResource::fetchMainResource(fetchRequest, fetcher(), m_substituteData); | 745 RawResource::fetchMainResource(fetchRequest, fetcher(), m_substituteData); |
| 746 | 746 |
| 747 // PlzNavigate: | 747 // PlzNavigate: |
| 748 // The final access checks are still performed here, potentially rejecting | 748 // The final access checks are still performed here, potentially rejecting |
| 749 // the "provisional" load, but the browser side already expects the renderer | 749 // the "provisional" load, but the browser side already expects the renderer |
| 750 // to be able to unconditionally commit. | 750 // to be able to unconditionally commit. |
| 751 if (!m_mainResource || (m_frame->settings()->browserSideNavigationEnabled() && | 751 if (!m_mainResource || |
| 752 m_mainResource->errorOccurred())) { | 752 (m_frame->settings()->GetBrowserSideNavigationEnabled() && |
| 753 m_mainResource->errorOccurred())) { |
| 753 m_request = ResourceRequest(blankURL()); | 754 m_request = ResourceRequest(blankURL()); |
| 754 maybeLoadEmpty(); | 755 maybeLoadEmpty(); |
| 755 return; | 756 return; |
| 756 } | 757 } |
| 757 // A bunch of headers are set when the underlying resource load begins, and | 758 // A bunch of headers are set when the underlying resource load begins, and |
| 758 // m_request needs to include those. Even when using a cached resource, we may | 759 // m_request needs to include those. Even when using a cached resource, we may |
| 759 // make some modification to the request, e.g. adding the referer header. | 760 // make some modification to the request, e.g. adding the referer header. |
| 760 m_request = m_mainResource->isLoading() ? m_mainResource->resourceRequest() | 761 m_request = m_mainResource->isLoading() ? m_mainResource->resourceRequest() |
| 761 : fetchRequest.resourceRequest(); | 762 : fetchRequest.resourceRequest(); |
| 762 m_mainResource->addClient(this); | 763 m_mainResource->addClient(this); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 m_writer ? m_writer->encoding() : emptyAtom, true, | 818 m_writer ? m_writer->encoding() : emptyAtom, true, |
| 818 ForceSynchronousParsing); | 819 ForceSynchronousParsing); |
| 819 if (!source.isNull()) | 820 if (!source.isNull()) |
| 820 m_writer->appendReplacingData(source); | 821 m_writer->appendReplacingData(source); |
| 821 endWriting(); | 822 endWriting(); |
| 822 } | 823 } |
| 823 | 824 |
| 824 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); | 825 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); |
| 825 | 826 |
| 826 } // namespace blink | 827 } // namespace blink |
| OLD | NEW |