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"
15 class HandlerServiceParent final
: public mozilla::dom::PHandlerServiceParent
{
17 HandlerServiceParent();
18 NS_INLINE_DECL_REFCOUNTING(HandlerServiceParent
, final
)
21 virtual ~HandlerServiceParent();
22 void ActorDestroy(ActorDestroyReason aWhy
) override
;
24 mozilla::ipc::IPCResult
RecvFillHandlerInfo(
25 const HandlerInfo
& aHandlerInfoData
, const nsCString
& aOverrideType
,
26 HandlerInfo
* handlerInfoData
) override
;
28 mozilla::ipc::IPCResult
RecvGetMIMEInfoFromOS(const nsCString
& aMIMEType
,
29 const nsCString
& aExtension
,
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 nsCString
& aFileExtension
, nsCString
* type
) override
;
40 mozilla::ipc::IPCResult
RecvExistsForProtocolOS(
41 const nsCString
& aProtocolScheme
, bool* aHandlerExists
) override
;
43 mozilla::ipc::IPCResult
RecvExistsForProtocol(
44 const nsCString
& aProtocolScheme
, bool* aHandlerExists
) override
;
46 mozilla::ipc::IPCResult
RecvGetApplicationDescription(
47 const nsCString
& aScheme
, nsresult
* aRv
, nsString
* aDescription
) override
;
50 * Limit the length of MIME types, filename extensions, and protocol
51 * schemes we'll consider.
53 static const size_t MAX_MIMETYPE_LENGTH
= 129; /* Per RFC 6838, type and
54 subtype should be limited
55 to 64 characters. We add
56 one more to account for
58 static const size_t MAX_EXT_LENGTH
= 64; /* Arbitratily chosen to be
61 static const size_t MAX_SCHEME_LENGTH
= 1024; /* Arbitratily chosen to be