uriloader/exthandler/android/nsExternalSharingAppService.cpp

Wed, 31 Dec 2014 07:53:36 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:53:36 +0100
branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
permissions
-rw-r--r--

Correct small whitespace inconsistency, lost while renaming variables.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 #include "nsExternalSharingAppService.h"
michael@0 6
michael@0 7 #include "mozilla/ModuleUtils.h"
michael@0 8 #include "nsIClassInfoImpl.h"
michael@0 9
michael@0 10 #include "AndroidBridge.h"
michael@0 11 #include "nsArrayUtils.h"
michael@0 12 #include "nsISupportsUtils.h"
michael@0 13 #include "nsComponentManagerUtils.h"
michael@0 14
michael@0 15 using namespace mozilla;
michael@0 16
michael@0 17 NS_IMPL_ISUPPORTS(nsExternalSharingAppService, nsIExternalSharingAppService)
michael@0 18
michael@0 19 nsExternalSharingAppService::nsExternalSharingAppService()
michael@0 20 {
michael@0 21 }
michael@0 22
michael@0 23 nsExternalSharingAppService::~nsExternalSharingAppService()
michael@0 24 {
michael@0 25 }
michael@0 26
michael@0 27 NS_IMETHODIMP
michael@0 28 nsExternalSharingAppService::ShareWithDefault(const nsAString & data,
michael@0 29 const nsAString & mime,
michael@0 30 const nsAString & title)
michael@0 31 {
michael@0 32 NS_NAMED_LITERAL_STRING(sendAction, "android.intent.action.SEND");
michael@0 33 const nsString emptyString = EmptyString();
michael@0 34 return mozilla::widget::android::GeckoAppShell::OpenUriExternal(data,
michael@0 35 mime, emptyString,emptyString, sendAction, title) ? NS_OK : NS_ERROR_FAILURE;
michael@0 36 }
michael@0 37
michael@0 38 NS_IMETHODIMP
michael@0 39 nsExternalSharingAppService::GetSharingApps(const nsAString & aMIMEType,
michael@0 40 uint32_t *aLen,
michael@0 41 nsISharingHandlerApp ***aHandlers)
michael@0 42 {
michael@0 43 nsresult rv;
michael@0 44 NS_NAMED_LITERAL_STRING(sendAction, "android.intent.action.SEND");
michael@0 45 nsCOMPtr<nsIMutableArray> array = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
michael@0 46 NS_ENSURE_SUCCESS(rv, rv);
michael@0 47 if (!AndroidBridge::Bridge())
michael@0 48 return NS_OK;
michael@0 49 AndroidBridge::Bridge()->GetHandlersForMimeType(aMIMEType, array,
michael@0 50 nullptr, sendAction);
michael@0 51 array->GetLength(aLen);
michael@0 52 *aHandlers =
michael@0 53 static_cast<nsISharingHandlerApp**>(NS_Alloc(sizeof(nsISharingHandlerApp*)
michael@0 54 * *aLen));
michael@0 55 for (uint32_t i = 0; i < *aLen; i++) {
michael@0 56 rv = array->QueryElementAt(i, NS_GET_IID(nsISharingHandlerApp),
michael@0 57 (void**)(*aHandlers + i));
michael@0 58 NS_ENSURE_SUCCESS(rv, rv);
michael@0 59 }
michael@0 60 return NS_OK;
michael@0 61 }

mercurial