diff -r 000000000000 -r 6474c204b198 uriloader/exthandler/unix/nsMeegoExternalSharingAppService.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uriloader/exthandler/unix/nsMeegoExternalSharingAppService.cpp Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,51 @@ +/* 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/. */ + +#include "shareuiinterface.h" +#include +#include "nsExternalSharingAppService.h" +#include "nsString.h" + +NS_IMPL_ISUPPORTS(nsExternalSharingAppService, nsIExternalSharingAppService) + +nsExternalSharingAppService::nsExternalSharingAppService() + : mShareUi(nullptr) +{ +} + +nsExternalSharingAppService::~nsExternalSharingAppService() +{ +} + +NS_IMETHODIMP +nsExternalSharingAppService::ShareWithDefault(const nsAString & aData, + const nsAString & aMime, + const nsAString & aTitle) +{ + if (!mShareUi) + mShareUi = new ShareUiInterface(); + + if (!mShareUi || !mShareUi->isValid()) + return NS_ERROR_NOT_AVAILABLE; + + if (aData.IsEmpty()) + return NS_ERROR_INVALID_ARG; + + MDataUri uri; + uri.setTextData(QString::fromUtf16(aData.BeginReading(), aData.Length())); + uri.setMimeType(QString::fromUtf16(aMime.BeginReading(), aMime.Length())); + uri.setAttribute("title", QString::fromUtf16(aTitle.BeginReading(), 0)); + + mShareUi->share(QStringList(uri.toString())); + + return NS_OK; +} + +NS_IMETHODIMP +nsExternalSharingAppService::GetSharingApps(const nsAString & aMIMEType, + uint32_t *aLen, + nsISharingHandlerApp ***aHandlers) +{ + return NS_ERROR_NOT_IMPLEMENTED; +}