Bug 1890277: part 1) Add CSP parser tests for `require-trusted-types-for`. r=tschuster
[gecko.git] / uriloader / exthandler / HandlerServiceParent.h
bloba8952f743ef3643d00aa90e0f6f3c62b6a143152
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef handler_service_parent_h
8 #define handler_service_parent_h
10 #include "mozilla/dom/PHandlerServiceParent.h"
11 #include "nsIMIMEInfo.h"
13 class nsIHandlerApp;
15 class HandlerServiceParent final : public mozilla::dom::PHandlerServiceParent {
16 public:
17 HandlerServiceParent();
18 NS_INLINE_DECL_REFCOUNTING(HandlerServiceParent, final)
20 private:
21 virtual ~HandlerServiceParent();
22 void ActorDestroy(ActorDestroyReason aWhy) override;
24 mozilla::ipc::IPCResult RecvFillHandlerInfo(
25 const HandlerInfo& aHandlerInfoData, const nsACString& aOverrideType,
26 HandlerInfo* handlerInfoData) override;
28 mozilla::ipc::IPCResult RecvGetMIMEInfoFromOS(const nsACString& aMIMEType,
29 const nsACString& aExtension,
30 nsresult* aRv,
31 HandlerInfo* aHandlerInfoData,
32 bool* aFound) override;
34 mozilla::ipc::IPCResult RecvExists(const HandlerInfo& aHandlerInfo,
35 bool* exists) override;
37 mozilla::ipc::IPCResult RecvGetTypeFromExtension(
38 const nsACString& aFileExtension, nsCString* type) override;
40 mozilla::ipc::IPCResult RecvExistsForProtocolOS(
41 const nsACString& aProtocolScheme, bool* aHandlerExists) override;
43 mozilla::ipc::IPCResult RecvExistsForProtocol(
44 const nsACString& aProtocolScheme, bool* aHandlerExists) override;
46 mozilla::ipc::IPCResult RecvGetApplicationDescription(
47 const nsACString& aScheme, nsresult* aRv,
48 nsString* aDescription) override;
51 * Limit the length of MIME types, filename extensions, and protocol
52 * schemes we'll consider.
54 static const size_t MAX_MIMETYPE_LENGTH = 129; /* Per RFC 6838, type and
55 subtype should be limited
56 to 64 characters. We add
57 one more to account for
58 a '/' separator. */
59 static const size_t MAX_EXT_LENGTH = 64; /* Arbitratily chosen to be
60 longer than any known
61 extension */
62 static const size_t MAX_SCHEME_LENGTH = 1024; /* Arbitratily chosen to be
63 longer than any known
64 protocol scheme */
67 #endif