toolkit/components/downloads/nsIApplicationReputation.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/components/downloads/nsIApplicationReputation.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,101 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim: set ts=2 et sw=2 tw=80: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#include "nsISupports.idl"
    1.11 +
    1.12 +interface nsIApplicationReputationCallback;
    1.13 +interface nsIApplicationReputationQuery;
    1.14 +interface nsIArray;
    1.15 +interface nsIURI;
    1.16 +
    1.17 +/*
    1.18 + * A service for asynchronously querying an application reputation service
    1.19 + * based on metadata of the downloaded file.
    1.20 + */
    1.21 +[scriptable, uuid(c9f03479-fd68-4393-acb2-c88d4f563174)]
    1.22 +interface nsIApplicationReputationService : nsISupports {
    1.23 +  /**
    1.24 +   * Start querying the application reputation service.
    1.25 +   *
    1.26 +   * @param aQuery
    1.27 +   *        The nsIApplicationReputationQuery containing metadata of the
    1.28 +   *        downloaded file.
    1.29 +   *
    1.30 +   * @param aCallback
    1.31 +   *        The callback for receiving the results of the query.
    1.32 +   *
    1.33 +   * @remarks aCallback may not be null.  onComplete is guaranteed to be called
    1.34 +   *          on aCallback. This function may not be called more than once with
    1.35 +   *          the same query object. If any of the attributes of aQuery have
    1.36 +   *          not been set or have been set with empty data (with the exception
    1.37 +   *          of sourceURI), then a valid request can still be constructed and
    1.38 +   *          will solicit a valid response, but won't produce any useful
    1.39 +   *          information.
    1.40 +   */
    1.41 +  void queryReputation(in nsIApplicationReputationQuery aQuery,
    1.42 +                       in nsIApplicationReputationCallback aCallback);
    1.43 +};
    1.44 +
    1.45 +/**
    1.46 + * A single-use, write-once interface for recording the metadata of the
    1.47 + * downloaded file. nsIApplicationReputationService.Start() may only be called
    1.48 + * once with a single query.
    1.49 + */
    1.50 +[scriptable, uuid(2c781cbe-ab0c-4c53-b06e-f0cb56f8a30b)]
    1.51 +interface nsIApplicationReputationQuery : nsISupports {
    1.52 +  /*
    1.53 +   * The nsIURI from which the file was downloaded. This may not be null.
    1.54 +   */
    1.55 +  readonly attribute nsIURI sourceURI;
    1.56 +
    1.57 +  /*
    1.58 +   * The reference, if any.
    1.59 +   */
    1.60 +  readonly attribute nsIURI referrerURI;
    1.61 +
    1.62 +  /*
    1.63 +   * The target filename for the downloaded file, as inferred from the source
    1.64 +   * URI or provided by the Content-Disposition attachment file name. If this
    1.65 +   * is not set by the caller, it will be passed as an empty string but the
    1.66 +   * query won't produce any useful information.
    1.67 +   */
    1.68 +  readonly attribute AString suggestedFileName;
    1.69 +
    1.70 +  /*
    1.71 +   * The size of the downloaded file in bytes.
    1.72 +   */
    1.73 +  readonly attribute unsigned long fileSize;
    1.74 +
    1.75 +  /*
    1.76 +   * The SHA256 hash of the downloaded file in raw bytes. If this is not set by
    1.77 +   * the caller, it will be passed as an empty string but the query won't
    1.78 +   * produce any useful information.
    1.79 +   */
    1.80 +  readonly attribute ACString sha256Hash;
    1.81 +
    1.82 +  /*
    1.83 +   * The nsIArray of nsIX509CertList of nsIX509Cert that verify for this
    1.84 +   * binary, if it is signed.
    1.85 +   */
    1.86 +  readonly attribute nsIArray signatureInfo;
    1.87 +};
    1.88 +
    1.89 +[scriptable, function, uuid(9a228470-cfe5-11e2-8b8b-0800200c9a66)]
    1.90 +interface nsIApplicationReputationCallback : nsISupports {
    1.91 +  /**
    1.92 +   * Callback for the result of the application reputation query.
    1.93 +   * @param aStatus
    1.94 +   *        NS_OK if and only if the query succeeded. If it did, then
    1.95 +   *        shouldBlock is meaningful (otherwise it defaults to false). This
    1.96 +   *        may be NS_ERROR_FAILURE if the response cannot be parsed, or
    1.97 +   *        NS_ERROR_NOT_AVAILABLE if the service has been disabled or is not
    1.98 +   *        reachable.
    1.99 +   * @param aShouldBlock
   1.100 +   *        Whether or not the download should be blocked.
   1.101 +   */
   1.102 +  void onComplete(in bool aShouldBlock,
   1.103 +                  in nsresult aStatus);
   1.104 +};

mercurial