You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.8 KiB

#include <vector>
#include "URL.h"
#include <functional>
struct pointInHistory {
URL realURL;
URL displayURL;
std::string title;
void* stateObj; // limit of 640k here
NOTE: The first parameter of the constructor is the callback to be called when
calling go(int) (or back or forward or whatever). Should be a
function that navigates to the specified URL.
// modelled after
class BrowsingHistory {
BrowsingHistory(std::function<void(URL const&)> onGotoPage_);
size_t length() const;
//void scrollRestoration(); // TODO: Implement this when it's relevant
//void* state() const; // TODO: Implement when we have Javascript objects.
void back();
void forward();
void go();
void go(int diff);
// stateObj: void* should be a Javascript object once we have those. Just
// give it nullptr for the time being.
// title: "Firefox currently ignores this parameter, although it may
// use it in the future.". So i guess we ignore it too? well we'll make plans to properly use it.
void pushState(void* stateObj, std::string const& title, URL const& url);
void replaceState(void* stateObj, std::string const& title, URL const& url);
// onGotoPage can call onPopState... or maybe it should be renamed?
// onPopState <- call when fwd/bck are used and sends the state associated with that point in history
void print();
// push overrides the real URL with a display URL, we'll need to store both
// also need to store a state
std::vector<URL> history;
std::vector<URL>::iterator currentPosition;
std::function<void(URL const&)> onGotoPage;