gecko-dev/uriloader/exthandler/nsOSHelperAppServiceChild.h
Haik Aftandilian 77b79862cf Bug 1452278 - Part 1 - Make macOS nsOSHelperAppService::GetFromTypeAndExtension() not call OS MIME API's in content r=bzbarsky,froydnj
Add a new nsExternalHelperAppService derived class named nsOSHelperAppServiceChild to be used for the MIME service, external helper app service, and external protocol service interfaces in child processes. nsOSHelperAppServiceChild overrides some methods used to get MIME and external protocol handler information from the OS and implements these methods by remoting the calls to the parent process.

This is necessary because, on Mac, querying the OS for helper application info from sandboxed content processes is unreliable and has buggy side effects.

For now, only use the new class on Mac.

Android and unix file changes r+ by gcp.
Windows files changes r+ by bobowen.
Sync messages review r+ by nfroyd.

MozReview-Commit-ID: 63BiS6VCxfn

Differential Revision: https://phabricator.services.mozilla.com/D15620

--HG--
extra : moz-landing-system : lando
2019-03-27 22:49:33 +00:00

47 lines
1.8 KiB
C++

/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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/. */
#ifndef nsOSHelperAppServiceChild_h__
#define nsOSHelperAppServiceChild_h__
#include "nsExternalHelperAppService.h"
class nsIMIMEInfo;
/*
* Provides a generic implementation of the nsExternalHelperAppService
* platform-specific methods by remoting calls to the parent process.
* Only provides implementations for the methods needed in unprivileged
* child processes.
*/
class nsOSHelperAppServiceChild : public nsExternalHelperAppService {
public:
nsOSHelperAppServiceChild() : nsExternalHelperAppService(){};
virtual ~nsOSHelperAppServiceChild() = default;
NS_IMETHOD GetProtocolHandlerInfoFromOS(const nsACString& aScheme,
bool* found,
nsIHandlerInfo** _retval) override;
nsresult GetFileTokenForPath(const char16_t* platformAppPath,
nsIFile** aFile) override;
NS_IMETHOD ExternalProtocolHandlerExists(const char* aProtocolScheme,
bool* aHandlerExists) override;
NS_IMETHOD OSProtocolHandlerExists(const char* aScheme,
bool* aExists) override;
NS_IMETHOD GetApplicationDescription(const nsACString& aScheme,
nsAString& aRetVal) override;
NS_IMETHOD GetMIMEInfoFromOS(const nsACString& aMIMEType,
const nsACString& aFileExt, bool* aFound,
nsIMIMEInfo** aMIMEInfo) override;
};
#endif // nsOSHelperAppServiceChild_h__