mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add CefBrowserHost::GetNavigationEntries for retrieving a snapshot of navigation history (issue #1442).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1924 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -18,6 +18,7 @@
|
||||
#include "libcef/browser/devtools_frontend.h"
|
||||
#include "libcef/browser/media_capture_devices_dispatcher.h"
|
||||
#include "libcef/browser/navigate_params.h"
|
||||
#include "libcef/browser/navigation_entry_impl.h"
|
||||
#include "libcef/browser/printing/print_view_manager.h"
|
||||
#include "libcef/browser/render_widget_host_view_osr.h"
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
@ -857,6 +858,46 @@ void CefBrowserHostImpl::CloseDevTools() {
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::GetNavigationEntries(
|
||||
CefRefPtr<CefNavigationEntryVisitor> visitor,
|
||||
bool current_only) {
|
||||
DCHECK(visitor.get());
|
||||
if (!visitor.get())
|
||||
return;
|
||||
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::GetNavigationEntries, this, visitor,
|
||||
current_only));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!web_contents())
|
||||
return;
|
||||
|
||||
const content::NavigationController& controller =
|
||||
web_contents()->GetController();
|
||||
const int total = controller.GetEntryCount();
|
||||
const int current = controller.GetCurrentEntryIndex();
|
||||
|
||||
if (current_only) {
|
||||
// Visit only the current entry.
|
||||
CefRefPtr<CefNavigationEntryImpl> entry =
|
||||
new CefNavigationEntryImpl(controller.GetEntryAtIndex(current));
|
||||
visitor->Visit(entry.get(), true, current, total);
|
||||
entry->Detach(NULL);
|
||||
} else {
|
||||
// Visit all entries.
|
||||
bool cont = true;
|
||||
for (int i = 0; i < total && cont; ++i) {
|
||||
CefRefPtr<CefNavigationEntryImpl> entry =
|
||||
new CefNavigationEntryImpl(controller.GetEntryAtIndex(i));
|
||||
cont = visitor->Visit(entry.get(), (i == current), i, total);
|
||||
entry->Detach(NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::SetMouseCursorChangeDisabled(bool disabled) {
|
||||
base::AutoLock lock_scope(state_lock_);
|
||||
mouse_cursor_change_disabled_ = disabled;
|
||||
|
Reference in New Issue
Block a user