2009-03-29 00:49:31 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef nsIDNService_h__
|
|
|
|
#define nsIDNService_h__
|
|
|
|
|
|
|
|
#include "nsIIDNService.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIObserver.h"
|
|
|
|
#include "nsWeakReference.h"
|
|
|
|
#include "nsIUnicodeNormalizer.h"
|
|
|
|
#include "nsIDNKitInterface.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
|
|
|
|
class nsIPrefBranch;
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// nsIDNService
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#define kACEPrefixLen 4
|
|
|
|
|
|
|
|
class nsIDNService : public nsIIDNService,
|
|
|
|
public nsIObserver,
|
|
|
|
public nsSupportsWeakReference
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIIDNSERVICE
|
|
|
|
NS_DECL_NSIOBSERVER
|
|
|
|
|
|
|
|
nsIDNService();
|
|
|
|
virtual ~nsIDNService();
|
|
|
|
|
|
|
|
nsresult Init();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void normalizeFullStops(nsAString& s);
|
2009-03-29 00:49:31 -07:00
|
|
|
nsresult stringPrepAndACE(const nsAString& in, nsACString& out,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool allowUnassigned);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult encodeToACE(const nsAString& in, nsACString& out);
|
2009-03-29 00:49:31 -07:00
|
|
|
nsresult stringPrep(const nsAString& in, nsAString& out,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool allowUnassigned);
|
2009-03-29 00:49:31 -07:00
|
|
|
nsresult decodeACE(const nsACString& in, nsACString& out,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool allowUnassigned);
|
2009-03-29 00:49:31 -07:00
|
|
|
nsresult UTF8toACE(const nsACString& in, nsACString& out,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool allowUnassigned);
|
2009-03-29 00:49:31 -07:00
|
|
|
nsresult ACEtoUTF8(const nsACString& in, nsACString& out,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool allowUnassigned);
|
|
|
|
bool isInWhitelist(const nsACString &host);
|
2007-03-22 10:30:00 -07:00
|
|
|
void prefsChanged(nsIPrefBranch *prefBranch, const PRUnichar *pref);
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mMultilingualTestBed; // if true generates extra node for multilingual testbed
|
2007-03-22 10:30:00 -07:00
|
|
|
idn_nameprep_t mNamePrepHandle;
|
|
|
|
nsCOMPtr<nsIUnicodeNormalizer> mNormalizer;
|
|
|
|
char mACEPrefix[kACEPrefixLen+1];
|
|
|
|
nsXPIDLString mIDNBlacklist;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mShowPunycode;
|
2007-12-03 22:30:47 -08:00
|
|
|
nsCOMPtr<nsIPrefBranch> mIDNWhitelistPrefBranch;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsIDNService_h__
|