Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 file, |
michael@0 | 3 | * 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 | interface nsIDOMDOMRequest; |
michael@0 | 8 | |
michael@0 | 9 | /** |
michael@0 | 10 | * Represents a data interface for which the manager is recording statistics. |
michael@0 | 11 | */ |
michael@0 | 12 | [scriptable, uuid(f540615b-d803-43ff-8200-2a9d145a5645)] |
michael@0 | 13 | interface nsIDOMMozNetworkStatsInterface : nsISupports |
michael@0 | 14 | { |
michael@0 | 15 | readonly attribute long type; |
michael@0 | 16 | |
michael@0 | 17 | /** |
michael@0 | 18 | * Id value is '0' for wifi or the iccid for mobile (SIM). |
michael@0 | 19 | */ |
michael@0 | 20 | readonly attribute DOMString id; |
michael@0 | 21 | }; |
michael@0 | 22 | |
michael@0 | 23 | [scriptable, builtinclass, uuid(063ebeb2-5c6e-47ae-bdcd-5e6ebdc7a68c)] |
michael@0 | 24 | interface nsIDOMMozNetworkStatsAlarm : nsISupports |
michael@0 | 25 | { |
michael@0 | 26 | readonly attribute unsigned long alarmId; |
michael@0 | 27 | readonly attribute nsIDOMMozNetworkStatsInterface network; |
michael@0 | 28 | readonly attribute long threshold; |
michael@0 | 29 | readonly attribute jsval data; |
michael@0 | 30 | }; |
michael@0 | 31 | |
michael@0 | 32 | [scriptable, uuid(8a66f4c1-0c25-4a66-9fc5-0106947b91f9)] |
michael@0 | 33 | interface nsIDOMMozNetworkStatsManager : nsISupports |
michael@0 | 34 | { |
michael@0 | 35 | /** |
michael@0 | 36 | * Constants for known interface types. |
michael@0 | 37 | */ |
michael@0 | 38 | const long WIFI = 0; |
michael@0 | 39 | const long MOBILE = 1; |
michael@0 | 40 | |
michael@0 | 41 | /** |
michael@0 | 42 | * Find samples between two dates start and end, both included. |
michael@0 | 43 | * |
michael@0 | 44 | * If options is provided, per-app or per-system service usage will be |
michael@0 | 45 | * retrieved; otherwise the target will be overall system usage. |
michael@0 | 46 | * |
michael@0 | 47 | * If success, the request result will be an nsIDOMMozNetworkStats object. |
michael@0 | 48 | */ |
michael@0 | 49 | nsIDOMDOMRequest getSamples(in nsIDOMMozNetworkStatsInterface network, |
michael@0 | 50 | in jsval start, |
michael@0 | 51 | in jsval end, |
michael@0 | 52 | [optional] in jsval options /* NetworkStatsGetOptions */); |
michael@0 | 53 | |
michael@0 | 54 | /** |
michael@0 | 55 | * Install an alarm on a network. The network must be in the return of |
michael@0 | 56 | * getAvailableNetworks() otherwise an "InvalidNetwork" exception will |
michael@0 | 57 | * be raised. |
michael@0 | 58 | * |
michael@0 | 59 | * When total data usage reaches threshold bytes, a "networkstats-alarm" |
michael@0 | 60 | * system message is sent to the application, where the optional parameter |
michael@0 | 61 | * |data| must be a cloneable object. |
michael@0 | 62 | * |
michael@0 | 63 | * If success, the |result| field of the DOMRequest keeps the alarm Id. |
michael@0 | 64 | */ |
michael@0 | 65 | nsIDOMDOMRequest addAlarm(in nsIDOMMozNetworkStatsInterface network, |
michael@0 | 66 | in long threshold, |
michael@0 | 67 | [optional] in jsval options /* NetworkStatsAlarmOptions */); |
michael@0 | 68 | |
michael@0 | 69 | /** |
michael@0 | 70 | * Obtain all alarms for those networks returned by getAvailableNetworks(). |
michael@0 | 71 | * If a network is provided, only retrieves the alarms for that network. |
michael@0 | 72 | * The network must be one of those returned by getAvailebleNetworks() or an |
michael@0 | 73 | * "InvalidNetwork" exception will be raised. |
michael@0 | 74 | * |
michael@0 | 75 | * Each alarm object has the same fields as that in the system message: |
michael@0 | 76 | * - alarmId |
michael@0 | 77 | * - network |
michael@0 | 78 | * - threshold |
michael@0 | 79 | * - data |
michael@0 | 80 | */ |
michael@0 | 81 | nsIDOMDOMRequest getAllAlarms([optional] in nsIDOMMozNetworkStatsInterface network); |
michael@0 | 82 | |
michael@0 | 83 | /** |
michael@0 | 84 | * Remove all network alarms. If an |alarmId| is provided, then only that |
michael@0 | 85 | * alarm is removed. |
michael@0 | 86 | */ |
michael@0 | 87 | nsIDOMDOMRequest removeAlarms([optional] in long alarmId); |
michael@0 | 88 | |
michael@0 | 89 | /** |
michael@0 | 90 | * Remove all stats related with the provided network from DB. |
michael@0 | 91 | */ |
michael@0 | 92 | nsIDOMDOMRequest clearStats(in nsIDOMMozNetworkStatsInterface network); |
michael@0 | 93 | |
michael@0 | 94 | /** |
michael@0 | 95 | * Remove all stats in the database. |
michael@0 | 96 | */ |
michael@0 | 97 | nsIDOMDOMRequest clearAllStats(); |
michael@0 | 98 | |
michael@0 | 99 | /** |
michael@0 | 100 | * Return available networks that used to be saved in the database. |
michael@0 | 101 | */ |
michael@0 | 102 | nsIDOMDOMRequest getAvailableNetworks(); // array of nsIDOMMozNetworkStatsInterface. |
michael@0 | 103 | |
michael@0 | 104 | /** |
michael@0 | 105 | * Return available service types that used to be saved in the database. |
michael@0 | 106 | */ |
michael@0 | 107 | nsIDOMDOMRequest getAvailableServiceTypes(); // array of string. |
michael@0 | 108 | |
michael@0 | 109 | /** |
michael@0 | 110 | * Minimum time in milliseconds between samples stored in the database. |
michael@0 | 111 | */ |
michael@0 | 112 | readonly attribute long sampleRate; |
michael@0 | 113 | |
michael@0 | 114 | /** |
michael@0 | 115 | * Time in milliseconds recorded by the API until present time. All samples |
michael@0 | 116 | * older than maxStorageAge from now are deleted. |
michael@0 | 117 | */ |
michael@0 | 118 | readonly attribute long long maxStorageAge; |
michael@0 | 119 | }; |