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