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 mozilla.org code.
15 *
16 * The Initial Developer of the Original Code is
17 * Netscape Communications Corporation.
18 * Portions created by the Initial Developer are Copyright (C) 2001
19 * the Initial Developer. All Rights Reserved.
20 *
21 * Contributor(s):
22 * Joe Hewitt <hewitt@netscape.com> (Original Author)
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 interface nsIFile;
40
41 /**
42 * The nsIFormHistory object is a service which holds a set of name/value
43 * pairs. The names correspond to form field names, and the values correspond
44 * to values the user has submitted. So, several values may exist for a single
45 * name.
46 *
47 * Note: this interface provides no means to access stored values.
48 * Stored values are used by the FormFillController to generate
49 * autocomplete matches.
50 */
51
52 [scriptable, uuid(a61f0a62-ae0a-4382-b474-d259442ca80c)]
53 interface nsIFormHistory2 : nsISupports
54 {
55 /**
56 * Returns true if the form history has any entries.
57 */
58 readonly attribute boolean hasEntries;
59
60 /**
61 * Adds a name and value pair to the form history.
62 */
63 void addEntry(in AString name, in AString value);
64
65 /**
66 * Removes a name and value pair from the form history.
67 */
68 void removeEntry(in AString name, in AString value);
69
70 /**
71 * Removes all entries that are paired with a name.
72 */
73 void removeEntriesForName(in AString name);
74
75 /**
76 * Removes all entries in the entire form history.
77 */
78 void removeAllEntries();
79
80 /**
81 * Returns true if there is no entry that is paired with a name.
82 */
83 boolean nameExists(in AString name);
84
85 /**
86 * Gets whether a name and value pair exists in the form history.
87 */
88 boolean entryExists(in AString name, in AString value);
89 };
90
91 /**
92 * nsIFormHistoryImporter is an interface for importing a Mork formhistory.dat
93 * file into the new form history storage.
94 */
95
96 [scriptable, uuid(9e811188-6a5b-4d96-a92d-1bac66a41898)]
97 interface nsIFormHistoryImporter : nsISupports
98 {
99 /**
100 * Import the given Mork form history file.
101 * @param file The Mork form history file to import
102 * @param history A reference to the nsIFormHistory. This is
103 * supplied since the importer is invoked during
104 * form history initialization.
105 */
106 void importFormHistory(in nsIFile file, in nsIFormHistory2 formHistory);
107 };