| // Copyright 2017 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. |
| module blink.mojom; |
| |
| import "services/network/public/interfaces/url_loader_factory.mojom"; |
| import "third_party/WebKit/common/blob/blob.mojom"; |
| import "url/mojom/url.mojom"; |
| |
| // This interface is implemented by the browser to give renderers the ability to |
| // create and revoke blob URLs. BlobRegistry exposes a method get a instance of |
| // this interface for a particular origin. |
| interface BlobURLStore { |
| // Registers a public Blob URL. When the connection to the BlobURLStore closes |
| // all URLs registered through it will be revoked. |
| // TODO(kinuko,mek): This should probably create and return a new blob: URL rather |
| // than letting the caller in the renderer provide one. |
| [Sync] Register(blink.mojom.Blob blob, url.mojom.Url url) => (); |
| |
| // Revokes a public Blob URL. |
| Revoke(url.mojom.Url url); |
| |
| // Resolves a public Blob URL. |
| Resolve(url.mojom.Url url) => (blink.mojom.Blob? blob); |
| |
| // Resolves a public Blob URL to a URLLoaderFactory that can only load the |
| // specified URL. The reason the API is shaped like this rather than just |
| // having a URLLoaderFactory for all Blob URLs is that resolution of blob URLs |
| // has to happen separately before fetching starts. |
| // As long as the resulting URLLoaderFactory is alive the resolved blob will |
| // also be kept alive, so it is possible to start loading the blob long after |
| // both the blob URL and all other references to the blob have been dropped. |
| ResolveAsURLLoaderFactory(url.mojom.Url url, |
| network.mojom.URLLoaderFactory& factory); |
| }; |