Skip to content

Commit 4cb77e4

Browse files
committed
Core - Add IBrowserHost.GetNavigationEntriesAsync extension method
1 parent 87c8725 commit 4cb77e4

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

CefSharp/AsyncExtensions.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,5 +134,20 @@ public static Task<bool> FlushStoreAsync(this ICookieManager cookieManager)
134134
//returns null if cookies cannot be accessed.
135135
return Task.FromResult(false);
136136
}
137+
138+
/// <summary>
139+
/// Retrieve a snapshot of current navigation entries
140+
/// </summary>
141+
/// <param name="browserHost">browserHost</param>
142+
/// <param name="currentOnly">If true the List will only contain the current navigation entry.
143+
/// If false the List will include all navigation entries will be included. Default is false</param>
144+
public static Task<List<NavigationEntry>> GetNavigationEntriesAsync(this IBrowserHost browserHost, bool currentOnly = false)
145+
{
146+
var visitor = new TaskNavigationEntryVisitor();
147+
148+
browserHost.GetNavigationEntries(visitor, currentOnly);
149+
150+
return visitor.Task;
151+
}
137152
}
138153
}

0 commit comments

Comments
 (0)