Bug 1134537 - Delete nsGnomeVFSService. r=nfroyd
authorAlex Henrie <alexhenrie24@gmail.com>
Sat, 21 Feb 2015 14:49:13 -0700
changeset 249834 826578768e85f970ed276ec7414a6313747c64f1
parent 249833 974ca22a87c646cbc94e915a4536630bbd9d0f4c
child 249835 232e9f16ee88fb675ee4b5f26b2ba8faf1550f8f
push id7860
push userjlund@mozilla.com
push dateMon, 30 Mar 2015 18:46:02 +0000
treeherdermozilla-aurora@8ac636cd51f3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnfroyd
bugs1134537
milestone39.0a1
Bug 1134537 - Delete nsGnomeVFSService. r=nfroyd
toolkit/system/gnome/moz.build
toolkit/system/gnome/nsGnomeModule.cpp
toolkit/system/gnome/nsGnomeVFSService.cpp
toolkit/system/gnome/nsGnomeVFSService.h
xpcom/system/moz.build
xpcom/system/nsIGnomeVFSService.idl
--- a/toolkit/system/gnome/moz.build
+++ b/toolkit/system/gnome/moz.build
@@ -10,42 +10,35 @@ SOURCES += [
     'nsSystemAlertsService.cpp',
 ]
 
 if CONFIG['MOZ_ENABLE_GCONF']:
     SOURCES += [
         'nsGConfService.cpp',
     ]
 
-if CONFIG['MOZ_ENABLE_GNOMEVFS']:
-    SOURCES += [
-        'nsGnomeVFSService.cpp',
-    ]
-
 if CONFIG['MOZ_ENABLE_GIO']:
     SOURCES += [
         'nsGIOService.cpp',
         'nsGSettingsService.cpp',
         'nsPackageKitService.cpp'
     ]
 
 XPCOMBinaryComponent('mozgnome')
 
 FAIL_ON_WARNINGS = True
 
 LOCAL_INCLUDES += [
     '/toolkit/components/build/',
 ]
 
 CXXFLAGS += CONFIG['MOZ_GCONF_CFLAGS']
-CXXFLAGS += CONFIG['MOZ_GNOMEVFS_CFLAGS']
 CXXFLAGS += CONFIG['MOZ_GIO_CFLAGS']
 CXXFLAGS += CONFIG['GLIB_CFLAGS']
 CXXFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']
 
 if CONFIG['MOZ_ENABLE_GTK']:
     CXXFLAGS += CONFIG['TK_CFLAGS']
 
 OS_LIBS += CONFIG['MOZ_GCONF_LIBS']
-OS_LIBS += CONFIG['MOZ_GNOMEVFS_LIBS']
 OS_LIBS += CONFIG['GLIB_LIBS']
 OS_LIBS += CONFIG['MOZ_GIO_LIBS']
 OS_LIBS += CONFIG['MOZ_DBUS_GLIB_LIBS']
--- a/toolkit/system/gnome/nsGnomeModule.cpp
+++ b/toolkit/system/gnome/nsGnomeModule.cpp
@@ -7,67 +7,54 @@
 #include "mozilla/ModuleUtils.h"
 
 #include <glib-object.h>
 
 #ifdef MOZ_ENABLE_GCONF
 #include "nsGConfService.h"
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGConfService, Init)
 #endif
-#ifdef MOZ_ENABLE_GNOMEVFS
-#include "nsGnomeVFSService.h"
-NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGnomeVFSService, Init)
-#endif
 #ifdef MOZ_ENABLE_GIO
 #include "nsGIOService.h"
 #include "nsGSettingsService.h"
 #include "nsPackageKitService.h"
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsGIOService)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGSettingsService, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPackageKitService, Init)
 #endif
 #include "nsSystemAlertsService.h"
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSystemAlertsService, Init)
 
 #ifdef MOZ_ENABLE_GCONF
 NS_DEFINE_NAMED_CID(NS_GCONFSERVICE_CID);
 #endif
