mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
changes to add support for the "browser.startup.page" pref and the new
"browser.startup.splash" page pref. all that's left is to get radha to add the code to get the last page visted.
This commit is contained in:
parent
621a5c5670
commit
4d5f8a6002
@ -45,6 +45,9 @@ interface nsIGlobalHistory : nsISupports
|
||||
|
||||
// Get the preferred completion for aURL
|
||||
string GetURLCompletion(in string aURL);
|
||||
|
||||
// get the last page visited
|
||||
string GetLastPageVisted();
|
||||
};
|
||||
|
||||
%{ C++
|
||||
|
@ -58,6 +58,48 @@
|
||||
dump("Setting content window\n");
|
||||
appCore.setContentWindow( window.frames[0].frames[1] );
|
||||
// Have browser app core load appropriate initial page.
|
||||
|
||||
var pref = Components.classes['component://netscape/preferences'];
|
||||
|
||||
// if all else fails, use trusty "about:" as the start page
|
||||
var startPage = "about:";
|
||||
if (pref) {
|
||||
pref = pref.getService();
|
||||
}
|
||||
if (pref) {
|
||||
pref = pref.QueryInterface(Components.interfaces.nsIPref);
|
||||
}
|
||||
if (pref) {
|
||||
// from mozilla/modules/libpref/src/init/all.js
|
||||
// 0 = blank
|
||||
// 1 = home (browser.startup.homepage)
|
||||
// 2 = last
|
||||
// 3 = splash (browser.startup.splash)
|
||||
choice = pref.GetIntPref("browser.startup.page");
|
||||
if (choice == 0) {
|
||||
startpage = "about:blank";
|
||||
}
|
||||
else if (choice == 1) {
|
||||
startpage = pref.CopyCharPref("browser.startup.homepage");
|
||||
}
|
||||
else if (choice == 2) {
|
||||
var history = Components.classes['component://netscape/browser/global-history'];
|
||||
if (history) {
|
||||
history = history.QueryInterface(Components.interfaces.nsIGlobalHistory);
|
||||
}
|
||||
if (history) {
|
||||
startpage = history.GetLastPageVisted();
|
||||
}
|
||||
}
|
||||
else if (choice == 3) {
|
||||
startpage = pref.CopyCharPref("browser.startup.splash");
|
||||
}
|
||||
else {
|
||||
// use about: as the default
|
||||
startpage = "about:";
|
||||
}
|
||||
}
|
||||
document.getElementById("args").setAttribute("value", startpage);
|
||||
appCore.loadInitialPage();
|
||||
} else {
|
||||
// Try again.
|
||||
|
@ -294,7 +294,11 @@
|
||||
<broadcaster id="Browser:Status"/>
|
||||
<broadcaster id="Browser:Security" secure="false"/>
|
||||
<broadcaster id="Browser:Throbber" busy="false"/>
|
||||
<<<<<<< navigator.xul
|
||||
<broadcaster id="args" value=""/>
|
||||
=======
|
||||
<broadcaster id="args" value="http://www.mozillazine.org"/>
|
||||
>>>>>>> 1.136
|
||||
|
||||
<!-- Interim hack to transition from nsIXULWindowCallbacks/ShowWindowWithArgs -->
|
||||
<broadcaster id="dialog.start" ready="false"/>
|
||||
|
@ -45,6 +45,9 @@ interface nsIGlobalHistory : nsISupports
|
||||
|
||||
// Get the preferred completion for aURL
|
||||
string GetURLCompletion(in string aURL);
|
||||
|
||||
// get the last page visited
|
||||
string GetLastPageVisted();
|
||||
};
|
||||
|
||||
%{ C++
|
||||
|
@ -112,6 +112,7 @@ public:
|
||||
NS_IMETHOD RemovePage(const char *aURL);
|
||||
NS_IMETHOD GetLastVisitDate(const char *aURL, PRInt64 *_retval);
|
||||
NS_IMETHOD GetURLCompletion(const char *aURL, char **_retval);
|
||||
NS_IMETHOD GetLastPageVisted(char **_retval);
|
||||
|
||||
// nsIRDFDataSource
|
||||
NS_IMETHOD Init(const char* aURI);
|
||||
@ -505,6 +506,16 @@ nsGlobalHistory::GetURLCompletion(const char *aURL, char **_retval)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalHistory::GetLastPageVisted(char **_retval)
|
||||
{
|
||||
NS_PRECONDITION(_retval != nsnull, "null ptr");
|
||||
if (! _retval)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*_retval = PR_smprintf("http://people.netscape.com/radha");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsIRDFDataSource
|
||||
|
Loading…
Reference in New Issue
Block a user