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.

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

mercurial