embedding/components/appstartup/src/nsIAppStartupNotifier.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     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/. */
     6 #ifndef nsIAppStartupNotifier_h___
     7 #define nsIAppStartupNotifier_h___
     9 #include "nsIObserver.h"
    11 /*
    12  Some components need to be run at the startup of mozilla or embedding - to 
    13  start new services etc.
    15  This interface provides a generic way to start up arbitrary components 
    16  without requiring them to hack into main1() (or into NS_InitEmbedding) as 
    17  it's currently being done for services such as wallet, command line handlers 
    18  etc.
    20  We will have a category called "app-startup" which components register 
    21  themselves in using the CategoryManager.
    23  Components can also (optionally) add the word "service," as a prefix 
    24  to the "value" they pass in during a call to AddCategoryEntry() as
    25  shown below:
    27     categoryManager->AddCategoryEntry(APPSTARTUP_CATEGORY, "testcomp",
    28                         "service," NS_WALLETSERVICE_CONTRACTID
    29                         true, true,
    30                         getter_Copies(previous));
    32  Presence of the "service" keyword indicates the components desire to 
    33  be started as a service. When the "service" keyword is not present
    34  we just do a do_CreateInstance.
    36  When mozilla starts (and when NS_InitEmbedding()) is invoked
    37  we create an instance of the AppStartupNotifier component (which 
    38  implements nsIObserver) and invoke its Observe() method. 
    40  Observe()  will enumerate the components registered into the
    41  APPSTARTUP_CATEGORY and notify them that startup has begun
    42  and release them.
    43 */
    45 #define NS_APPSTARTUPNOTIFIER_CONTRACTID "@mozilla.org/embedcomp/appstartup-notifier;1"
    47 #define APPSTARTUP_CATEGORY "app-startup"
    48 #define APPSTARTUP_TOPIC    "app-startup"
    51 /*
    52  Please note that there's not a new interface in this file.
    53  We're just leveraging nsIObserver instead of creating a
    54  new one
    56  This file exists solely to provide the defines above
    57 */
    59 #endif /* nsIAppStartupNotifier_h___ */

mercurial