toolkit/components/downloads/nsIApplicationReputation.idl

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* vim: set ts=2 et sw=2 tw=80: */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #include "nsISupports.idl"
michael@0 8
michael@0 9 interface nsIApplicationReputationCallback;
michael@0 10 interface nsIApplicationReputationQuery;
michael@0 11 interface nsIArray;
michael@0 12 interface nsIURI;
michael@0 13
michael@0 14 /*
michael@0 15 * A service for asynchronously querying an application reputation service
michael@0 16 * based on metadata of the downloaded file.
michael@0 17 */
michael@0 18 [scriptable, uuid(c9f03479-fd68-4393-acb2-c88d4f563174)]
michael@0 19 interface nsIApplicationReputationService : nsISupports {
michael@0 20 /**
michael@0 21 * Start querying the application reputation service.
michael@0 22 *
michael@0 23 * @param aQuery
michael@0 24 * The nsIApplicationReputationQuery containing metadata of the
michael@0 25 * downloaded file.
michael@0 26 *
michael@0 27 * @param aCallback
michael@0 28 * The callback for receiving the results of the query.
michael@0 29 *
michael@0 30 * @remarks aCallback may not be null. onComplete is guaranteed to be called
michael@0 31 * on aCallback. This function may not be called more than once with
michael@0 32 * the same query object. If any of the attributes of aQuery have
michael@0 33 * not been set or have been set with empty data (with the exception
michael@0 34 * of sourceURI), then a valid request can still be constructed and
michael@0 35 * will solicit a valid response, but won't produce any useful
michael@0 36 * information.
michael@0 37 */
michael@0 38 void queryReputation(in nsIApplicationReputationQuery aQuery,
michael@0 39 in nsIApplicationReputationCallback aCallback);
michael@0 40 };
michael@0 41
michael@0 42 /**
michael@0 43 * A single-use, write-once interface for recording the metadata of the
michael@0 44 * downloaded file. nsIApplicationReputationService.Start() may only be called
michael@0 45 * once with a single query.
michael@0 46 */
michael@0 47 [scriptable, uuid(2c781cbe-ab0c-4c53-b06e-f0cb56f8a30b)]
michael@0 48 interface nsIApplicationReputationQuery : nsISupports {
michael@0 49 /*
michael@0 50 * The nsIURI from which the file was downloaded. This may not be null.
michael@0 51 */
michael@0 52 readonly attribute nsIURI sourceURI;
michael@0 53
michael@0 54 /*
michael@0 55 * The reference, if any.
michael@0 56 */
michael@0 57 readonly attribute nsIURI referrerURI;
michael@0 58
michael@0 59 /*
michael@0 60 * The target filename for the downloaded file, as inferred from the source
michael@0 61 * URI or provided by the Content-Disposition attachment file name. If this
michael@0 62 * is not set by the caller, it will be passed as an empty string but the
michael@0 63 * query won't produce any useful information.
michael@0 64 */
michael@0 65 readonly attribute AString suggestedFileName;
michael@0 66
michael@0 67 /*
michael@0 68 * The size of the downloaded file in bytes.
michael@0 69 */
michael@0 70 readonly attribute unsigned long fileSize;
michael@0 71
michael@0 72 /*
michael@0 73 * The SHA256 hash of the downloaded file in raw bytes. If this is not set by
michael@0 74 * the caller, it will be passed as an empty string but the query won't
michael@0 75 * produce any useful information.
michael@0 76 */
michael@0 77 readonly attribute ACString sha256Hash;
michael@0 78
michael@0 79 /*
michael@0 80 * The nsIArray of nsIX509CertList of nsIX509Cert that verify for this
michael@0 81 * binary, if it is signed.
michael@0 82 */
michael@0 83 readonly attribute nsIArray signatureInfo;
michael@0 84 };
michael@0 85
michael@0 86 [scriptable, function, uuid(9a228470-cfe5-11e2-8b8b-0800200c9a66)]
michael@0 87 interface nsIApplicationReputationCallback : nsISupports {
michael@0 88 /**
michael@0 89 * Callback for the result of the application reputation query.
michael@0 90 * @param aStatus
michael@0 91 * NS_OK if and only if the query succeeded. If it did, then
michael@0 92 * shouldBlock is meaningful (otherwise it defaults to false). This
michael@0 93 * may be NS_ERROR_FAILURE if the response cannot be parsed, or
michael@0 94 * NS_ERROR_NOT_AVAILABLE if the service has been disabled or is not
michael@0 95 * reachable.
michael@0 96 * @param aShouldBlock
michael@0 97 * Whether or not the download should be blocked.
michael@0 98 */
michael@0 99 void onComplete(in bool aShouldBlock,
michael@0 100 in nsresult aStatus);
michael@0 101 };

mercurial