Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #include "nsISupports.idl" |
michael@0 | 6 | |
michael@0 | 7 | /** |
michael@0 | 8 | * This interface is implemented by nsIUrlClassifierHashCompleter clients. |
michael@0 | 9 | */ |
michael@0 | 10 | [scriptable, uuid(da16de40-df26-414d-bde7-c4faf4504868)] |
michael@0 | 11 | interface nsIUrlClassifierHashCompleterCallback : nsISupports |
michael@0 | 12 | { |
michael@0 | 13 | /** |
michael@0 | 14 | * A complete hash has been found that matches the partial hash. |
michael@0 | 15 | * This method may be called 0-n times for a given |
michael@0 | 16 | * nsIUrlClassifierCompleter::complete() call. |
michael@0 | 17 | * |
michael@0 | 18 | * @param hash |
michael@0 | 19 | * The 128-bit hash that was discovered. |
michael@0 | 20 | * @param table |
michael@0 | 21 | * The name of the table that this hash belongs to. |
michael@0 | 22 | * @param chunkId |
michael@0 | 23 | * The database chunk that this hash belongs to. |
michael@0 | 24 | */ |
michael@0 | 25 | void completion(in ACString hash, |
michael@0 | 26 | in ACString table, |
michael@0 | 27 | in uint32_t chunkId); |
michael@0 | 28 | |
michael@0 | 29 | /** |
michael@0 | 30 | * The completion is complete. This method is called once per |
michael@0 | 31 | * nsIUrlClassifierCompleter::complete() call, after all completion() |
michael@0 | 32 | * calls are finished. |
michael@0 | 33 | * |
michael@0 | 34 | * @param status |
michael@0 | 35 | * NS_OK if the request completed successfully, or an error code. |
michael@0 | 36 | */ |
michael@0 | 37 | void completionFinished(in nsresult status); |
michael@0 | 38 | }; |
michael@0 | 39 | |
michael@0 | 40 | /** |
michael@0 | 41 | * Clients updating the url-classifier database have the option of sending |
michael@0 | 42 | * partial (32-bit) hashes of URL fragments to be blacklisted. If the |
michael@0 | 43 | * url-classifier encounters one of these truncated hashes, it will ask an |
michael@0 | 44 | * nsIUrlClassifierCompleter instance to asynchronously provide the complete |
michael@0 | 45 | * hash, along with some associated metadata. |
michael@0 | 46 | * This is only ever used for testing and should absolutely be deleted (I |
michael@0 | 47 | * think). |
michael@0 | 48 | */ |
michael@0 | 49 | [scriptable, uuid(ade9b72b-3562-44f5-aba6-e63246be53ae)] |
michael@0 | 50 | interface nsIUrlClassifierHashCompleter : nsISupports |
michael@0 | 51 | { |
michael@0 | 52 | /** |
michael@0 | 53 | * Request a completed hash. |
michael@0 | 54 | * |
michael@0 | 55 | * @param partialHash |
michael@0 | 56 | * The 32-bit hash encountered by the url-classifier. |
michael@0 | 57 | * @param callback |
michael@0 | 58 | * An nsIUrlClassifierCompleterCallback instance. |
michael@0 | 59 | */ |
michael@0 | 60 | void complete(in ACString partialHash, |
michael@0 | 61 | in nsIUrlClassifierHashCompleterCallback callback); |
michael@0 | 62 | /** |
michael@0 | 63 | * The URL for the gethash request |
michael@0 | 64 | */ |
michael@0 | 65 | attribute ACString gethashUrl; |
michael@0 | 66 | }; |