Looking thro' and consolidating the notes at
http://www.mozilla.org/projects/embedding/apiReviewNotes.html, here's
what I have come up, as TBD for SH interfaces:
1) The embedding app needs to have a handle to a history object, which
it can use to get information as well as perform operations on. For now,
let me call this object nsIBrowserHistory and this will be a public
interface. This is different from the existing nsISHistoryListener
interface which is primarily a notification type of interface from the
browser object to the embeddor.
nsIBrowserHistory will have methods for the following operations. Please
note that all this information is for the currently embedded browser
object ie., session history only. No tie up with global history is
provided here.
a) Get the total number of entries in current browser window's history.
b) Get the current position in the history list.
c) Get and Set the maximum number of history entries that the browser
object will hold. Currently this is accessible thro' Prefs UI.
d) Get a enumerator object to go thro' all the entries in History. The
object returned by the enumerator will be a public interface
nsIHistoryEntry(described below).
e) get access to a nsIHistoryEntry object at a particular index.
f) Trim the History to 'N' entries.
f) Setup or Remove listener for all History operations. The current
nsISHistoryListener will be set/unset here.
2) nsISHistoryEntry: This is the public interface to get information
about a particular history object. This interface will expose
a) The url for the entry
b) The title for the entry
c) A flag that indicates if this entry is for a top level url or a
subframe navigation.
3) Some of the items listed in 1) are currently provided by nsISHistory,
which is not a public interface. I intend to refactor it so that the
ones listed above are made public and everything else non-public.
nsIWebNavigation will provide access to only the nsIBrowserHistory
object, from which one can access a particular nsIHistoryEntry and get
url, title etc... to build any menu.
4) There is a mention of refactoring the existing nsISHEntry so that url
and title are accessible thro' a different interface. see,
http://www.mozilla.org/projects/embedding/apiReviewNotes.html#nsISHistoryEntry
My take on that is, though nsIHistoryEntry described above does that, I
do not want to internally change nsISHEntry or its clients to use
nsIHistoryEntry. This is because, nsISHEntry is used extensively and
this would lead to lots of changes to the clients of nsISHEntry and
internally in nsSHEntry.cpp. Instead, whenever a enumerator is called or
a nsIBrowserHistory->GetEntryAtIndex(nsIHistoryEntry ** aResult) is
called, we could create a nsIHistoryEntry object and get the required
information from the corresponding nsISHEntry and return to the caller.
Please provide your suggestions, Comments.
Thanks,
Radha