Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes
nsNativeAppSupportBeOS Class Reference
Inheritance diagram for nsNativeAppSupportBeOS:
Inheritance graph
[legend]
Collaboration diagram for nsNativeAppSupportBeOS:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsNativeAppSupportBeOS ()
 ~nsNativeAppSupportBeOS ()
NS_DECL_NSINATIVEAPPSUPPORT
NS_IMETHOD 
CreateSplashScreen (nsISplashScreen **splash)
 NS_IMETHOD_ (nsrefcnt) AddRef()
 NS_IMETHOD_ (nsrefcnt) Release()
NS_IMETHOD QueryInterface (const nsIID &iid, void **p)
boolean start ()
boolean start ()
void enable ()
boolean stop ()
boolean stop ()
void quit ()
void quit ()
void onLastWindowClosing ()
void onLastWindowClosing ()
void ReOpen ()
void ReOpen ()
void ensureProfile (in nsICmdLineService aCmdService)
void showSplashScreen ()
void hideSplashScreen ()
void startServerMode ()
void observe (in nsISupports aSubject, in string aTopic, in wstring aData)
 Observe will be called when there is a notification for the topic |aTopic|.

Static Public Member Functions

NS_DECL_ISUPPORTS static
NS_DECL_NSINATIVEAPPSUPPORT
void 
HandleCommandLine (int32 argc, char **argv, PRUint32 aState)
NS_DECL_ISUPPORTS
NS_DECL_NSINATIVEAPPSUPPORT
static NS_DECL_NSIOBSERVER
void 
HandleCommandLine (int32 argc, char **argv)

Public Attributes

nsrefcnt mRefCnt
nsCOMPtr< nsISplashScreenmSplash
PRBool mServerMode
PRBool mShouldShowUI
PRBool mShownTurboDialog
attribute boolean isServerMode
attribute boolean shouldShowUI

Static Public Attributes

static PRBool mLastWindowIsConfirmation = PR_FALSE

Private Member Functions

nsresult LoadBitmap ()

Static Private Member Functions

static nsresult OpenBrowserWindow (const char *args)

Private Attributes

BWindow * window
BBitmap * bitmap
BStringView * textView

Detailed Description

Definition at line 104 of file nsNativeAppSupportBeOS.cpp.


Constructor & Destructor Documentation

Definition at line 286 of file nsNativeAppSupportBeOS.cpp.

Definition at line 290 of file nsNativeAppSupportBeOS.cpp.

{
       if (window != NULL)
              HideSplashScreen();
}

Member Function Documentation

Definition at line 145 of file nsNativeAppSupportBase.cpp.

                                                                     {
    NS_ENSURE_ARG( splash );
    *splash = 0;
    return NS_CreateSplashScreen( splash );
}

Here is the call graph for this function:

void nsNativeAppSupportBeOS::HandleCommandLine ( int32  argc,
char **  argv,
PRUint32  aState 
) [static]

Definition at line 258 of file nsNativeAppSupportBeOS.cpp.

