2015-06-02 22:46:15 +00:00
|
|
|
/* -*- 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"
|
|
|
|
|
2015-08-25 01:06:24 +00:00
|
|
|
interface nsIChannel;
|
2015-06-02 22:46:15 +00:00
|
|
|
interface nsICacheEntryOpenCallback;
|
|
|
|
|
|
|
|
%{C++
|
|
|
|
#define PACKAGED_APP_TOKEN "!//"
|
|
|
|
%}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* nsIPackagedAppService
|
|
|
|
*/
|
2015-08-25 01:06:24 +00:00
|
|
|
[scriptable, builtinclass, uuid(9c96c638-e80c-4dce-abec-c96fdb7a25d8)]
|
2015-06-02 22:46:15 +00:00
|
|
|
interface nsIPackagedAppService : nsISupports
|
|
|
|
{
|
|
|
|
/**
|
2015-08-25 01:06:24 +00:00
|
|
|
* @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
|
|
|
|
*
|
2015-08-10 09:21:57 +00:00
|
|
|
* @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
|
2015-06-02 22:46:15 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2015-08-25 01:06:24 +00:00
|
|
|
void getResource(in nsIChannel aChannel,
|
2015-08-10 09:21:57 +00:00
|
|
|
in nsICacheEntryOpenCallback aCallback);
|
2015-06-02 22:46:15 +00:00
|
|
|
};
|