gecko-dev/netwerk/base/nsIPackagedAppService.idl

45 lines
1.7 KiB
Plaintext

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
interface nsIChannel;
interface nsICacheEntryOpenCallback;
%{C++
#define PACKAGED_APP_TOKEN "!//"
%}
/**
* nsIPackagedAppService
*/
[scriptable, builtinclass, uuid(9c96c638-e80c-4dce-abec-c96fdb7a25d8)]
interface nsIPackagedAppService : nsISupports
{
/**
* @param aChannel
* this param is passed to the packaged app service in order to provide
* info about the requesting channel, which wants to access the contents
* of a packaged app resource. Its URI has the following format:
* http://domain.com/path/to/package.pak!//path/to/subresource.html
*
* @param aCallback
* an object implementing nsICacheEntryOpenCallback
* this is the target of the async result of the operation
* aCallback->OnCacheEntryCheck() is called to verify the entry is valid
* aCallback->OnCacheEntryAvailable() is called with a pointer to the
* the cached entry, if one exists, or an error code otherwise
* aCallback is kept alive using an nsCOMPtr until OnCacheEntryAvailable
* is called
*
* Calling this method will either download the package containing the given
* resource URI, store it in the cache and pass the cache entry to aCallback,
* or if that resource has already been downloaded it will be served from
* the cache.
*/
void getResource(in nsIChannel aChannel,
in nsICacheEntryOpenCallback aCallback);
};