mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add CefBrowserSettings.history_disabled option to disable history back/forward navigation (issue #419).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@393 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -43,11 +43,12 @@ void BrowserNavigationEntry::SetContentState(const std::string& state) {
|
||||
// ----------------------------------------------------------------------------
|
||||
// BrowserNavigationController
|
||||
|
||||
BrowserNavigationController::BrowserNavigationController(CefBrowserImpl* shell)
|
||||
BrowserNavigationController::BrowserNavigationController(
|
||||
CefBrowserImpl* browser)
|
||||
: pending_entry_(NULL),
|
||||
last_committed_entry_index_(-1),
|
||||
pending_entry_index_(-1),
|
||||
browser_(shell),
|
||||
browser_(browser),
|
||||
max_page_id_(-1) {
|
||||
}
|
||||
|
||||
@@ -60,6 +61,7 @@ void BrowserNavigationController::Reset() {
|
||||
DiscardPendingEntry();
|
||||
|
||||
last_committed_entry_index_ = -1;
|
||||
UpdateMaxPageID();
|
||||
}
|
||||
|
||||
void BrowserNavigationController::Reload(bool ignoreCache) {
|
||||
@@ -198,12 +200,19 @@ void BrowserNavigationController::DiscardPendingEntry() {
|
||||
void BrowserNavigationController::InsertEntry(BrowserNavigationEntry* entry) {
|
||||
DiscardPendingEntry();
|
||||
|
||||
// Prune any entry which are in front of the current entry
|
||||
int current_size = static_cast<int>(entries_.size());
|
||||
if (current_size > 0) {
|
||||
while (last_committed_entry_index_ < (current_size - 1)) {
|
||||
entries_.pop_back();
|
||||
current_size--;
|
||||
const CefBrowserSettings& settings = browser_->settings();
|
||||
if (settings.history_disabled) {
|
||||
// History is disabled. Remove any existing entries.
|
||||
if (entries_.size() > 0)
|
||||
entries_.clear();
|
||||
} else {
|
||||
// Prune any entry which are in front of the current entry.
|
||||
int current_size = static_cast<int>(entries_.size());
|
||||
if (current_size > 0) {
|
||||
while (last_committed_entry_index_ < (current_size - 1)) {
|
||||
entries_.pop_back();
|
||||
current_size--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user