mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
moving the timebomb code from the nsAppRunner to the Browser. This
allows us to modify that user's first start page. 28060. r= mccabe, a= jevering.
This commit is contained in:
parent
d7236ee829
commit
a7dfe9b9ae
@ -56,22 +56,15 @@
|
||||
#include "nsICmdLineHandler.h"
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsXPIDLString.h"
|
||||
|
||||
#include "nsIXULWindow.h"
|
||||
#include "nsIContentHandler.h"
|
||||
#include "nsIBrowserInstance.h"
|
||||
|
||||
// Interfaces Needed
|
||||
#include "nsIXULWindow.h"
|
||||
|
||||
|
||||
#ifndef XP_MAC
|
||||
#include "nsTimeBomb.h"
|
||||
#endif
|
||||
|
||||
#if defined(DEBUG_sspitzer) || defined(DEBUG_seth)
|
||||
#define DEBUG_CMD_LINE
|
||||
#endif
|
||||
|
||||
|
||||
static NS_DEFINE_CID(kSoftUpdateCID, NS_SoftwareUpdate_CID);
|
||||
static NS_DEFINE_IID(kIWindowMediatorIID,NS_IWINDOWMEDIATOR_IID);
|
||||
static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID);
|
||||
@ -79,10 +72,6 @@ static NS_DEFINE_CID(kWalletServiceCID, NS_WALLETSERVICE_CID);
|
||||
static NS_DEFINE_CID(kBrowserContentHandlerCID, NS_BROWSERCONTENTHANDLER_CID);
|
||||
|
||||
|
||||
#ifndef XP_MAC
|
||||
static NS_DEFINE_CID(kTimeBombCID, NS_TIMEBOMB_CID);
|
||||
#endif
|
||||
|
||||
#define HELP_SPACER_1 "\t"
|
||||
#define HELP_SPACER_2 "\t\t"
|
||||
|
||||
@ -715,24 +704,6 @@ static nsresult main1(int argc, char* argv[], nsISplashScreen *splashScreen )
|
||||
// if the profile manager ever switches to using nsIDOMWindow stuff, this might have to change
|
||||
appShell->CreateHiddenWindow();
|
||||
|
||||
#ifndef XP_MAC
|
||||
PRBool expired;
|
||||
NS_WITH_SERVICE(nsITimeBomb, timeBomb, kTimeBombCID, &rv);
|
||||
if ( NS_FAILED(rv) ) return rv;
|
||||
|
||||
rv = timeBomb->Init();
|
||||
if ( NS_FAILED(rv) ) return rv;
|
||||
|
||||
rv = timeBomb->CheckWithUI(&expired);
|
||||
if ( NS_FAILED(rv) ) return rv;
|
||||
|
||||
if ( expired )
|
||||
{
|
||||
rv = timeBomb->LoadUpdateURL();
|
||||
if ( NS_FAILED(rv) ) return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
nsTraceRefcnt::SetPrefServiceAvailability(PR_TRUE);
|
||||
#endif
|
||||
@ -753,7 +724,7 @@ static nsresult main1(int argc, char* argv[], nsISplashScreen *splashScreen )
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to process command line");
|
||||
if ( NS_FAILED(rv) )
|
||||
return rv;
|
||||
|
||||
|
||||
// Make sure there exists at least 1 window.
|
||||
rv = Ensure1Window( cmdLineArgs );
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to Ensure1Window");
|
||||
|
@ -139,6 +139,8 @@ static PRLogModuleInfo* gTimerLog = nsnull;
|
||||
#define ENABLE_PAGE_CYCLER
|
||||
#endif
|
||||
|
||||
#include "nsTimeBomb.h"
|
||||
static NS_DEFINE_CID(kTimeBombCID, NS_TIMEBOMB_CID);
|
||||
|
||||
static NS_DEFINE_IID(kIDocumentViewerIID, NS_IDOCUMENT_VIEWER_IID);
|
||||
|
||||
@ -2491,6 +2493,8 @@ CMDLINEHANDLER2_IMPL(nsBrowserContentHandler,"-chrome","general.startup.browser"
|
||||
|
||||
NS_IMETHODIMP nsBrowserContentHandler::GetDefaultArgs(PRUnichar **aDefaultArgs)
|
||||
{
|
||||
static PRBool timebombChecked = PR_FALSE;
|
||||
|
||||
if (!aDefaultArgs) return NS_ERROR_FAILURE;
|
||||
|
||||
nsString args;
|
||||
@ -2502,6 +2506,34 @@ NS_IMETHODIMP nsBrowserContentHandler::GetDefaultArgs(PRUnichar **aDefaultArgs)
|
||||
nsresult rv;
|
||||
nsXPIDLCString url;
|
||||
|
||||
if (timebombChecked == PR_FALSE)
|
||||
{
|
||||
// timebomb check
|
||||
timebombChecked = PR_TRUE;
|
||||
|
||||
PRBool expired;
|
||||
NS_WITH_SERVICE(nsITimeBomb, timeBomb, kTimeBombCID, &rv);
|
||||
if ( NS_FAILED(rv) ) return rv;
|
||||
|
||||
rv = timeBomb->Init();
|
||||
if ( NS_FAILED(rv) ) return rv;
|
||||
|
||||
rv = timeBomb->CheckWithUI(&expired);
|
||||
if ( NS_FAILED(rv) ) return rv;
|
||||
|
||||
if ( expired )
|
||||
{
|
||||
char* urlString;
|
||||
rv = timeBomb->GetTimebombURL(&urlString);
|
||||
if ( NS_FAILED(rv) ) return rv;
|
||||
|
||||
nsString url ( urlString );
|
||||
*aDefaultArgs = url.ToNewUnicode();
|
||||
nsAllocator::Free(urlString);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
/* the default, in case we fail somewhere */
|
||||
args = "about:blank";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user