CefNavigationEntry
Header: cef_navigation_entry.h
Category: Core APIs
Overview
Foundational interfaces: process bootstrap, browser lifecycle, frames, DOM, requests, and data objects.
CefNavigationEntry
Source File: include/cef_navigation_entry.h
Process / Thread Context: Header does not specify a thread for individual methods. The class is a read-only snapshot used inside CefNavigationEntryVisitor::Visit (which is documented as UI-thread). The GetVisibleNavigationEntry accessor on CefBrowserHost is UI-thread only. In practice all access is on the browser-process UI thread.
Purpose: "Class used to represent an entry in navigation history." Read-only interface returned by CefBrowserHost::GetVisibleNavigationEntry() and CefBrowserHost::GetNavigationEntries(visitor, ...). Exposes URL/title/transition/SSL info for one history slot.
Methods
virtual bool IsValid() = 0
Return Value: "Returns true if this object is valid. Do not call any other methods if this function returns false."
Threading Constraint: Threading constraint not specified in source.
virtual CefString GetURL() = 0
Return Value: "Returns the actual URL of the page. For some pages this may be data: URL or similar. Use GetDisplayURL() to return a display-friendly version."
Threading Constraint: Threading constraint not specified in source.
virtual CefString GetDisplayURL() = 0
Return Value: "Returns a display-friendly version of the URL."
Threading Constraint: Threading constraint not specified in source.
virtual CefString GetOriginalURL() = 0
Return Value: "Returns the original URL that was entered by the user before any redirects."
Threading Constraint: Threading constraint not specified in source.
virtual CefString GetTitle() = 0
Return Value: "Returns the title set by the page. This value may be empty."
Threading Constraint: Threading constraint not specified in source.
virtual TransitionType GetTransitionType() = 0
Return Value: "Returns the transition type which indicates what the user did to move to this page from the previous page." Default retval: TT_EXPLICIT.
Threading Constraint: Threading constraint not specified in source.
virtual bool HasPostData() = 0
Return Value: "Returns true if this navigation includes post data."
Threading Constraint: Threading constraint not specified in source.
virtual CefBaseTime GetCompletionTime() = 0
Return Value: "Returns the time for the last known successful navigation completion. A navigation may be completed more than once if the page is reloaded. May be 0 if the navigation has not yet completed."
Threading Constraint: Threading constraint not specified in source.
virtual int GetHttpStatusCode() = 0
Return Value: "Returns the HTTP status code for the last known successful navigation response. May be 0 if the response has not yet been received or if the navigation has not yet completed."
Threading Constraint: Threading constraint not specified in source.
virtual CefRefPtr<CefSSLStatus> GetSSLStatus() = 0
Return Value: "Returns the SSL information for this navigation entry."
Threading Constraint: Threading constraint not specified in source.
Usage Example
class MyVisitor : public CefNavigationEntryVisitor {
public:
bool Visit(CefRefPtr<CefNavigationEntry> entry, bool current,
int index, int total) override {
if (!entry->IsValid()) return true;
LOG(INFO) << "[" << index << "/" << total << "] "
<< (current ? "(current) " : "")
<< entry->GetDisplayURL().ToString()
<< " title='" << entry->GetTitle().ToString() << "'"
<< " status=" << entry->GetHttpStatusCode();
if (entry->HasPostData()) LOG(INFO) << " has POST data";
auto ssl = entry->GetSSLStatus();
if (ssl && ssl->IsSecureConnection()) LOG(INFO) << " secure";
return true; // continue
}
IMPLEMENT_REFCOUNTING(MyVisitor);
};
// Trigger:
browser->GetHost()->GetNavigationEntries(new MyVisitor(), /* current_only */ false);
// Or get just the current entry:
CefRefPtr<CefNavigationEntry> cur = browser->GetHost()->GetVisibleNavigationEntry();