{
    nsresult rv;
    // Here we get stuck when starting from file-click or "OpenWith".
    // No cmdLine or any other service can be created
    // To workaround the problem, we store arguments if IsLaunching()
    // and using this after ::Enable() was called.
    nsCOMPtr<nsICommandLineRunner> cmdLine(do_CreateInstance("@mozilla.org/toolkit/command-line;1"));
    if (!cmdLine)
    {
#ifdef DC_PROGRAMNAME
        TRACE("Couldn't create command line!");
#endif
        return;
    }
    // nsICommandLineRunner::Init() requires some folder to be provided
    // but that's unclear if we need it, so using 0 instead atm
    /*
    char wdir[MAXPATHLEN];
    nsCOMPtr<nsILocalFile> workingDir;
    NS_NewNativeLocalFile(nsDependentCString(getcwd((char *)wdir, MAXPATHLEN)),
                          PR_FALSE,
                          getter_AddRefs(workingDir));
    */
    
    // nsICommandLineRunner::Init() should be called from main mozilla thread
    // but we are at be_app thread. Using proxy to switch thread
    nsCOMPtr<nsICommandLineRunner> cmdLineProxy;
    rv = NS_GetProxyForObject(NS_UI_THREAD_EVENTQ, NS_GET_IID(nsICommandLineRunner), 
        cmdLine, PROXY_ASYNC | PROXY_ALWAYS, getter_AddRefs(cmdLineProxy));
    if (rv != NS_OK)
    {
#ifdef DC_PROGRAMNAME
        TRACE("Couldn't get command line Proxy!");
#endif
        return;
    }
    
    rv = cmdLine->Init(argc, argv, 0 , aState);
    if (rv != NS_OK)
    {
#ifdef DC_PROGRAMNAME
        TRACE("Couldn't init command line!");
#endif
        return;
    }
    
#if 0 // TODO: try to use OpenURI here if there is navWin
    nsCOMPtr<nsIDOMWindowInternal> navWin;
    GetMostRecentWindow( NS_LITERAL_STRING( "navigator:browser" ).get(),
                         getter_AddRefs(navWin ));
    if (navWin)
    {
# ifdef DC_PROGRAMNAME
        TRACE("GotNavWin!");
# endif
        cmdLine->SetWindowContext(navWin);
    }
#endif //0

    cmdLineProxy->Run();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsNativeAppSupportBeOS::HandleCommandLine ( int32  argc,
char **  argv 
) [static]

Definition at line 298 of file nsNativeAppSupportBeOS.cpp.

{
       nsresult rv;
       nsCOMPtr<nsICmdLineService> cmdLineArgs;// = (do_GetService(NS_COMMANDLINESERVICE_CONTRACTID, &rv));
       nsCOMPtr<nsIComponentManager> compMgr;
       NS_GetComponentManager(getter_AddRefs(compMgr));
       rv = compMgr->CreateInstanceByContractID(
                                   NS_COMMANDLINESERVICE_CONTRACTID,
                                   nsnull, NS_GET_IID(nsICmdLineService),
                                   (void **)getter_AddRefs(cmdLineArgs));
       
       rv = cmdLineArgs->Initialize(argc, argv);
       if (NS_FAILED(rv)) return;

       nsCOMPtr<nsIAppStartup> appStartup (do_GetService(NS_APPSTARTUP_CONTRACTID, &rv));
       if (NS_FAILED(rv)) return;
       nsCOMPtr<nsIAppStartup> appStartupProxy;
       rv = NS_GetProxyForObject(NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIAppStartup), 
                                                        appStartup, PROXY_ASYNC | PROXY_ALWAYS,
                                                        getter_AddRefs(appStartupProxy));
       nsCOMPtr<nsINativeAppSupport> nativeApp;
       rv = appStartup->GetNativeAppSupport(getter_AddRefs(nativeApp));
       if (NS_FAILED(rv))
       {
#ifdef DC_PROGRAMNAME
              TRACE("No GetNativeAppSupport");
#endif
              return;
       }

       rv = appStartup->Ensure1Window(cmdLineArgs);
       if (NS_FAILED(rv))
       {
#ifdef DC_PROGRAMNAME
              TRACE("No Ensure1Window");
#endif
              return;
       }
       
       // first see if there is a url
       nsXPIDLCString urlToLoad;
       rv = cmdLineArgs->GetURLToLoad(getter_Copies(urlToLoad));
       if (NS_SUCCEEDED(rv) && !urlToLoad.IsEmpty())
       {
              nsCOMPtr<nsICmdLineHandler> handler(
                     do_GetService("@mozilla.org/commandlinehandler/general-startup;1?type=browser"));

              nsXPIDLCString chromeUrlForTask;
              rv = handler->GetChromeUrlForTask(getter_Copies(chromeUrlForTask));

              if (NS_SUCCEEDED(rv))
                     rv = OpenBrowserWindow(urlToLoad.get());
       }
}

Here is the call graph for this function:

Definition at line 611 of file nsNativeAppSupportBeOS.cpp.

{
       BResources *rsrc = be_app->AppResources();
       if (NULL == rsrc)
              return NS_ERROR_FAILURE;
       size_t length;
       const void *data = rsrc->LoadResource('BBMP', "MOZILLA:SPLASH", &length);
       if (NULL == data)
              return NS_ERROR_FAILURE;
       BMessage msg;
       if (B_OK != msg.Unflatten((const char *) data))
              return NS_ERROR_FAILURE;
       BBitmap *bmp = new BBitmap(&msg);
       if (NULL == bmp)
              return NS_ERROR_FAILURE;
       bitmap = new BBitmap(bmp, true);
       if (NULL == bitmap)
       {
              delete bmp;
              return NS_ERROR_FAILURE;
       }
       return NS_OK;
}
void nsIObserver::observe ( in nsISupports  aSubject,
in string  aTopic,
in wstring  aData 
) [inherited]

Observe will be called when there is a notification for the topic |aTopic|.

This assumes that the object implementing this interface has been registered with an observer service such as the nsIObserverService.

If you expect multiple topics/subjects, the impl is responsible for filtering.

You should not modify, add, remove, or enumerate notifications in the implemention of observe.

Parameters:
aSubject: Notification specific interface pointer.
aTopic: The notification topic or subject.
aData: Notification specific wide string. subject event.
nsresult nsNativeAppSupportBeOS::OpenBrowserWindow ( const char *  args) [static, private]

Definition at line 355 of file nsNativeAppSupportBeOS.cpp.

