nsDataHandler.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  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 nsDataHandler_h___
  6. #define nsDataHandler_h___
  7. #include "nsIProtocolHandler.h"
  8. #include "nsWeakReference.h"
  9. class nsDataHandler : public nsIProtocolHandler
  10. , public nsSupportsWeakReference
  11. {
  12. virtual ~nsDataHandler();
  13. public:
  14. NS_DECL_ISUPPORTS
  15. // nsIProtocolHandler methods:
  16. NS_DECL_NSIPROTOCOLHANDLER
  17. // nsDataHandler methods:
  18. nsDataHandler();
  19. // Define a Create method to be used with a factory:
  20. static MOZ_MUST_USE nsresult
  21. Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult);
  22. // Parse a data: URI and return the individual parts
  23. // (the given spec will temporarily be modified but will be returned
  24. // to the original before returning)
  25. // contentCharset and dataBuffer can be nullptr if they are not needed.
  26. static MOZ_MUST_USE nsresult ParseURI(nsCString& spec,
  27. nsCString& contentType,
  28. nsCString* contentCharset,
  29. bool& isBase64,
  30. nsCString* dataBuffer);
  31. };
  32. #endif /* nsDataHandler_h___ */