1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:cin:
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 #include "nsContentHandlerApp.h"
9 #include "nsIClassInfoImpl.h"
13 #define NS_CONTENTHANDLER_CID \
14 { 0x43ec2c82, 0xb9db, 0x4835, {0x80, 0x3f, 0x64, 0xc9, 0x72, 0x5a, 0x70, 0x28 } }
16 NS_IMPL_CLASSINFO(nsContentHandlerApp
, nullptr, 0, NS_CONTENTHANDLER_CID
)
17 NS_IMPL_ISUPPORTS_CI(nsContentHandlerApp
, nsIHandlerApp
)
19 nsContentHandlerApp::nsContentHandlerApp(nsString aName
, nsCString aType
,
20 ContentAction::Action
& aAction
) :
27 ////////////////////////////////////////////////////////////////////////////////
30 NS_IMETHODIMP
nsContentHandlerApp::GetName(nsAString
& aName
)
36 NS_IMETHODIMP
nsContentHandlerApp::SetName(const nsAString
& aName
)
42 NS_IMETHODIMP
nsContentHandlerApp::Equals(nsIHandlerApp
*aHandlerApp
, bool *_retval
)
44 return NS_ERROR_NOT_IMPLEMENTED
;
47 NS_IMETHODIMP
nsContentHandlerApp::GetDetailedDescription(nsAString
& aDetailedDescription
)
49 aDetailedDescription
.Assign(mDetailedDescription
);
53 NS_IMETHODIMP
nsContentHandlerApp::SetDetailedDescription(const nsAString
& aDetailedDescription
)
55 mDetailedDescription
.Assign(aDetailedDescription
);
60 nsContentHandlerApp::LaunchWithURI(nsIURI
*aURI
,
61 nsIInterfaceRequestor
*aWindowContext
)
64 nsresult rv
= aURI
->GetAsciiSpec(spec
);
65 NS_ENSURE_SUCCESS(rv
,rv
);
66 const char* url
= spec
.get();
68 QList
<ContentAction::Action
> actions
=
69 ContentAction::Action::actionsForFile(QUrl(url
), QString(mType
.get()));
70 for (int i
= 0; i
< actions
.size(); ++i
) {
71 if (actions
[i
].name() == QString((QChar
*)mName
.get(), mName
.Length())) {