gecko/toolkit/components/remote/nsXRemoteService.h
Mike Hommey eeff387869 Bug 1080319 - Remove the -remote option. r=bsmedberg
The -remote option has existed essentially forever, but its usefulness is
questionable:
- It requires a running instance to be any useful, so any script actually
  using it should first do -remote 'ping()' and handle the response properly.
- It is not cross-application. The remote service dispatches the -remote
  commands to the command line handler, and, for example, desktop b2g builds
  don't have handlers for -remote (although thunderbird and seamonkey do).
- It is not a cross-platform option, which leads to the following point:
- There are other command line ways to do the same thing (at least in
  Firefox), without having to jump through hoops with -remote 'ping()',
  because there are command line options to do those same things on non-X11
  platforms.

For the latter, in Firefox case:
- -remote 'openURL(url)' can be replaced with firefox url
- -remote 'openURL(url,new-tab)' can be replaced with firefox -new-tab url
- -remote 'openURL(url,new-window)' can be replaced with firefox -new-window
  url
- -remote 'openfile(file,...)' is the same as -remote 'openurl(file,...) so,
  can be replaced as above
- -remote 'xfedocommand(openbrowser)' is inherited from the mozilla suite and
   doesn't make much sense, but can be replaced with firefox -new-window

The interesting part is that without changing nsBrowserContentHandler.js,
-remote still works, meaning that if people really feel strongly about
-remote, they'll still be able to write an addon to bring it back. This also
means this patch actually doesn't remove -remote for applications other than
Firefox that do support it, although -remote 'ping()' doesn't work as
expected. However, other -remote commands will now work even without a
running instance.
2014-10-14 07:19:52 +09:00

63 lines
1.8 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=8:
*/
/* 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 NSXREMOTESERVICE_H
#define NSXREMOTESERVICE_H
#include "nsString.h"
#include "nsIRemoteService.h"
#include "nsIObserver.h"
#include <X11/Xlib.h>
#include <X11/X.h>
class nsIDOMWindow;
class nsIWeakReference;
/**
Base class for GTK/Qt remote service
*/
class nsXRemoteService : public nsIRemoteService,
public nsIObserver
{
public:
NS_DECL_NSIOBSERVER
protected:
nsXRemoteService();
static bool HandleNewProperty(Window aWindowId,Display* aDisplay,
Time aEventTime, Atom aChangedAtom,
nsIWeakReference* aDomWindow);
void XRemoteBaseStartup(const char *aAppName, const char *aProfileName);
void HandleCommandsFor(Window aWindowId);
static nsXRemoteService *sRemoteImplementation;
private:
void EnsureAtoms();
static const char* HandleCommandLine(char* aBuffer, nsIDOMWindow* aWindow,
uint32_t aTimestamp);
virtual void SetDesktopStartupIDOrTimestamp(const nsACString& aDesktopStartupID,
uint32_t aTimestamp) = 0;
nsCString mAppName;
nsCString mProfileName;
static Atom sMozVersionAtom;
static Atom sMozLockAtom;
static Atom sMozResponseAtom;
static Atom sMozUserAtom;
static Atom sMozProfileAtom;
static Atom sMozProgramAtom;
static Atom sMozCommandLineAtom;
};
#endif // NSXREMOTESERVICE_H