{
       nsresult rv;

       // Get most recently used Nav window.
       nsCOMPtr<nsIDOMWindowInternal> navWin;
       rv = GetMostRecentWindow(NS_LITERAL_STRING("navigator:browser").get(), getter_AddRefs(navWin ));

       // If caller requires a new window, then don't use an existing one.
       if (NS_FAILED(rv) || !navWin)
       {
#ifdef DC_PROGRAMNAME
              TRACE("!navWin");
#endif
              return NS_ERROR_FAILURE;
       }

       nsCOMPtr<nsIDOMChromeWindow> chromeWin(do_QueryInterface(navWin, &rv));
       if (NS_FAILED(rv) || !chromeWin)
       {
#ifdef DC_PROGRAMNAME
              TRACE("!chromeWin");
#endif
              return NS_ERROR_FAILURE;
       }

       nsCOMPtr<nsIBrowserDOMWindow> bwin;
       rv = chromeWin->GetBrowserDOMWindow(getter_AddRefs(bwin));
       if (NS_FAILED(rv) || !bwin)
       {
#ifdef DC_PROGRAMNAME
              TRACE("!bwin");
#endif
              return NS_ERROR_FAILURE;
       }

       nsCOMPtr<nsIURIFixup> fixup(do_GetService(NS_URIFIXUP_CONTRACTID, &rv));
       if (NS_FAILED(rv) || !fixup)
       {
#ifdef DC_PROGRAMNAME
              TRACE("!fixup");
#endif
              return NS_ERROR_FAILURE;
       }

       nsCOMPtr<nsIURI> uri;
       rv = fixup->CreateFixupURI(nsDependentCString(args),
                                                 nsIURIFixup::FIXUP_FLAG_NONE,
                                                 getter_AddRefs(uri));
       if (NS_FAILED(rv) || !uri)
       {
#ifdef DC_PROGRAMNAME
              TRACE("!uri");
#endif
              return NS_ERROR_FAILURE;
       }

#ifdef DC_PROGRAMNAME
       TRACE("OpenURI! %s", uri.get());
#endif
       nsCOMPtr<nsIBrowserDOMWindow> bwinProxy;
       rv = NS_GetProxyForObject(
                     NS_UI_THREAD_EVENTQ,
                     NS_GET_IID(nsIBrowserDOMWindow),
                     bwin, 
                     PROXY_ASYNC | PROXY_ALWAYS, 
                     getter_AddRefs(bwinProxy));
       
       if (NS_FAILED(rv))
       {
              printf("!bwinProxy");
              return rv;
       }

       nsCOMPtr<nsIDOMWindow> resWin;
       rv =  bwinProxy->OpenURI( uri, nsnull, nsIBrowserDOMWindow::OPEN_DEFAULTWINDOW, nsIBrowserDOMWindow::OPEN_EXTERNAL, getter_AddRefs(resWin) );
       // rv failure may be just 404, so still activating navWin exists
       ActivateWindow(navWin);
       return rv;
}

Here is the call graph for this function:

Definition at line 169 of file nsNativeAppSupportBase.cpp.

                                                                  {
    nsresult rv = NS_OK;
    if ( p ) {
        *p = 0;
        if ( iid.Equals( NS_GET_IID( nsINativeAppSupport ) ) ) {
            nsINativeAppSupport *result = this;
            *p = result;
            NS_ADDREF( result );
        } else if ( iid.Equals( NS_GET_IID( nsISupports ) ) ) {
            nsISupports *result = NS_STATIC_CAST( nsISupports*, this );
            *p = result;
            NS_ADDREF( result );
        } else {
            rv = NS_NOINTERFACE;
        }
    } else {
        rv = NS_ERROR_NULL_POINTER;
    }
    return rv;
}

Here is the call graph for this function:

Implemented in nsNativeAppSupportMac.

Implemented in nsNativeAppSupportMac.


Member Data Documentation

BBitmap* nsNativeAppSupportBeOS::bitmap [private]

Definition at line 141 of file nsNativeAppSupportBeOS.cpp.

Definition at line 186 of file nsINativeAppSupport.idl.

Definition at line 73 of file nsNativeAppSupportBase.h.

Definition at line 68 of file nsNativeAppSupportBase.h.

Definition at line 70 of file nsNativeAppSupportBase.h.

Definition at line 71 of file nsNativeAppSupportBase.h.

Definition at line 72 of file nsNativeAppSupportBase.h.

Definition at line 69 of file nsNativeAppSupportBase.h.

Definition at line 187 of file nsINativeAppSupport.idl.

BStringView* nsNativeAppSupportBeOS::textView [private]

Definition at line 142 of file nsNativeAppSupportBeOS.cpp.

BWindow* nsNativeAppSupportBeOS::window [private]

Definition at line 140 of file nsNativeAppSupportBeOS.cpp.


The documentation for this class was generated from the following files: