diff --git a/libcef/browser_navigation_controller.cc b/libcef/browser_navigation_controller.cc index 2dbe8baa7..a7cd84ec2 100644 --- a/libcef/browser_navigation_controller.cc +++ b/libcef/browser_navigation_controller.cc @@ -105,7 +105,8 @@ void BrowserNavigationController::LoadEntry(BrowserNavigationEntry* entry) { } -BrowserNavigationEntry* BrowserNavigationController::GetLastCommittedEntry() const { +BrowserNavigationEntry* BrowserNavigationController::GetLastCommittedEntry() + const { if (last_committed_entry_index_ == -1) return NULL; return entries_[last_committed_entry_index_].get(); @@ -139,7 +140,8 @@ BrowserNavigationEntry* BrowserNavigationController::GetEntryWithPageID( return (index != -1) ? entries_[index].get() : NULL; } -void BrowserNavigationController::DidNavigateToEntry(BrowserNavigationEntry* entry) { +void BrowserNavigationController::DidNavigateToEntry( + BrowserNavigationEntry* entry) { // If the entry is that of a page with PageID larger than any this Tab has // seen before, then consider it a new navigation. if (entry->GetPageID() > GetMaxPageID()) { @@ -218,7 +220,8 @@ int BrowserNavigationController::GetEntryIndexWithPageID(int32 page_id) const { return -1; } -void BrowserNavigationController::NavigateToPendingEntry(bool reload, bool ignoreCache) { +void BrowserNavigationController::NavigateToPendingEntry(bool reload, + bool ignoreCache) { // For session history navigations only the pending_entry_index_ is set. if (!pending_entry_) { DCHECK(pending_entry_index_ != -1); diff --git a/libcef/browser_webkit_glue.cc b/libcef/browser_webkit_glue.cc index 5aba80306..be80d8fa0 100644 --- a/libcef/browser_webkit_glue.cc +++ b/libcef/browser_webkit_glue.cc @@ -97,6 +97,30 @@ v8::Handle GetV8Context(WebKit::WebFrame* frame) return WebCore::V8Proxy::context(core_frame); } +FrameLoadType GetFrameLoadType(WebKit::WebFrame* frame) +{ + WebFrameImpl* webFrameImpl = static_cast(frame); + WebCore::FrameLoader* loader = webFrameImpl->frame()->loader(); + switch(loader->loadType()) { + case WebCore::FrameLoadTypeStandard: + return FLT_STANDARD; + case WebCore::FrameLoadTypeForward: + case WebCore::FrameLoadTypeBack: + case WebCore::FrameLoadTypeBackWMLDeckNotAccessible: + case WebCore::FrameLoadTypeIndexedBackForward: + return FLT_HISTORY; + case WebCore::FrameLoadTypeRedirectWithLockedBackForwardList: + return FLT_REDIRECT; + case WebCore::FrameLoadTypeReload: + case WebCore::FrameLoadTypeReloadFromOrigin: + case WebCore::FrameLoadTypeSame: + case WebCore::FrameLoadTypeReplace: + return FLT_RELOAD; + } + + return FLT_UNKNOWN; +} + void CloseIdleConnections() { // Used in benchmarking, Ignored for CEF. } diff --git a/libcef/browser_webkit_glue.h b/libcef/browser_webkit_glue.h index 6524c9148..3349c7614 100644 --- a/libcef/browser_webkit_glue.h +++ b/libcef/browser_webkit_glue.h @@ -39,6 +39,17 @@ base::StringPiece NetResourceProvider(int key); // Retrieve the V8 context associated with the frame. v8::Handle GetV8Context(WebKit::WebFrame* frame); +enum FrameLoadType { + FLT_UNKNOWN = 0, + FLT_STANDARD, + FLT_HISTORY, + FLT_REDIRECT, + FLT_RELOAD, +}; + +// Returns the frame load type. +FrameLoadType GetFrameLoadType(WebKit::WebFrame* frame); + // Clear all cached data. void ClearCache(); diff --git a/libcef/browser_webview_delegate.cc b/libcef/browser_webview_delegate.cc index 9530b1237..8627473d1 100644 --- a/libcef/browser_webview_delegate.cc +++ b/libcef/browser_webview_delegate.cc @@ -718,12 +718,13 @@ void BrowserWebViewDelegate::didCommitProvisionalLoad( // New navigations will be the main content. is_main_content_ = true; } else { - // Session history navigations will be the main content. - BrowserExtraData* extra_data = static_cast( - frame->dataSource()->extraData()); - if (extra_data && extra_data->pending_page_id != -1 && - !extra_data->request_committed) + // Session history navigations and reloads will be the main content. + webkit_glue::FrameLoadType load_type = + webkit_glue::GetFrameLoadType(frame); + if (load_type == webkit_glue::FLT_HISTORY || + load_type == webkit_glue::FLT_RELOAD) { is_main_content_ = true; + } } if (is_main_content_) {