5#ifndef MOLYBDEN_NAVIGATION_HPP
6#define MOLYBDEN_NAVIGATION_HPP
12#include "molybden/browser/browser.hpp"
13#include "molybden/navigation/navigation_delegates.hpp"
14#include "molybden/navigation/navigation_events.hpp"
15#include "molybden/network/http_header.hpp"
16#include "molybden/network/upload_data.hpp"
17#include "molybden/time/timestamp.hpp"
24constexpr int64_t kDefaultNavigationTimeoutInSeconds = 30;
54enum class PageType { kUnspecified, kNormal, kError };
111 operator NetError()
const;
116 operator bool()
const;
125 friend class NavigationImpl;
137 virtual std::shared_ptr<Browser>
browser() = 0;
151 virtual void loadUrl(
const std::string& url) = 0;
203 uint64_t timeout_in_seconds) = 0;
243 uint64_t timeout_in_seconds) = 0;
Objects implement this interface to get notified about changes in Navigation and to provide necessary...
Definition navigation_delegates.hpp:148
A class that contains all navigation events.
Definition navigation_events.hpp:225
Allows loading resources in the browser and working with the navigation history.
Definition navigation.hpp:132
virtual NavigationResult loadUrlAndWait(const std::string &url, const LoadUrlOptions &options)=0
Starts a navigation to the resource identified by the given options and blocks the current thread unt...
virtual NavigationResult loadUrlAndWait(const std::string &url, const LoadUrlOptions &options, uint64_t timeout_in_seconds)=0
Starts a navigation to the resource identified by the given options and blocks the current thread unt...
virtual NavigationEntry entryAtIndex(uint32_t index)=0
Returns the navigation entry item at the given index in the back-forward list.
virtual void reloadIgnoringCache()=0
Reloads the currently loaded web page ignoring caches.
virtual void goForward()=0
Loads the next location in the back-forward list.
virtual int32_t currentEntryIndex()=0
Returns the index of the current item in the back-forward list or -1 if the list is empty.
virtual void stop()=0
Cancels any pending navigation or download operation and stops any dynamic page elements,...
virtual void loadUrl(const std::string &url)=0
Starts a navigation to the resource identified by the given url.
virtual bool canGoBack()=0
Checks if the previous location can be loaded.
virtual void goBack()=0
Loads the previous location in the back-forward list.
virtual void reloadIgnoringCacheAndCheckForRepost()=0
Reloads the currently loaded web page ignoring caches, but if the current web page has POST data,...
virtual void loadUrl(const std::string &url, const LoadUrlOptions &options)=0
Starts a navigation to the resource identified by the given url and options.
virtual NavigationResult loadUrlAndWait(const std::string &url, uint64_t timeout_in_seconds)=0
Starts a navigation to the resource identified by the given url and blocks the current thread until t...
virtual void reload()=0
Reloads the currently loaded web page.
virtual void goToIndex(uint32_t index)=0
Navigates to the navigation entry item at the given index in the back-forward list.
virtual std::shared_ptr< Browser > browser()=0
The browser instance of this navigation.
virtual bool removeEntryAtIndex(uint32_t index)=0
Removes the item at the given index in the back-forward list and returns true if it was removed succe...
virtual NavigationResult loadUrlAndWait(const std::string &url)=0
Starts a navigation to the resource identified by the given url and blocks the current thread until t...
virtual void reloadAndCheckForRepost()=0
Reloads the currently loaded web page, but if the current web page has POST data, the user is prompte...
virtual uint32_t entryCount()=0
Returns the number of items in the back-forward list.
virtual bool canGoForward()=0
Checks if the next location can be loaded.
The result of the blocking navigation.
Definition navigation.hpp:95
bool operator==(NetError error) const
Compares the network error code with to the given error.
bool hasNavigationTimedOut() const
Indicates if the navigation has been timed out.
The optional parameters of the load URL request.
Definition navigation.hpp:29
std::shared_ptr< UploadData > upload_data
The upload data that will be sent with the request.
Definition navigation.hpp:33
std::vector< HttpHeader > extra_http_headers
The extra HTTP headers that will be sent with the request.
Definition navigation.hpp:48
The navigation history entry.
Definition navigation.hpp:59
std::string url
The actual URL of the web page.
Definition navigation.hpp:68
std::string title
The title as set by the web page or an empty string if there is no title.
Definition navigation.hpp:63
PageType page_type
The page type of this navigation entry.
Definition navigation.hpp:83
std::string original_request_url
The URL that caused this navigation entry to be created.
Definition navigation.hpp:73
HttpStatusCode http_status_code
The status code of the last known successful navigation.
Definition navigation.hpp:78
Timestamp timestamp
The time at which the last known navigation was completed.
Definition navigation.hpp:89