Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
- index a997c53d..7d5589b9 100644
- --- a/src/core/web_contents_delegate_qt.cpp
- +++ b/src/core/web_contents_delegate_qt.cpp
- @@ -61,6 +61,9 @@
- #include "components/web_cache/browser/web_cache_manager.h"
- #include "content/browser/renderer_host/render_widget_host_impl.h"
- +#include "content/public/browser/browser_context.h".h"
- +#include "content/public/browser/download_manager.h"
- +#include "content/public/browser/download_item.h"
- #include "content/public/browser/invalidate_type.h"
- #include "content/public/browser/navigation_entry.h"
- #include "content/public/browser/navigation_handle.h"
- @@ -147,16 +150,29 @@ void WebContentsDelegateQt::NavigationStateChanged(content::WebContents* source,
- bool WebContentsDelegateQt::ShouldPreserveAbortedURLs(content::WebContents *source)
- {
- - Q_UNUSED(source)
- -
- - // Allow failed URLs to stick around in the URL bar, but only when the error-page is enabled.
- WebEngineSettings *settings = m_viewClient->webEngineSettings();
- bool isErrorPageEnabled = settings->testAttribute(settings->Attribute::ErrorPageEnabled);
- - if (isErrorPageEnabled)
- - return true;
- + // TODO: Comment
- + if (!isErrorPageEnabled)
- + return false;
- - return false;
- + const content::NavigationController &controller = source->GetController();
- + content::NavigationEntry *pending_entry = controller.GetPendingEntry();
- +
- + // TODO: Comment
- + if (pending_entry) {
- + content::DownloadManager *downloadManager = content::BrowserContext::GetDownloadManager(source->GetBrowserContext());
- + content::DownloadManager::DownloadVector downloadItems;
- + downloadManager->GetAllDownloads(&downloadItems);
- +
- + for (content::DownloadItem *downloadItem : downloadItems) {
- + if (downloadItem->GetState() != content::DownloadItem::COMPLETE && downloadItem->GetURL() == pending_entry->GetURL())
- + return false;
- + }
- + }
- +
- + return true;
- }
- void WebContentsDelegateQt::AddNewContents(content::WebContents* source, content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture, bool* was_blocked)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement