| // 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 "third_party/blink/public/mojom/quota/quota_types.mojom"; |
| import "url/mojom/origin.mojom"; |
| |
| // API for the renderer process to request quota information from the browser |
| // process. |
| // TODO(sashab): Put callback parameters in an optional struct, only set on |
| // success. |
| // TODO(sashab): Remove |origin|, with the browser using the one directly from |
| // the RenderFrameHost instead. |
| interface QuotaDispatcherHost { |
| // Render process queries the storage partition's storage usage and quota |
| // information from the browser process. The callback will be called with the |
| // current usage and quota information for the partition. When an error occurs |
| // the callback is called with a status code other than kOk. |
| // Can be called from workers or frames. |
| QueryStorageUsageAndQuota(url.mojom.Origin origin, |
| blink.mojom.StorageType storage_type) => |
| (blink.mojom.QuotaStatusCode error, |
| int64 current_usage, |
| int64 current_quota, |
| UsageBreakdown usage_breakdown); |
| |
| // Renderer process requests a new quota size for the origin's storage from |
| // the browser process. |requested_size| indicates how much storage space (in |
| // bytes) the caller expects to need. |
| // The callback will be called when a new quota is granted, with kOk as the |
| // status code if successful or with an error code otherwise. |
| // Note that the requested quota size may not always be granted and a smaller |
| // amount of quota than requested might be returned. |
| // Cannot be called from workers, only from frames, since it may require |
| // displaying permission UI. |
| RequestStorageQuota(url.mojom.Origin origin, |
| blink.mojom.StorageType storage_type, |
| uint64 requested_size) => |
| (blink.mojom.QuotaStatusCode error, |
| int64 current_usage, |
| int64 granted_quota); |
| }; |