Bug 1396601 - Removed all instances of MOZ_ENABLE_CONTENTACTION from .cpp files and moz.build file. r=paolo

MozReview-Commit-ID: 467SgoTlsFJ

--HG--
extra : rebase_source : dadd8c2a2cad6f96605390d7aac2512714bf58c1
This commit is contained in:
Swapnil 2018-01-08 23:48:56 +05:30
parent f9aeb462d4
commit f42233b3e8
5 changed files with 0 additions and 149 deletions

View File

@ -105,11 +105,6 @@ if CONFIG['MOZ_ENABLE_DBUS']:
'DBusHelpers.h',
]
if CONFIG['MOZ_ENABLE_CONTENTACTION']:
UNIFIED_SOURCES += [
'nsContentHandlerApp.cpp',
]
EXTRA_COMPONENTS += [
'nsHandlerService-json.js',
'nsHandlerService-json.manifest',

View File

@ -1,79 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim:expandtab:shiftwidth=2:tabstop=2:cin:
* 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 "nsContentHandlerApp.h"
#include "nsIURI.h"
#include "nsIClassInfoImpl.h"
#include "nsCOMPtr.h"
#include "nsString.h"
#define NS_CONTENTHANDLER_CID \
{ 0x43ec2c82, 0xb9db, 0x4835, {0x80, 0x3f, 0x64, 0xc9, 0x72, 0x5a, 0x70, 0x28 } }
NS_IMPL_CLASSINFO(nsContentHandlerApp, nullptr, 0, NS_CONTENTHANDLER_CID)
NS_IMPL_ISUPPORTS_CI(nsContentHandlerApp, nsIHandlerApp)
nsContentHandlerApp::nsContentHandlerApp(nsString aName, nsCString aType,
ContentAction::Action& aAction) :
mName(aName),
mType(aType),
mAction(aAction)
{
}
////////////////////////////////////////////////////////////////////////////////
//// nsIHandlerInfo
NS_IMETHODIMP nsContentHandlerApp::GetName(nsAString& aName)
{
aName.Assign(mName);
return NS_OK;
}
NS_IMETHODIMP nsContentHandlerApp::SetName(const nsAString& aName)
{
mName.Assign(aName);
return NS_OK;
}
NS_IMETHODIMP nsContentHandlerApp::Equals(nsIHandlerApp *aHandlerApp, bool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsContentHandlerApp::GetDetailedDescription(nsAString& aDetailedDescription)
{
aDetailedDescription.Assign(mDetailedDescription);
return NS_OK;
}
NS_IMETHODIMP nsContentHandlerApp::SetDetailedDescription(const nsAString& aDetailedDescription)
{
mDetailedDescription.Assign(aDetailedDescription);
return NS_OK;
}
NS_IMETHODIMP
nsContentHandlerApp::LaunchWithURI(nsIURI *aURI,
nsIInterfaceRequestor *aWindowContext)
{
nsAutoCString spec;
nsresult rv = aURI->GetAsciiSpec(spec);
NS_ENSURE_SUCCESS(rv,rv);
const char* url = spec.get();
QList<ContentAction::Action> actions =
ContentAction::Action::actionsForFile(QUrl(url), QString(mType.get()));
for (int i = 0; i < actions.size(); ++i) {
if (actions[i].name() == QString((QChar*)mName.get(), mName.Length())) {
actions[i].trigger();
break;
}
}
return NS_OK;
}

View File

@ -49,15 +49,6 @@ nsMIMEInfoUnix::GetHasDefaultHandler(bool *_retval)
if (*_retval)
return NS_OK;
#if defined(MOZ_ENABLE_CONTENTACTION)
ContentAction::Action action =
ContentAction::Action::defaultActionForFile(QUrl(), QString(mSchemeOrType.get()));
if (action.isValid()) {
*_retval = true;
return NS_OK;
}
#endif
return NS_OK;
}
@ -73,17 +64,6 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(nsIFile *aFile)
nsAutoCString nativePath;
aFile->GetNativePath(nativePath);
#if defined(MOZ_ENABLE_CONTENTACTION)
QUrl uri = QUrl::fromLocalFile(QString::fromUtf8(nativePath.get()));
ContentAction::Action action =
ContentAction::Action::defaultActionForFile(uri, QString(mSchemeOrType.get()));
if (action.isValid()) {
action.trigger();
return NS_OK;
}
return NS_ERROR_FAILURE;
#endif
nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
if (!giovfs) {
return NS_ERROR_FAILURE;
@ -107,30 +87,3 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(nsIFile *aFile)
return app->Launch(uriSpec);
}
#if defined(MOZ_ENABLE_CONTENTACTION)
NS_IMETHODIMP
nsMIMEInfoUnix::GetPossibleApplicationHandlers(nsIMutableArray ** aPossibleAppHandlers)
{
if (!mPossibleApplications) {
mPossibleApplications = do_CreateInstance(NS_ARRAY_CONTRACTID);
if (!mPossibleApplications)
return NS_ERROR_OUT_OF_MEMORY;
QList<ContentAction::Action> actions =
ContentAction::Action::actionsForFile(QUrl(), QString(mSchemeOrType.get()));
for (int i = 0; i < actions.size(); ++i) {
nsContentHandlerApp* app =
new nsContentHandlerApp(nsString((char16_t*)actions[i].name().data()),
mSchemeOrType, actions[i]);
mPossibleApplications->AppendElement(app);
}
}
*aPossibleAppHandlers = mPossibleApplications;
NS_ADDREF(*aPossibleAppHandlers);
return NS_OK;
}
#endif

View File

@ -24,9 +24,6 @@ protected:
virtual nsresult LoadUriInternal(nsIURI *aURI);
virtual nsresult LaunchDefaultWithFile(nsIFile *aFile);
#if defined(MOZ_ENABLE_CONTENTACTION)
NS_IMETHOD GetPossibleApplicationHandlers(nsIMutableArray * *aPossibleAppHandlers);
#endif
};
#endif // nsMIMEInfoUnix_h_

View File

@ -67,10 +67,6 @@ static nsresult MacErrorMapper(OSErr inErr);
#include <linux/magic.h>
#endif
#ifdef MOZ_ENABLE_CONTENTACTION
#include <contentaction/contentaction.h>
#endif
#include "nsNativeCharsetUtils.h"
#include "nsTraceRefcnt.h"
#include "nsHashKeys.h"
@ -1992,17 +1988,6 @@ nsLocalFile::Launch()
}
return giovfs->ShowURIForInput(mPath);
#elif defined(MOZ_ENABLE_CONTENTACTION)
QUrl uri = QUrl::fromLocalFile(QString::fromUtf8(mPath.get()));
ContentAction::Action action =
ContentAction::Action::defaultActionForFile(uri);
if (action.isValid()) {
action.trigger();
return NS_OK;
}
return NS_ERROR_FAILURE;
#elif defined(MOZ_WIDGET_ANDROID)
// Try to get a mimetype, if this fails just use the file uri alone
nsresult rv;