-#ifdef MOZ_ENABLE_GNOMEVFS
-NS_DEFINE_NAMED_CID(NS_GNOMEVFSSERVICE_CID);
-#endif
 #ifdef MOZ_ENABLE_GIO
 NS_DEFINE_NAMED_CID(NS_GIOSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_GSETTINGSSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_PACKAGEKITSERVICE_CID);
 #endif
 NS_DEFINE_NAMED_CID(NS_SYSTEMALERTSSERVICE_CID);
 
 static const mozilla::Module::CIDEntry kGnomeCIDs[] = {
 #ifdef MOZ_ENABLE_GCONF
   { &kNS_GCONFSERVICE_CID, false, nullptr, nsGConfServiceConstructor },
 #endif
-#ifdef MOZ_ENABLE_GNOMEVFS
-  { &kNS_GNOMEVFSSERVICE_CID, false, nullptr, nsGnomeVFSServiceConstructor },
-#endif
 #ifdef MOZ_ENABLE_GIO
   { &kNS_GIOSERVICE_CID, false, nullptr, nsGIOServiceConstructor },
   { &kNS_GSETTINGSSERVICE_CID, false, nullptr, nsGSettingsServiceConstructor },
   { &kNS_PACKAGEKITSERVICE_CID, false, nullptr, nsPackageKitServiceConstructor },
 #endif
   { &kNS_SYSTEMALERTSSERVICE_CID, false, nullptr, nsSystemAlertsServiceConstructor },
   { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kGnomeContracts[] = {
 #ifdef MOZ_ENABLE_GCONF
   { NS_GCONFSERVICE_CONTRACTID, &kNS_GCONFSERVICE_CID },
 #endif
-#ifdef MOZ_ENABLE_GNOMEVFS
-  { NS_GNOMEVFSSERVICE_CONTRACTID, &kNS_GNOMEVFSSERVICE_CID },
-#endif
 #ifdef MOZ_ENABLE_GIO
   { NS_GIOSERVICE_CONTRACTID, &kNS_GIOSERVICE_CID },
   { NS_GSETTINGSSERVICE_CONTRACTID, &kNS_GSETTINGSSERVICE_CID },
   { NS_PACKAGEKITSERVICE_CONTRACTID, &kNS_PACKAGEKITSERVICE_CID },
 #endif
   { NS_SYSTEMALERTSERVICE_CONTRACTID, &kNS_SYSTEMALERTSSERVICE_CID },
   { nullptr }
 };
deleted file mode 100644
--- a/toolkit/system/gnome/nsGnomeVFSService.cpp
+++ /dev/null
@@ -1,224 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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 "nsGnomeVFSService.h"
-#include "nsStringAPI.h"
-#include "nsIURI.h"
-#include "nsTArray.h"
-#include "nsIStringEnumerator.h"
-#include "nsAutoPtr.h"
-
-extern "C" {
-#include <libgnomevfs/gnome-vfs.h>
-#include <libgnomevfs/gnome-vfs-mime.h>
-#include <libgnomevfs/gnome-vfs-mime-handlers.h>
-}
-
-class nsGnomeVFSMimeApp MOZ_FINAL : public nsIGnomeVFSMimeApp
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIGNOMEVFSMIMEAPP
-
-  nsGnomeVFSMimeApp(GnomeVFSMimeApplication* aApp) : mApp(aApp) {}
-  ~nsGnomeVFSMimeApp() { gnome_vfs_mime_application_free(mApp); }
-
-private:
-  GnomeVFSMimeApplication *mApp;
-};
-
-NS_IMPL_ISUPPORTS(nsGnomeVFSMimeApp, nsIGnomeVFSMimeApp)
-
-NS_IMETHODIMP
-nsGnomeVFSMimeApp::GetId(nsACString& aId)
-{
-  aId.Assign(mApp->id);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGnomeVFSMimeApp::GetName(nsACString& aName)
-{
-  aName.Assign(mApp->name);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGnomeVFSMimeApp::GetCommand(nsACString& aCommand)
-{
-  aCommand.Assign(mApp->command);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGnomeVFSMimeApp::GetCanOpenMultipleFiles(bool* aCanOpen)
-{
-  *aCanOpen = mApp->can_open_multiple_files;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGnomeVFSMimeApp::GetExpectsURIs(int32_t* aExpects)
-{
-  *aExpects = mApp->expects_uris;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGnomeVFSMimeApp::Launch(const nsACString &aUri)
-{
-  char *uri = gnome_vfs_make_uri_from_input(PromiseFlatCString(aUri).get());
-
-  if (! uri)
-    return NS_ERROR_FAILURE;
-
-  GList uris = { 0 };
-  uris.data = uri;
-
-  GnomeVFSResult result = gnome_vfs_mime_application_launch(mApp, &uris);
-  g_free(uri);
-
-  if (result != GNOME_VFS_OK)
-    return NS_ERROR_FAILURE;
-
-  return NS_OK;
-}
-
-class UTF8StringEnumerator MOZ_FINAL : public nsIUTF8StringEnumerator
-{
-public:
-  UTF8StringEnumerator() : mIndex(0) { }
-  ~UTF8StringEnumerator() { }
-
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIUTF8STRINGENUMERATOR
-
-  nsTArray<nsCString> mStrings;
-  uint32_t            mIndex;
-};
-
-NS_IMPL_ISUPPORTS(UTF8StringEnumerator, nsIUTF8StringEnumerator)
-
-NS_IMETHODIMP
-UTF8StringEnumerator::HasMore(bool *aResult)
-{
-  *aResult = mIndex < mStrings.Length();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-UTF8StringEnumerator::GetNext(nsACString& aResult)
-{
-  if (mIndex >= mStrings.Length())
-    return NS_ERROR_UNEXPECTED;
-
-  aResult.Assign(mStrings[mIndex]);
-  ++mIndex;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGnomeVFSMimeApp::GetSupportedURISchemes(nsIUTF8StringEnumerator** aSchemes)
-{
-  *aSchemes = nullptr;
-
-  nsRefPtr<UTF8StringEnumerator> array = new UTF8StringEnumerator();
-  NS_ENSURE_TRUE(array, NS_ERROR_OUT_OF_MEMORY);
-
-  for (GList *list = mApp->supported_uri_schemes; list; list = list->next) {
-    if (!array->mStrings.AppendElement((char*) list->data)) {
-      return NS_ERROR_OUT_OF_MEMORY;
-    }
-  }
-
-  NS_ADDREF(*aSchemes = array);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGnomeVFSMimeApp::GetRequiresTerminal(bool* aRequires)
-{
-  *aRequires = mApp->requires_terminal;
-  return NS_OK;
-}
-
-nsresult
-nsGnomeVFSService::Init()
-{
-  return gnome_vfs_init() ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMPL_ISUPPORTS(nsGnomeVFSService, nsIGnomeVFSService)
-
-NS_IMETHODIMP
-nsGnomeVFSService::GetMimeTypeFromExtension(const nsACString &aExtension,
-                                            nsACString& aMimeType)
-{
-  nsAutoCString fileExtToUse(".");
-  fileExtToUse.Append(aExtension);
-
-  const char *mimeType = gnome_vfs_mime_type_from_name(fileExtToUse.get());
-  aMimeType.Assign(mimeType);
-
-  // |mimeType| points to internal gnome-vfs data, so don't free it.
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGnomeVFSService::GetAppForMimeType(const nsACString &aMimeType,
-                                     nsIGnomeVFSMimeApp** aApp)
-{
-  *aApp = nullptr;
-  GnomeVFSMimeApplication *app =
-   gnome_vfs_mime_get_default_application(PromiseFlatCString(aMimeType).get());
-
-  if (app) {
-    nsGnomeVFSMimeApp *mozApp = new nsGnomeVFSMimeApp(app);
-    NS_ENSURE_TRUE(mozApp, NS_ERROR_OUT_OF_MEMORY);
-
-    NS_ADDREF(*aApp = mozApp);
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGnomeVFSService::GetDescriptionForMimeType(const nsACString &aMimeType,
-                                             nsACString& aDescription)
-{
-  const char *desc =
-    gnome_vfs_mime_get_description(PromiseFlatCString(aMimeType).get());
-  aDescription.Assign(desc);
-
-  // |desc| points to internal gnome-vfs data, so don't free it.
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGnomeVFSService::ShowURI(nsIURI *aURI)
-{
-  nsAutoCString spec;
-  aURI->GetSpec(spec);
-
-  if (gnome_vfs_url_show_with_env(spec.get(), nullptr) == GNOME_VFS_OK)
-    return NS_OK;
-
-  return NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-nsGnomeVFSService::ShowURIForInput(const nsACString &aUri)
-{
-  char* spec = gnome_vfs_make_uri_from_input(PromiseFlatCString(aUri).get());
-  nsresult rv = NS_ERROR_FAILURE;
-
-  if (gnome_vfs_url_show_with_env(spec, nullptr) == GNOME_VFS_OK)
-    rv = NS_OK;
-
-  g_free(spec);
-  return rv;
-}
deleted file mode 100644
--- a/toolkit/system/gnome/nsGnomeVFSService.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/. */
-
-#ifndef nsGnomeVFSService_h_
-#define nsGnomeVFSService_h_
-
-#include "nsIGnomeVFSService.h"
-#include "mozilla/Attributes.h"
-
-#define NS_GNOMEVFSSERVICE_CID \
-{0x5f43022c, 0x6194, 0x4b37, {0xb2, 0x6d, 0xe4, 0x10, 0x24, 0x62, 0x52, 0x64}}
-
-class nsGnomeVFSService MOZ_FINAL : public nsIGnomeVFSService
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIGNOMEVFSSERVICE
-
-  nsresult Init();
-};
-
-#endif
--- a/xpcom/system/moz.build
+++ b/xpcom/system/moz.build
@@ -5,17 +5,16 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 XPIDL_SOURCES += [
     'nsIBlocklistService.idl',
     'nsIDeviceSensors.idl',
     'nsIGConfService.idl',
     'nsIGeolocationProvider.idl',
     'nsIGIOService.idl',
-    'nsIGnomeVFSService.idl',
     'nsIGSettingsService.idl',
     'nsIHapticFeedback.idl',
     'nsIPackageKitService.idl',
     'nsIXULAppInfo.idl',
     'nsIXULRuntime.idl',
 ]
 
 if CONFIG['MOZ_CRASHREPORTER']:
deleted file mode 100644
--- a/xpcom/system/nsIGnomeVFSService.idl
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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 "nsISupports.idl"
-
-interface nsIUTF8StringEnumerator;
-interface nsIURI;
-
-/* nsIGnomeVFSMimeApp holds information about an application that is looked up
-   with nsIGnomeVFSService::GetAppForMimeType. */
-
-[scriptable, uuid(66009894-9877-405b-9321-bf30420e34e6)]
-interface nsIGnomeVFSMimeApp : nsISupports
-{
-  const long EXPECTS_URIS  = 0;
-  const long EXPECTS_PATHS = 1;
-  const long EXPECTS_URIS_FOR_NON_FILES = 2;
-
-  readonly attribute AUTF8String         id;
-  readonly attribute AUTF8String         name;
-  readonly attribute AUTF8String         command;
-  readonly attribute boolean             canOpenMultipleFiles;
-  readonly attribute long                expectsURIs;  // see constants above
-  readonly attribute nsIUTF8StringEnumerator supportedURISchemes;
-  readonly attribute boolean             requiresTerminal;
-
-  void launch(in AUTF8String uri);
-};
-
-/*
- * The VFS service makes use of a registry for information.
- *
- * The MIME registry holds information about MIME types, such as which
- * extensions map to a given MIME type.  The MIME registry also stores the
- * id of the application selected to handle each MIME type.
- */
-
-[scriptable, uuid(d1ac73a6-2ceb-4164-8142-215afe7fe8a6)]
-interface nsIGnomeVFSService : nsISupports
-{
-  /*** MIME registry methods ***/
-
-  /* Obtain the MIME type registered for an extension.  The extension
-     should not include a leading dot. */
-  AUTF8String        getMimeTypeFromExtension(in AUTF8String extension);
-
-  /* Obtain the preferred application for opening a given MIME type */
-  nsIGnomeVFSMimeApp getAppForMimeType(in AUTF8String mimeType);
-
-  /* Obtain a description for the given MIME type */
-  AUTF8String        getDescriptionForMimeType(in AUTF8String mimeType);
-
-  /*** Misc. methods ***/
-
-  /* Open the given URI in the default application */
-  void               showURI(in nsIURI uri);
-  [noscript] void    showURIForInput(in ACString uri);
-};
-
-%{C++
-#define NS_GNOMEVFSSERVICE_CONTRACTID "@mozilla.org/gnome-vfs-service;1"
-%}