michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIApplicationReputationCallback; michael@0: interface nsIApplicationReputationQuery; michael@0: interface nsIArray; michael@0: interface nsIURI; michael@0: michael@0: /* michael@0: * A service for asynchronously querying an application reputation service michael@0: * based on metadata of the downloaded file. michael@0: */ michael@0: [scriptable, uuid(c9f03479-fd68-4393-acb2-c88d4f563174)] michael@0: interface nsIApplicationReputationService : nsISupports { michael@0: /** michael@0: * Start querying the application reputation service. michael@0: * michael@0: * @param aQuery michael@0: * The nsIApplicationReputationQuery containing metadata of the michael@0: * downloaded file. michael@0: * michael@0: * @param aCallback michael@0: * The callback for receiving the results of the query. michael@0: * michael@0: * @remarks aCallback may not be null. onComplete is guaranteed to be called michael@0: * on aCallback. This function may not be called more than once with michael@0: * the same query object. If any of the attributes of aQuery have michael@0: * not been set or have been set with empty data (with the exception michael@0: * of sourceURI), then a valid request can still be constructed and michael@0: * will solicit a valid response, but won't produce any useful michael@0: * information. michael@0: */ michael@0: void queryReputation(in nsIApplicationReputationQuery aQuery, michael@0: in nsIApplicationReputationCallback aCallback); michael@0: }; michael@0: michael@0: /** michael@0: * A single-use, write-once interface for recording the metadata of the michael@0: * downloaded file. nsIApplicationReputationService.Start() may only be called michael@0: * once with a single query. michael@0: */ michael@0: [scriptable, uuid(2c781cbe-ab0c-4c53-b06e-f0cb56f8a30b)] michael@0: interface nsIApplicationReputationQuery : nsISupports { michael@0: /* michael@0: * The nsIURI from which the file was downloaded. This may not be null. michael@0: */ michael@0: readonly attribute nsIURI sourceURI; michael@0: michael@0: /* michael@0: * The reference, if any. michael@0: */ michael@0: readonly attribute nsIURI referrerURI; michael@0: michael@0: /* michael@0: * The target filename for the downloaded file, as inferred from the source michael@0: * URI or provided by the Content-Disposition attachment file name. If this michael@0: * is not set by the caller, it will be passed as an empty string but the michael@0: * query won't produce any useful information. michael@0: */ michael@0: readonly attribute AString suggestedFileName; michael@0: michael@0: /* michael@0: * The size of the downloaded file in bytes. michael@0: */ michael@0: readonly attribute unsigned long fileSize; michael@0: michael@0: /* michael@0: * The SHA256 hash of the downloaded file in raw bytes. If this is not set by michael@0: * the caller, it will be passed as an empty string but the query won't michael@0: * produce any useful information. michael@0: */ michael@0: readonly attribute ACString sha256Hash; michael@0: michael@0: /* michael@0: * The nsIArray of nsIX509CertList of nsIX509Cert that verify for this michael@0: * binary, if it is signed. michael@0: */ michael@0: readonly attribute nsIArray signatureInfo; michael@0: }; michael@0: michael@0: [scriptable, function, uuid(9a228470-cfe5-11e2-8b8b-0800200c9a66)] michael@0: interface nsIApplicationReputationCallback : nsISupports { michael@0: /** michael@0: * Callback for the result of the application reputation query. michael@0: * @param aStatus michael@0: * NS_OK if and only if the query succeeded. If it did, then michael@0: * shouldBlock is meaningful (otherwise it defaults to false). This michael@0: * may be NS_ERROR_FAILURE if the response cannot be parsed, or michael@0: * NS_ERROR_NOT_AVAILABLE if the service has been disabled or is not michael@0: * reachable. michael@0: * @param aShouldBlock michael@0: * Whether or not the download should be blocked. michael@0: */ michael@0: void onComplete(in bool aShouldBlock, michael@0: in nsresult aStatus); michael@0: };