| // Copyright 2020 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_HTML_LINK_WEB_BUNDLE_H_ |
| #define THIRD_PARTY_BLINK_RENDERER_CORE_HTML_LINK_WEB_BUNDLE_H_ |
| |
| #include "mojo/public/cpp/bindings/pending_remote.h" |
| #include "services/network/public/mojom/url_loader_factory.mojom-blink.h" |
| #include "third_party/blink/renderer/core/core_export.h" |
| #include "third_party/blink/renderer/core/html/link_resource.h" |
| #include "third_party/blink/renderer/platform/loader/fetch/subresource_web_bundle.h" |
| #include "third_party/blink/renderer/platform/weborigin/kurl.h" |
| |
| namespace blink { |
| |
| class WebBundleLoader; |
| |
| // LinkWebBundle is used in the Subresource loading with Web Bundles feature. |
| // See crbug.com/1082020 for details. |
| // A <link rel="webbundle" ...> element creates LinkWebBundle. |
| class CORE_EXPORT LinkWebBundle final : public LinkResource, |
| public SubresourceWebBundle { |
| USING_GARBAGE_COLLECTED_MIXIN(LinkWebBundle); |
| |
| public: |
| explicit LinkWebBundle(HTMLLinkElement* owner); |
| ~LinkWebBundle() override; |
| void Trace(Visitor* visitor) const override; |
| |
| void NotifyLoaded(); |
| |
| // LinkResource overrides: |
| void Process() override; |
| LinkResourceType GetType() const override; |
| bool HasLoaded() const override; |
| void OwnerRemoved() override; |
| |
| // SubresourceWebBundle overrides: |
| bool CanHandleRequest(const KURL& url) const override; |
| mojo::PendingRemote<network::mojom::blink::URLLoaderFactory> |
| GetURLLoaderFactory() override; |
| |
| // Parse the given |str| as a url. If |str| doesn't meet the criteria which |
| // WebBundles specification requires, this returns invalid empty KURL as an |
| // error. |
| // See |
| // https://wicg.github.io/webpackage/draft-yasskin-wpack-bundled-exchanges.html#name-parsing-the-index-section |
| static KURL ParseResourceUrl(const AtomicString& str); |
| |
| Member<WebBundleLoader> bundle_loader_; |
| }; |
| |
| } // namespace blink |
| |
| #endif // THIRD_PARTY_BLINK_RENDERER_CORE_HTML_LINK_WEB_BUNDLE_H_ |