Import from 1.9a8 tarball
[mozilla-extra.git] / extensions / wallet / src / nsWalletService.h
blob7ad20b5184194e9a530a1424f63908bce3b24a8c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is Mozilla Communicator client code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
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.
36 * ***** END LICENSE BLOCK ***** */
38 #ifndef nsWalletService_h___
39 #define nsWalletService_h___
41 #include "nsIWalletService.h"
42 #include "nsIObserver.h"
43 #include "nsIFormSubmitObserver.h"
44 #include "nsWeakReference.h"
45 #include "nsIPrompt.h"
46 #include "nsIPromptService2.h"
47 #include "nsIDOMWindow.h"
48 #include "nsIDOMWindowInternal.h"
49 #include "nsIURI.h"
50 #include "nsIWebProgressListener.h"
51 #include "nsIComponentManager.h"
52 #include "nsIGenericFactory.h"
53 #include "nsIAuthPromptWrapper.h"
54 #include "nsIAuthPrompt2.h"
55 #include "nsIPromptFactory.h"
57 class nsWalletlibService : public nsIWalletService,
58 public nsIObserver,
59 public nsIFormSubmitObserver,
60 public nsIWebProgressListener,
61 public nsIPromptFactory,
62 public nsSupportsWeakReference {
64 public:
65 NS_DECL_ISUPPORTS
66 NS_DECL_NSIWALLETSERVICE
67 NS_DECL_NSIOBSERVER
68 NS_DECL_NSIWEBPROGRESSLISTENER
69 NS_DECL_NSIPROMPTFACTORY
70 // NS_DECL_NSSUPPORTSWEAKREFERENCE
72 nsWalletlibService();
73 nsresult Init();
75 // NS_DECL_NSIFORMSUBMITOBSERVER
76 NS_IMETHOD Notify(nsIDOMHTMLFormElement* formNode, nsIDOMWindowInternal* window, nsIURI* actionURL, PRBool* cancelSubmit);
78 // {Un}Register proc that do category {Un}Registration
79 static NS_METHOD RegisterProc(nsIComponentManager *aCompMgr,
80 nsIFile *aPath,
81 const char *registryLocation,
82 const char *componentType,
83 const nsModuleComponentInfo *info);
84 static NS_METHOD UnregisterProc(nsIComponentManager *aCompMgr,
85 nsIFile *aPath,
86 const char *registryLocation,
87 const nsModuleComponentInfo *info);
90 protected:
91 virtual ~nsWalletlibService();
94 ////////////////////////////////////////////////////////////////////////////////
96 class nsSingleSignOnPrompt : public nsIAuthPromptWrapper
98 public:
99 NS_DECL_ISUPPORTS
100 NS_DECL_NSIAUTHPROMPT
101 NS_DECL_NSIAUTHPROMPTWRAPPER
103 nsSingleSignOnPrompt() { }
104 virtual ~nsSingleSignOnPrompt() {}
106 nsresult Init();
108 protected:
109 nsCOMPtr<nsIPrompt> mPrompt;
112 ////////////////////////////////////////////////////////////////////////////////
114 class nsWalletAuthPromptWrapper : public nsIAuthPrompt2
116 public:
117 NS_DECL_ISUPPORTS
118 NS_DECL_NSIAUTHPROMPT2
120 nsWalletAuthPromptWrapper(nsIPromptService2* aService,
121 nsIDOMWindow* aParent)
122 : mService(aService), mParent(aParent) {}
123 private:
124 ~nsWalletAuthPromptWrapper() {}
126 nsCOMPtr<nsIPromptService2> mService;
127 nsCOMPtr<nsIDOMWindow> mParent;
131 #endif /* nsWalletService_h___ */