1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 
5 #ifndef NSSErrorsService_h
6 #define NSSErrorsService_h
7 
8 #include "nsINSSErrorsService.h"
9 #include "mozilla/Attributes.h"
10 #include "nsCOMPtr.h"
11 #include "nsIStringBundle.h"
12 #include "prerror.h"
13 
14 namespace mozilla {
15 namespace psm {
16 
17 class NSSErrorsService final : public nsINSSErrorsService
18 {
19   NS_DECL_ISUPPORTS
20   NS_DECL_NSINSSERRORSSERVICE
21 
22 public:
23   nsresult Init();
24 
25 private:
26   // For XPCOM implementations that are not a base class for some other
27   // class, it is good practice to make the destructor non-virtual and
28   // private.  Then the only way to delete the object is via Release.
29 #ifdef _MSC_VER
30   // C4265: Class has virtual members but destructor is not virtual
31   __pragma(warning(disable:4265))
32 #endif
33   ~NSSErrorsService();
34 
35   nsCOMPtr<nsIStringBundle> mPIPNSSBundle;
36   nsCOMPtr<nsIStringBundle> mNSSErrorsBundle;
37 };
38 
39 bool IsNSSErrorCode(PRErrorCode code);
40 nsresult GetXPCOMFromNSSError(PRErrorCode code);
41 bool ErrorIsOverridable(PRErrorCode code);
42 
43 } // namespace psm
44 } // namespace mozilla
45 
46 #define NS_NSSERRORSSERVICE_CID \
47   { 0x9ef18451, 0xa157, 0x4d17, { 0x81, 0x32, 0x47, 0xaf, 0xef, 0x21, 0x36, 0x89 } }
48 
49 #endif // NSSErrorsService_h
50