blob: 1140177324ff9f1034e60d957634b704315262d1 [file] [log] [blame]
// 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 content.mojom;
import "content/public/common/appcache_info.mojom";
import "url/mojom/url.mojom";
import "services/network/public/mojom/url_loader_factory.mojom";
enum AppCacheEventID {
enum AppCacheErrorReason {
struct AppCacheResourceInfo {
url.mojom.Url url;
int64 size;
bool is_master;
bool is_manifest;
bool is_intercept;
bool is_fallback;
bool is_foreign;
bool is_explicit;
int64 response_id;
struct AppCacheErrorDetails {
string message;
AppCacheErrorReason reason = APPCACHE_UNKNOWN_ERROR;
url.mojom.Url url;
int32 status;
bool is_cross_origin;
// AppCache messages sent from the child process to the browser.
interface AppCacheBackend {
// Informs the browser of a new appcache host.
RegisterHost(int32 host_id);
// Informs the browser of an appcache host being destroyed.
UnregisterHost(int32 host_id);
// Informs the browser of which host caused another to be created.
// This can influence which appcache should be utilized for the main
// resource load into the newly created host, so it should be sent
// prior to the main resource request being initiated.
SetSpawningHostId(int32 host_id, int32 spawning_host_id);
// Initiates the cache selection algorithm for the given host.
// This is sent prior to any subresource loads. An AppCacheMsg_CacheSelected
// message will be sent in response.
// 'host_id' indentifies a specific document or worker
// 'document_url' the url of the main resource
// 'appcache_document_was_loaded_from' the id of the appcache the main
// resource was loaded from or kAppCacheNoCacheId
// 'opt_manifest_url' the manifest url specified in the <html> tag if any
SelectCache(int32 host_id,
url.mojom.Url document_url,
int64 appcache_document_was_loaded_from,
url.mojom.Url opt_manifest_url);
// Initiates worker specific cache selection algorithm for the given host.
SelectCacheForSharedWorker(int32 host_id, int64 appcache_id);
// Informs the browser of a 'foreign' entry in an appcache.
MarkAsForeignEntry(int32 host_id,
url.mojom.Url document_url,
int64 appcache_document_was_loaded_from);
// Returns the status of the appcache associated with host_id.
GetStatus(int32 host_id) => (AppCacheStatus status);
// Initiates an update of the appcache associated with host_id.
StartUpdate(int32 host_id) => (bool success);
// Swaps a new pending appcache, if there is one, into use for host_id.
SwapCache(int32 host_id) => (bool success);
// Gets resource list from appcache synchronously.
GetResourceList(int32 host_id) => (array<AppCacheResourceInfo> resources);
// AppCache messages sent from the browser to the renderer process.
interface AppCacheFrontend {
// Notifies the renderer of the appcache that has been selected for a
// a particular host. This is sent in reply to AppCacheHostMsg_SelectCache.
CacheSelected(int32 host_id, AppCacheInfo info);
// Notifies the renderer of an AppCache status change.
StatusChanged(array<int32> host_ids, AppCacheStatus status);
// Notifies the renderer of an AppCache event other than the
// progress event which has a seperate message.
EventRaised(array<int32> host_ids, AppCacheEventID event_id);
// Notifies the renderer of an AppCache progress event.
ProgressEventRaised(array<int32> host_ids,
url.mojom.Url url,
int32 total,
int32 complete);
// Notifies the renderer of an AppCache error event.
ErrorEventRaised(array<int32> host_ids, AppCacheErrorDetails error_details);
// Notifies the renderer of an AppCache logging message.
LogMessage(int32 host_id, int32 log_level, string message);
// Notifies the renderer of the fact that AppCache access was blocked.
ContentBlocked(int32 host_id, url.mojom.Url manifest_url);
// In the network service world this message sets the URLLoaderFactory to be
// used for subresources.
SetSubresourceFactory(int32 host_id,
network.mojom.URLLoaderFactory url_loader_factory);