embedding/components/appstartup/src/nsIAppStartupNotifier.h

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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