nsINativeAppSupport.idl 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #include "nsISupports.idl"
  6. /* nsINativeAppSupport
  7. *
  8. * This "pseudo" (in the XPCOM sense) interface provides for
  9. * platform-specific general application support:
  10. * o It manages the details of the simple DDE communication
  11. * supported on the Win32 platform (it is the addition of this
  12. * item that prompted the creation of this interface.
  13. *
  14. * Due to the nature of the beast, this interface is not a full-blown
  15. * XPCOM component. The primary reason is that objects that implement
  16. * this interface generally must be operational *before* XPCOM (or any
  17. * of the rest of Mozilla) are initialized. As a result, this
  18. * interface is instantiated by somewhat unconventional means.
  19. *
  20. * To create the implementor of this interface, you call the function
  21. * NS_CreateNativeAppSupport. This is done in the startup code
  22. * in nsAppRunner.cpp
  23. *
  24. * The interface provides these functions:
  25. * start - You call this to inform the native app support that the
  26. * application is starting. In addition, it serves as a
  27. * query as to whether the application should continue to
  28. * run.
  29. *
  30. * If the returned boolean result is PR_FALSE, then the
  31. * application should exit without further processing. In
  32. * such cases, the returned nsresult indicates whether the
  33. * reason to exit is due to an error or not.
  34. *
  35. * Win32 Note: In the case of starting a second instance
  36. * of this executable, this function will return
  37. * PR_FALSE and nsresult==NS_OK. This means that
  38. * the command line arguments have been
  39. * successfully passed to the instance of the
  40. * application acting as a DDE server.
  41. *
  42. * stop - You call this to inform the native app support that the
  43. * application *wishes* to terminate. If the returned boolean
  44. * value is PR_FALSE, then the application should continue
  45. * (as if there were still additional top-level windows open).
  46. *
  47. * Win32 Note: If this is the instance of the application
  48. * acting as the DDE server, and there are current
  49. * DDE conversations active with other instances
  50. * acting as DDE clients, then this function will
  51. * return PR_FALSE.
  52. *
  53. * quit - Like Stop, but this method *forces* termination (or more
  54. * precisely, indicates that the application is about to be
  55. * terminated regardless of what a call to Stop might have
  56. * returned.
  57. *
  58. * This method is intended to be called when the user selects
  59. * the "Quit" option (close all windows and exit).
  60. *
  61. * Win32 Note: Stop is problematic in the case of "Quit" (close
  62. * all windows and exit the application) because
  63. * either we don't Quit or (potentially) we lose
  64. * requests coming from other instances of the
  65. * application. The strategy is to give preference
  66. * to the user's explicit Quit request. In the
  67. * unlikely event that a request is pending from
  68. * another instance of the application, then such
  69. * requests are essentially ignored. This is
  70. * roughly equivalent to handling that request by
  71. * opening a new window, followed by immediately
  72. * closing it. Since this is the same as if the
  73. * request came in immediately before the Quit
  74. * call (versus immediately after it), no harm.
  75. *
  76. * There is an exposure here: Upon return from this
  77. * function, any DDE connect request (for Mozilla)
  78. * will fail and other instances of the application
  79. * will start up as a DDE server. In that case,
  80. * those instances may do things that conflict with
  81. * the subsequent shutting down of the instance that
  82. * is quitting. For this reason, the call to Quit
  83. * should be deferred as long as possible.
  84. *
  85. * onLastWindowClosing - Called when the last window is closed. Used as a
  86. * "soft" shutdown, passwords are flushed.
  87. */
  88. interface nsIXULWindow;
  89. interface nsICmdLineService;
  90. [scriptable, uuid(5fdf8480-1f98-11d4-8077-00600811a9c3)]
  91. interface nsINativeAppSupport : nsISupports {
  92. // Startup/shutdown.
  93. boolean start();
  94. void enable();
  95. boolean stop();
  96. void quit();
  97. void onLastWindowClosing();
  98. void ReOpen();
  99. };