nsDefaultURIFixup.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* -*- Mode: C++; tab-width: 8; 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/. */
  5. #ifndef NSDEFAULTURIFIXUP_H
  6. #define NSDEFAULTURIFIXUP_H
  7. #include "nsIURIFixup.h"
  8. class nsDefaultURIFixupInfo;
  9. /* Header file */
  10. class nsDefaultURIFixup : public nsIURIFixup
  11. {
  12. public:
  13. NS_DECL_ISUPPORTS
  14. NS_DECL_NSIURIFIXUP
  15. nsDefaultURIFixup();
  16. protected:
  17. virtual ~nsDefaultURIFixup();
  18. private:
  19. /* additional members */
  20. nsresult FileURIFixup(const nsACString& aStringURI, nsIURI** aURI);
  21. nsresult ConvertFileToStringURI(const nsACString& aIn, nsCString& aResult);
  22. nsresult FixupURIProtocol(const nsACString& aIn,
  23. nsDefaultURIFixupInfo* aFixupInfo,
  24. nsIURI** aURI);
  25. nsresult KeywordURIFixup(const nsACString& aStringURI,
  26. nsDefaultURIFixupInfo* aFixupInfo,
  27. nsIInputStream** aPostData);
  28. nsresult TryKeywordFixupForURIInfo(const nsACString& aStringURI,
  29. nsDefaultURIFixupInfo* aFixupInfo,
  30. nsIInputStream** aPostData);
  31. bool PossiblyByteExpandedFileName(const nsAString& aIn);
  32. bool PossiblyHostPortUrl(const nsACString& aUrl);
  33. bool MakeAlternateURI(nsIURI* aURI);
  34. bool IsDomainWhitelisted(const nsACString& aAsciiHost,
  35. const uint32_t aDotLoc);
  36. };
  37. class nsDefaultURIFixupInfo : public nsIURIFixupInfo
  38. {
  39. public:
  40. NS_DECL_ISUPPORTS
  41. NS_DECL_NSIURIFIXUPINFO
  42. explicit nsDefaultURIFixupInfo(const nsACString& aOriginalInput);
  43. friend class nsDefaultURIFixup;
  44. protected:
  45. virtual ~nsDefaultURIFixupInfo();
  46. private:
  47. nsCOMPtr<nsISupports> mConsumer;
  48. nsCOMPtr<nsIURI> mPreferredURI;
  49. nsCOMPtr<nsIURI> mFixedURI;
  50. bool mFixupChangedProtocol;
  51. bool mFixupCreatedAlternateURI;
  52. nsString mKeywordProviderName;
  53. nsString mKeywordAsSent;
  54. nsCString mOriginalInput;
  55. };
  56. #endif