Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 :
8 : /**
9 : * MODULE NOTES:
10 : * @created kmcclusk 10/19/99
11 : *
12 : */
13 :
14 : #ifndef nsIFormProcessor_h__
15 : #define nsIFormProcessor_h__
16 :
17 : #include "nsISupports.h"
18 : #include "nsTArrayForwardDeclare.h"
19 :
20 : class nsString;
21 : class nsIDOMHTMLElement;
22 :
23 : // {0ae53c0f-8ea2-4916-bedc-717443c3e185}
24 : #define NS_FORMPROCESSOR_CID \
25 : { 0x0ae53c0f, 0x8ea2, 0x4916, { 0xbe, 0xdc, 0x71, 0x74, 0x43, 0xc3, 0xe1, 0x85 } }
26 :
27 : #define NS_FORMPROCESSOR_CONTRACTID "@mozilla.org/layout/form-processor;1"
28 :
29 : // bf8b1986-8800-424b-b1e5-7a2ca8b9e76c
30 : #define NS_IFORMPROCESSOR_IID \
31 : { 0xbf8b1986, 0x8800, 0x424b, \
32 : { 0xb1, 0xe5, 0x7a, 0x2c, 0xa8, 0xb9, 0xe7, 0x6c } }
33 :
34 : // XXX:In the future, we should examine combining this interface with nsIFormSubmitObserver.
35 : // nsIFormSubmitObserver could have a before, during, and after form submission methods.
36 : // The before and after methods would be passed a nsISupports interface. The During would
37 : // Have the same method signature as ProcessValue.
38 :
39 :
40 0 : class nsIFormProcessor : public nsISupports {
41 : public:
42 : NS_DECLARE_STATIC_IID_ACCESSOR(NS_IFORMPROCESSOR_IID)
43 :
44 : /* ProcessValue is called for each name value pair that is
45 : * about to be submitted for both "get" and "post" form submissions.
46 : *
47 : * The formprocessor is registered as a service that gets called for
48 : * every form submission.
49 : *
50 : * @param aElement element which the attribute/value pair is submitted for
51 : * @param aName value of the form element name attribute about to be submitted
52 : * @param aValue On entry it contains the value about to be submitted for aName.
53 : * On exit it contains the value which will actually be submitted for aName.
54 : *
55 : */
56 : virtual nsresult ProcessValue(nsIDOMHTMLElement* aElement,
57 : const nsAString& aName,
58 : nsAString& aValue) = 0;
59 :
60 : /**
61 : * The same as above, but with the element unpacked so that this can be
62 : * called as the result of an IPC message.
63 : */
64 : virtual nsresult ProcessValueIPC(const nsAString& aOldValue,
65 : const nsAString& aKeyType,
66 : const nsAString& aChallenge,
67 : const nsAString& aKeyParams,
68 : nsAString& newValue) = 0;
69 :
70 : /* Provide content for a form element. This method provides a mechanism to provide
71 : * content which comes from a source other than the document (i.e. a local database)
72 : *
73 : * @param aFormType Type of form to get content for.
74 : * @param aOptions List of nsStrings which define the contents for the form element
75 : * @param aAttr Attribute to be attached to the form element. It is used to identify
76 : * the form element contains non-standard content.
77 : */
78 :
79 : virtual nsresult ProvideContent(const nsAString& aFormType,
80 : nsTArray<nsString>& aContent,
81 : nsAString& aAttribute) = 0;
82 :
83 : };
84 :
85 : NS_DEFINE_STATIC_IID_ACCESSOR(nsIFormProcessor, NS_IFORMPROCESSOR_IID)
86 :
87 : #endif /* nsIFormProcessor_h__ */
88 :
|