1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 *
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
8 *
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
13 *
14 * The Original Code is the Mozilla toolkit.
15 *
16 * The Initial Developer of the Original Code is
17 * Benjamin Smedberg <benjamin@smedbergs.us>
18 *
19 * Portions created by the Initial Developer are Copyright (C) 2004
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 *
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
35 *
36 * ***** END LICENSE BLOCK ***** */
37
38 #include "nsISupports.idl"
39 #include "nsICommandLine.idl"
40
41 [ptr] native nsCharPtrArray(char*);
42
43 /**
44 * Extension of nsICommandLine that allows for initialization of new command lines
45 * and running the command line actions by processing the command line handlers.
46 *
47 * @status INTERNAL - This interface is not meant for use by embedders, and is
48 * not intended to be frozen. If you are an embedder and need
49 * functionality provided by this interface, talk to Benjamin
50 * Smedberg <benjamin@smedbergs.us>.
51 */
52
53 [uuid(c1f4cfbf-a41f-4628-aa6c-9fb914478af8)]
54 interface nsICommandLineRunner : nsICommandLine
55 {
56 /**
57 * This method assumes a native character set, and is meant to be called
58 * with the argc/argv passed to main(). Talk to bsmedberg if you need to
59 * create a command line using other data. argv will not be altered in any
60 * way.
61 *
62 * On Windows, the "native" character set is UTF-8, not the native codepage.
63 *
64 * @param workingDir The working directory for resolving file and URI paths.
65 * @param state The nsICommandLine.state flag.
66 */
67 void init(in long argc, in nsCharPtrArray argv,
68 in nsIFile workingDir, in unsigned long state);
69
70 /**
71 * Set the windowContext parameter.
72 */
73 void setWindowContext(in nsIDOMWindow aWindow);
74
75 /**
76 * Process the command-line handlers in the proper order, calling "handle()" on
77 * each.
78 *
79 * @throws NS_ERROR_ABORT if any handler throws NS_ERROR_ABORT. All other errors
80 * thrown by handlers will be silently ignored.
81 */
82 void run();
83
84 /**
85 * Process and combine the help text provided by each command-line handler.
86 */
87 readonly attribute AUTF8String helpText;
88 };