blob: 39d2707ce6486fa1690bf789dd16c485a4a833c5 [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 blink.mojom;
import "mojo/public/mojom/base/time.mojom";
import "mojo/public/mojom/base/unguessable_token.mojom";
import "services/network/public/mojom/url_loader_factory.mojom";
import "third_party/blink/public/mojom/appcache/appcache_info.mojom";
import "third_party/blink/public/mojom/devtools/console_message.mojom";
import "url/mojom/url.mojom";
enum AppCacheEventID {
APPCACHE_CHECKING_EVENT = 0,
APPCACHE_ERROR_EVENT,
APPCACHE_NO_UPDATE_EVENT,
APPCACHE_DOWNLOADING_EVENT,
APPCACHE_PROGRESS_EVENT,
APPCACHE_UPDATE_READY_EVENT,
APPCACHE_CACHED_EVENT,
APPCACHE_OBSOLETE_EVENT,
};
enum AppCacheErrorReason {
APPCACHE_MANIFEST_ERROR,
APPCACHE_SIGNATURE_ERROR,
APPCACHE_RESOURCE_ERROR,
APPCACHE_CHANGED_ERROR,
APPCACHE_ABORT_ERROR,
APPCACHE_QUOTA_ERROR,
APPCACHE_POLICY_ERROR,
APPCACHE_UNKNOWN_ERROR,
};
// Per-resource information displayed in DevTools.
struct AppCacheResourceInfo {
url.mojom.Url url;
// Disk space consumed by this resource.
int64 response_size;
// Padding added when the Quota API counts this resource.
//
// Non-zero only for opaque responses.
int64 padding_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.
//
// Unregistering the host is accomplished by closing the AppCacheHost pipe.
RegisterHost(pending_receiver<AppCacheHost> host_receiver,
pending_remote<AppCacheFrontend> frontend,
mojo_base.mojom.UnguessableToken host_id);
};
interface AppCacheHost {
// 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.
//
// Called prior to the main resource load. When the system contains multiple
// candidates for a main resource load, the appcache preferred by the host
// that created this host is used to break ties.
SetSpawningHostId(mojo_base.mojom.UnguessableToken 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.
// '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(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.
SelectCacheForWorker(int64 appcache_id);
// Informs the browser of a 'foreign' entry in an appcache.
MarkAsForeignEntry(url.mojom.Url document_url,
int64 appcache_document_was_loaded_from);
// Returns the status of the appcache associated with host_id.
[Sync]
GetStatus() => (AppCacheStatus status);
// Initiates an update of the appcache associated with host_id.
[Sync]
StartUpdate() => (bool success);
// Swaps a new pending appcache, if there is one, into use for host_id.
[Sync]
SwapCache() => (bool success);
// Gets resource list from appcache synchronously.
[Sync]
GetResourceList() => (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 AppCacheHost.SelectCache.
CacheSelected(AppCacheInfo info);
// Notifies the renderer of an AppCache event other than the
// progress event which has a seperate message.
EventRaised(AppCacheEventID event_id);
// Notifies the renderer of an AppCache progress event.
ProgressEventRaised(url.mojom.Url url,
int32 total,
int32 complete);
// Notifies the renderer of an AppCache error event.
ErrorEventRaised(AppCacheErrorDetails error_details);
// Notifies the renderer of an AppCache logging message.
LogMessage(ConsoleMessageLevel log_level, string message);
// In the network service world this message sets the URLLoaderFactory to be
// used for subresources.
SetSubresourceFactory(
pending_remote<network.mojom.URLLoaderFactory> url_loader_factory);
};