2005-04-04 23:08:55 +04:00
|
|
|
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2004-04-08 18:01:17 +04:00
|
|
|
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
|
|
|
*/
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
2000-10-20 09:09:06 +04:00
|
|
|
|
2005-04-04 23:08:55 +04:00
|
|
|
#ifndef nsRemoteClient_h__
|
|
|
|
#define nsRemoteClient_h__
|
2000-10-20 09:09:06 +04:00
|
|
|
|
2005-04-04 23:08:55 +04:00
|
|
|
#include "nscore.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pure-virtual common base class for remoting implementations.
|
|
|
|
*/
|
|
|
|
|
|
|
|
class nsRemoteClient
|
2000-10-20 09:09:06 +04:00
|
|
|
{
|
2005-04-04 23:08:55 +04:00
|
|
|
public:
|
2000-10-20 09:09:06 +04:00
|
|
|
/**
|
|
|
|
* Initializes the client
|
|
|
|
*/
|
2005-04-04 23:08:55 +04:00
|
|
|
virtual nsresult Init() = 0;
|
2000-10-20 09:09:06 +04:00
|
|
|
|
|
|
|
/**
|
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 02:19:52 +04:00
|
|
|
* Send a complete command line to a running instance.
|
2004-04-08 18:01:17 +04:00
|
|
|
*
|
|
|
|
* @param aProgram This is the preferred program that we want to use
|
|
|
|
* for this particular command.
|
|
|
|
*
|
|
|
|
* @param aUsername This allows someone to only talk to an instance
|
|
|
|
* of the server that's running under a particular username. If
|
|
|
|
* this isn't specified here it's pulled from the LOGNAME
|
|
|
|
* environmental variable if it's set.
|
2005-04-04 23:08:55 +04:00
|
|
|
*
|
2004-04-08 18:01:17 +04:00
|
|
|
* @param aProfile This allows you to specify a particular server
|
|
|
|
* running under a named profile. If it is not specified the
|
|
|
|
* profile is not checked.
|
2005-04-04 23:08:55 +04:00
|
|
|
*
|
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 02:19:52 +04:00
|
|
|
* @param argc The number of command-line arguments.
|
|
|
|
*
|
|
|
|
* @param argv The command-line arguments.
|
|
|
|
*
|
2007-02-09 04:33:26 +03:00
|
|
|
* @param aDesktopStartupID the contents of the DESKTOP_STARTUP_ID environment
|
|
|
|
* variable defined by the Startup Notification specification
|
|
|
|
* http://standards.freedesktop.org/startup-notification-spec/startup-notification-0.1.txt
|
2004-04-08 18:01:17 +04:00
|
|
|
*
|
|
|
|
* @param aResponse If there is a response, it will be here. This
|
|
|
|
* includes error messages. The string is allocated using stdlib
|
|
|
|
* string functions, so free it with free().
|
2005-04-04 23:08:55 +04:00
|
|
|
*
|
2006-08-29 00:17:01 +04:00
|
|
|
* @return true if succeeded, false if no running instance was found.
|
2005-04-04 23:08:55 +04:00
|
|
|
*
|
2000-10-20 09:09:06 +04:00
|
|
|
*/
|
2005-04-04 23:08:55 +04:00
|
|
|
virtual nsresult SendCommandLine(const char *aProgram, const char *aUsername,
|
|
|
|
const char *aProfile,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t argc, char **argv,
|
2007-02-09 04:33:26 +03:00
|
|
|
const char* aDesktopStartupID,
|
2011-09-29 10:19:26 +04:00
|
|
|
char **aResponse, bool *aSucceeded) = 0;
|
2000-10-20 09:09:06 +04:00
|
|
|
};
|
2005-04-04 23:08:55 +04:00
|
|
|
|
|
|
|
#endif // nsRemoteClient_h__
|