Skip to content

Commit

Permalink
Add IBrowserHost::GetVisibleNavigationEntry - step one in implementing
Browse files Browse the repository at this point in the history
  • Loading branch information
amaitland committed Oct 20, 2016
1 parent 1008347 commit 1ccb55e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
24 changes: 24 additions & 0 deletions CefSharp.Core/Internals/CefBrowserHostWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,30 @@ void CefBrowserHostWrapper::GetNavigationEntries(INavigationEntryVisitor^ visito
_browserHost->GetNavigationEntries(navEntryVisitor, currentOnly);
}

NavigationEntry CefBrowserHostWrapper::GetVisibleNavigationEntry()
{
ThrowIfDisposed();

auto entry = _browserHost->GetVisibleNavigationEntry();

NavigationEntry navEntry;

//TODO: This code is duplicated in CefNavigationEntryVisitor
if (entry->IsValid())
{
auto time = entry->GetCompletionTime();
DateTime completionTime = CefTimeUtils::ConvertCefTimeToDateTime(time.GetDoubleT());
navEntry = NavigationEntry(true, completionTime, StringUtils::ToClr(entry->GetDisplayURL()), entry->GetHttpStatusCode(), StringUtils::ToClr(entry->GetOriginalURL()), StringUtils::ToClr(entry->GetTitle()), (TransitionType)entry->GetTransitionType(), StringUtils::ToClr(entry->GetURL()), entry->HasPostData(), true);
}
else
{
//Invalid nav entry
navEntry = NavigationEntry(true, DateTime::MinValue, nullptr, -1, nullptr, nullptr, (TransitionType)-1, nullptr, false, false);
}

return navEntry;
}

void CefBrowserHostWrapper::NotifyMoveOrResizeStarted()
{
ThrowIfDisposed();
Expand Down
2 changes: 2 additions & 0 deletions CefSharp.Core/Internals/CefBrowserHostWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ namespace CefSharp

virtual void GetNavigationEntries(INavigationEntryVisitor^ visitor, bool currentOnly);

virtual NavigationEntry GetVisibleNavigationEntry();

virtual property int WindowlessFrameRate
{
int get();
Expand Down
7 changes: 7 additions & 0 deletions CefSharp/IBrowserHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,13 @@ public interface IBrowserHost : IDisposable
/// entry will be sent, otherwise all navigation entries will be sent.</param>
void GetNavigationEntries(INavigationEntryVisitor visitor, bool currentOnly);

/// <summary>
/// Returns the current visible navigation entry for this browser. This method
/// can only be called on the CEF UI thread.
/// </summary>
/// <returns>the current navigation entry</returns>
NavigationEntry GetVisibleNavigationEntry();

/// <summary>
/// Gets/sets the maximum rate in frames per second (fps) that CefRenderHandler::
/// OnPaint will be called for a windowless browser. The actual fps may be
Expand Down

0 comments on commit 1ccb55e

Please sign in to comment.