Wed, 31 Dec 2014 07:53:36 +0100
Correct small whitespace inconsistency, lost while renaming variables.
michael@0 | 1 | /* -*- Mode: c++; c-basic-offset: 2; tab-width: 20; indent-tabs-mode: nil; -*- |
michael@0 | 2 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsAndroidHandlerApp.h" |
michael@0 | 7 | #include "AndroidBridge.h" |
michael@0 | 8 | |
michael@0 | 9 | using namespace mozilla::widget::android; |
michael@0 | 10 | |
michael@0 | 11 | |
michael@0 | 12 | NS_IMPL_ISUPPORTS(nsAndroidHandlerApp, nsIHandlerApp, nsISharingHandlerApp) |
michael@0 | 13 | |
michael@0 | 14 | nsAndroidHandlerApp::nsAndroidHandlerApp(const nsAString& aName, |
michael@0 | 15 | const nsAString& aDescription, |
michael@0 | 16 | const nsAString& aPackageName, |
michael@0 | 17 | const nsAString& aClassName, |
michael@0 | 18 | const nsACString& aMimeType, |
michael@0 | 19 | const nsAString& aAction) : |
michael@0 | 20 | mName(aName), mDescription(aDescription), mPackageName(aPackageName), |
michael@0 | 21 | mClassName(aClassName), mMimeType(aMimeType), mAction(aAction) |
michael@0 | 22 | { |
michael@0 | 23 | } |
michael@0 | 24 | |
michael@0 | 25 | nsAndroidHandlerApp::~nsAndroidHandlerApp() |
michael@0 | 26 | { |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | NS_IMETHODIMP |
michael@0 | 30 | nsAndroidHandlerApp::GetName(nsAString & aName) |
michael@0 | 31 | { |
michael@0 | 32 | aName.Assign(mName); |
michael@0 | 33 | return NS_OK; |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | NS_IMETHODIMP |
michael@0 | 37 | nsAndroidHandlerApp::SetName(const nsAString & aName) |
michael@0 | 38 | { |
michael@0 | 39 | mName.Assign(aName); |
michael@0 | 40 | return NS_OK; |
michael@0 | 41 | } |
michael@0 | 42 | |
michael@0 | 43 | NS_IMETHODIMP |
michael@0 | 44 | nsAndroidHandlerApp::GetDetailedDescription(nsAString & aDescription) |
michael@0 | 45 | { |
michael@0 | 46 | aDescription.Assign(mDescription); |
michael@0 | 47 | return NS_OK; |
michael@0 | 48 | } |
michael@0 | 49 | |
michael@0 | 50 | NS_IMETHODIMP |
michael@0 | 51 | nsAndroidHandlerApp::SetDetailedDescription(const nsAString & aDescription) |
michael@0 | 52 | { |
michael@0 | 53 | mDescription.Assign(aDescription); |
michael@0 | 54 | |
michael@0 | 55 | return NS_OK; |
michael@0 | 56 | } |
michael@0 | 57 | |
michael@0 | 58 | NS_IMETHODIMP |
michael@0 | 59 | nsAndroidHandlerApp::Equals(nsIHandlerApp *aHandlerApp, bool *aRetval) |
michael@0 | 60 | { |
michael@0 | 61 | nsCOMPtr<nsAndroidHandlerApp> aApp = do_QueryInterface(aHandlerApp); |
michael@0 | 62 | *aRetval = aApp && aApp->mName.Equals(mName) && |
michael@0 | 63 | aApp->mDescription.Equals(mDescription); |
michael@0 | 64 | return NS_OK; |
michael@0 | 65 | } |
michael@0 | 66 | |
michael@0 | 67 | NS_IMETHODIMP |
michael@0 | 68 | nsAndroidHandlerApp::LaunchWithURI(nsIURI *aURI, nsIInterfaceRequestor *aWindowContext) |
michael@0 | 69 | { |
michael@0 | 70 | nsCString uriSpec; |
michael@0 | 71 | aURI->GetSpec(uriSpec); |
michael@0 | 72 | return mozilla::widget::android::GeckoAppShell::OpenUriExternal |
michael@0 | 73 | (NS_ConvertUTF8toUTF16(uriSpec), NS_ConvertUTF8toUTF16(mMimeType), mPackageName, mClassName, mAction) ? |
michael@0 | 74 | NS_OK : NS_ERROR_FAILURE; |
michael@0 | 75 | } |
michael@0 | 76 | |
michael@0 | 77 | NS_IMETHODIMP |
michael@0 | 78 | nsAndroidHandlerApp::Share(const nsAString & data, const nsAString & title) |
michael@0 | 79 | { |
michael@0 | 80 | return mozilla::widget::android::GeckoAppShell::OpenUriExternal(data, NS_ConvertUTF8toUTF16(mMimeType), |
michael@0 | 81 | mPackageName, mClassName, mAction) ? NS_OK : NS_ERROR_FAILURE; |
michael@0 | 82 | } |
michael@0 | 83 |