toolkit/components/exthelper/extIApplication.idl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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
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 interface nsIVariant;
michael@0 8 interface extIPreference;
michael@0 9 interface extISessionStorage;
michael@0 10
michael@0 11
michael@0 12 /**
michael@0 13 * Interface that gives simplified access to the console
michael@0 14 */
michael@0 15 [scriptable, uuid(ae8482e0-aa5a-11db-abbd-0800200c9a66)]
michael@0 16 interface extIConsole : nsISupports
michael@0 17 {
michael@0 18 /**
michael@0 19 * Sends a given string to the console.
michael@0 20 * @param aMsg
michael@0 21 * The text to send to the console
michael@0 22 */
michael@0 23 void log(in AString aMsg);
michael@0 24
michael@0 25 /**
michael@0 26 * Opens the error console window. The console window
michael@0 27 * is focused if already open.
michael@0 28 */
michael@0 29 void open();
michael@0 30 };
michael@0 31
michael@0 32
michael@0 33 /**
michael@0 34 * Interface holds information about an event.
michael@0 35 */
michael@0 36 [scriptable, function, uuid(05281820-ab62-11db-abbd-0800200c9a66)]
michael@0 37 interface extIEventItem : nsISupports
michael@0 38 {
michael@0 39 /**
michael@0 40 * The name of the event
michael@0 41 */
michael@0 42 readonly attribute AString type;
michael@0 43
michael@0 44 /**
michael@0 45 * Can hold extra details and data associated with the event. This
michael@0 46 * is optional and event specific. If the event does not send extra
michael@0 47 * details, this is null.
michael@0 48 */
michael@0 49 readonly attribute nsIVariant data;
michael@0 50
michael@0 51 /**
michael@0 52 * Cancels the event if it is cancelable.
michael@0 53 */
michael@0 54 void preventDefault();
michael@0 55 };
michael@0 56
michael@0 57
michael@0 58 /**
michael@0 59 * Interface used as a callback for listening to events.
michael@0 60 */
michael@0 61 [scriptable, function, uuid(2dfe3a50-ab2f-11db-abbd-0800200c9a66)]
michael@0 62 interface extIEventListener : nsISupports
michael@0 63 {
michael@0 64 /**
michael@0 65 * This method is called whenever an event occurs of the type for which
michael@0 66 * the extIEventListener interface was registered.
michael@0 67 *
michael@0 68 * @param aEvent
michael@0 69 * The extIEventItem associated with the event.
michael@0 70 */
michael@0 71 void handleEvent(in extIEventItem aEvent);
michael@0 72 };
michael@0 73
michael@0 74
michael@0 75 /**
michael@0 76 * Interface for supporting custom events.
michael@0 77 */
michael@0 78 [scriptable, uuid(3a8ec9d0-ab19-11db-abbd-0800200c9a66)]
michael@0 79 interface extIEvents : nsISupports
michael@0 80 {
michael@0 81 /**
michael@0 82 * Adds an event listener to the list. If multiple identical event listeners
michael@0 83 * are registered on the same event target with the same parameters the
michael@0 84 * duplicate instances are discarded. They do not cause the EventListener
michael@0 85 * to be called twice and since they are discarded they do not need to be
michael@0 86 * removed with the removeListener method.
michael@0 87 *
michael@0 88 * @param aEvent
michael@0 89 * The name of an event
michael@0 90 * @param aListener
michael@0 91 * The reference to a listener
michael@0 92 */
michael@0 93 void addListener(in AString aEvent, in extIEventListener aListener);
michael@0 94
michael@0 95 /**
michael@0 96 * Removes an event listener from the list. Calling remove
michael@0 97 * with arguments which do not identify any currently registered
michael@0 98 * event listener has no effect.
michael@0 99 * @param aEvent
michael@0 100 * The name of an event
michael@0 101 * @param aListener
michael@0 102 * The reference to a listener
michael@0 103 */
michael@0 104 void removeListener(in AString aEvent, in extIEventListener aListener);
michael@0 105 };
michael@0 106
michael@0 107
michael@0 108 /**
michael@0 109 * Interface for simplified access to preferences. The interface has a
michael@0 110 * predefined root preference branch. The root branch is set based on the
michael@0 111 * context of the owner. For example, an extension's preferences have a root
michael@0 112 * of "extensions.<extensionid>.", while the application level preferences
michael@0 113 * have an empty root. All preference "aName" parameters used in this interface
michael@0 114 * are relative to the root branch.
michael@0 115 */
michael@0 116 [scriptable, uuid(ce697d40-aa5a-11db-abbd-0800200c9a66)]
michael@0 117 interface extIPreferenceBranch : nsISupports
michael@0 118 {
michael@0 119 /**
michael@0 120 * The name of the branch root.
michael@0 121 */
michael@0 122 readonly attribute AString root;
michael@0 123
michael@0 124 /**
michael@0 125 * Array of extIPreference listing all preferences in this branch.
michael@0 126 */
michael@0 127 readonly attribute nsIVariant all;
michael@0 128
michael@0 129 /**
michael@0 130 * The events object for the preferences
michael@0 131 * supports: "change"
michael@0 132 */
michael@0 133 readonly attribute extIEvents events;
michael@0 134
michael@0 135 /**
michael@0 136 * Check to see if a preference exists.
michael@0 137 * @param aName
michael@0 138 * The name of preference
michael@0 139 * @returns true if the preference exists, false if not
michael@0 140 */
michael@0 141 boolean has(in AString aName);
michael@0 142
michael@0 143 /**
michael@0 144 * Gets an object representing a preference
michael@0 145 * @param aName
michael@0 146 * The name of preference
michael@0 147 * @returns a preference object, or null if the preference does not exist
michael@0 148 */
michael@0 149 extIPreference get(in AString aName);
michael@0 150
michael@0 151 /**
michael@0 152 * Gets the value of a preference. Returns a default value if
michael@0 153 * the preference does not exist.
michael@0 154 * @param aName
michael@0 155 * The name of preference
michael@0 156 * @param aDefaultValue
michael@0 157 * The value to return if preference does not exist
michael@0 158 * @returns value of the preference or the given default value if preference
michael@0 159 * does not exists.
michael@0 160 */
michael@0 161 nsIVariant getValue(in AString aName, in nsIVariant aDefaultValue);
michael@0 162
michael@0 163 /**
michael@0 164 * Sets the value of a storage item with the given name.
michael@0 165 * @param aName
michael@0 166 * The name of an item
michael@0 167 * @param aValue
michael@0 168 * The value to assign to the item
michael@0 169 */
michael@0 170 void setValue(in AString aName, in nsIVariant aValue);
michael@0 171
michael@0 172 /**
michael@0 173 * Resets all preferences in a branch back to their default values.
michael@0 174 */
michael@0 175 void reset();
michael@0 176 };
michael@0 177
michael@0 178 /**
michael@0 179 * Interface for accessing a single preference. The data is not cached.
michael@0 180 * All reads access the current state of the preference.
michael@0 181 */
michael@0 182 [scriptable, uuid(2C7462E2-72C2-4473-9007-0E6AE71E23CA)]
michael@0 183 interface extIPreference : nsISupports
michael@0 184 {
michael@0 185 /**
michael@0 186 * The name of the preference.
michael@0 187 */
michael@0 188 readonly attribute AString name;
michael@0 189
michael@0 190 /**
michael@0 191 * A string representing the type of preference (String, Boolean, or Number).
michael@0 192 */
michael@0 193 readonly attribute AString type;
michael@0 194
michael@0 195 /**
michael@0 196 * Get/Set the value of the preference.
michael@0 197 */
michael@0 198 attribute nsIVariant value;
michael@0 199
michael@0 200 /**
michael@0 201 * Get the locked state of the preference. Set to a boolean value to (un)lock it.
michael@0 202 */
michael@0 203 attribute boolean locked;
michael@0 204
michael@0 205 /**
michael@0 206 * Check if a preference has been modified by the user, or not.
michael@0 207 */
michael@0 208 readonly attribute boolean modified;
michael@0 209
michael@0 210 /**
michael@0 211 * The preference branch that contains this preference.
michael@0 212 */
michael@0 213 readonly attribute extIPreferenceBranch branch;
michael@0 214
michael@0 215 /**
michael@0 216 * The events object for this preference.
michael@0 217 * supports: "change"
michael@0 218 */
michael@0 219 readonly attribute extIEvents events;
michael@0 220
michael@0 221 /**
michael@0 222 * Resets a preference back to its default values.
michael@0 223 */
michael@0 224 void reset();
michael@0 225 };
michael@0 226
michael@0 227
michael@0 228 /**
michael@0 229 * Interface representing an extension
michael@0 230 */
michael@0 231 [scriptable, uuid(10cee02c-f6e0-4d61-ab27-c16572b18c46)]
michael@0 232 interface extIExtension : nsISupports
michael@0 233 {
michael@0 234 /**
michael@0 235 * The id of the extension.
michael@0 236 */
michael@0 237 readonly attribute AString id;
michael@0 238
michael@0 239 /**
michael@0 240 * The name of the extension.
michael@0 241 */
michael@0 242 readonly attribute AString name;
michael@0 243
michael@0 244 /**
michael@0 245 * Check if the extension is currently enabled, or not.
michael@0 246 */
michael@0 247 readonly attribute boolean enabled;
michael@0 248
michael@0 249 /**
michael@0 250 * The version number of the extension.
michael@0 251 */
michael@0 252 readonly attribute AString version;
michael@0 253
michael@0 254 /**
michael@0 255 * Indicates whether this is the extension's first run after install
michael@0 256 */
michael@0 257 readonly attribute boolean firstRun;
michael@0 258
michael@0 259 /**
michael@0 260 * The preferences object for the extension. Defaults to the
michael@0 261 * "extensions.<extensionid>." branch.
michael@0 262 */
michael@0 263 readonly attribute extIPreferenceBranch prefs;
michael@0 264
michael@0 265 /**
michael@0 266 * The storage object for the extension.
michael@0 267 */
michael@0 268 readonly attribute extISessionStorage storage;
michael@0 269
michael@0 270 /**
michael@0 271 * The events object for the extension.
michael@0 272 * supports: "uninstall"
michael@0 273 */
michael@0 274 readonly attribute extIEvents events;
michael@0 275 };
michael@0 276
michael@0 277 /**
michael@0 278 * Interface representing a list of all installed extensions
michael@0 279 */
michael@0 280 [scriptable, uuid(de281930-aa5a-11db-abbd-0800200c9a66)]
michael@0 281 interface extIExtensions : nsISupports
michael@0 282 {
michael@0 283 /**
michael@0 284 * Array of extIExtension listing all extensions in the application.
michael@0 285 */
michael@0 286 readonly attribute nsIVariant all;
michael@0 287
michael@0 288 /**
michael@0 289 * Determines if an extension exists with the given id.
michael@0 290 * @param aId
michael@0 291 * The id of an extension
michael@0 292 * @returns true if an extension exists with the given id,
michael@0 293 * false otherwise.
michael@0 294 */
michael@0 295 boolean has(in AString aId);
michael@0 296
michael@0 297 /**
michael@0 298 * Gets a extIExtension object for an extension.
michael@0 299 * @param aId
michael@0 300 * The id of an extension
michael@0 301 * @returns An extension object or null if no extension exists
michael@0 302 * with the given id.
michael@0 303 */
michael@0 304 extIExtension get(in AString aId);
michael@0 305 };
michael@0 306
michael@0 307 /**
michael@0 308 * Interface representing a callback that receives an array of extIExtensions
michael@0 309 */
michael@0 310 [scriptable, function, uuid(2571cbb5-550d-4400-8038-75df9b553f98)]
michael@0 311 interface extIExtensionsCallback : nsISupports
michael@0 312 {
michael@0 313 void callback(in nsIVariant extensions);
michael@0 314 };
michael@0 315
michael@0 316 /**
michael@0 317 * Interface representing a simple storage system
michael@0 318 */
michael@0 319 [scriptable, uuid(0787ac44-29b9-4889-b97f-13573aec6971)]
michael@0 320 interface extISessionStorage : nsISupports
michael@0 321 {
michael@0 322 /**
michael@0 323 * The events object for the storage
michael@0 324 * supports: "change"
michael@0 325 */
michael@0 326 readonly attribute extIEvents events;
michael@0 327
michael@0 328 /**
michael@0 329 * Determines if a storage item exists with the given name.
michael@0 330 * @param aName
michael@0 331 * The name of an item
michael@0 332 * @returns true if an item exists with the given name,
michael@0 333 * false otherwise.
michael@0 334 */
michael@0 335 boolean has(in AString aName);
michael@0 336
michael@0 337 /**
michael@0 338 * Sets the value of a storage item with the given name.
michael@0 339 * @param aName
michael@0 340 * The name of an item
michael@0 341 * @param aValue
michael@0 342 * The value to assign to the item
michael@0 343 */
michael@0 344 void set(in AString aName, in nsIVariant aValue);
michael@0 345
michael@0 346 /**
michael@0 347 * Gets the value of a storage item with the given name. Returns a
michael@0 348 * default value if the item does not exist.
michael@0 349 * @param aName
michael@0 350 * The name of an item
michael@0 351 * @param aDefaultValue
michael@0 352 * The value to return if no item exists with the given name
michael@0 353 * @returns value of the item or the given default value if no item
michael@0 354 * exists with the given name.
michael@0 355 */
michael@0 356 nsIVariant get(in AString aName, in nsIVariant aDefaultValue);
michael@0 357 };
michael@0 358
michael@0 359 [scriptable, uuid(2be87909-0817-4292-acfa-fc39be53be3f)]
michael@0 360 interface extIApplication : nsISupports
michael@0 361 {
michael@0 362 /**
michael@0 363 * The id of the application.
michael@0 364 */
michael@0 365 readonly attribute AString id;
michael@0 366
michael@0 367 /**
michael@0 368 * The name of the application.
michael@0 369 */
michael@0 370 readonly attribute AString name;
michael@0 371
michael@0 372 /**
michael@0 373 * The version number of the application.
michael@0 374 */
michael@0 375 readonly attribute AString version;
michael@0 376
michael@0 377 /**
michael@0 378 * The console object for the application.
michael@0 379 */
michael@0 380 readonly attribute extIConsole console;
michael@0 381
michael@0 382 /**
michael@0 383 * The extensions object for the application. Contains a list
michael@0 384 * of all installed extensions.
michael@0 385 */
michael@0 386 void getExtensions(in extIExtensionsCallback aCallback);
michael@0 387
michael@0 388 /**
michael@0 389 * The preferences object for the application. Defaults to an empty
michael@0 390 * root branch.
michael@0 391 */
michael@0 392 readonly attribute extIPreferenceBranch prefs;
michael@0 393
michael@0 394 /**
michael@0 395 * The storage object for the application.
michael@0 396 */
michael@0 397 readonly attribute extISessionStorage storage;
michael@0 398
michael@0 399 /**
michael@0 400 * The events object for the application.
michael@0 401 * supports: "load", "ready", "quit", "unload"
michael@0 402 */
michael@0 403 readonly attribute extIEvents events;
michael@0 404
michael@0 405 /**
michael@0 406 * Quits the application (if nobody objects to quit-application-requested).
michael@0 407 * @returns whether quitting will proceed
michael@0 408 */
michael@0 409 boolean quit();
michael@0 410
michael@0 411 /**
michael@0 412 * Restarts the application (if nobody objects to quit-application-requested).
michael@0 413 * @returns whether restarting will proceed
michael@0 414 */
michael@0 415 boolean restart();
michael@0 416 };

mercurial