summaryrefslogtreecommitdiffstats
path: root/src/core/web_contents_delegate_qt.cpp
diff options
context:
space:
mode:
authorSzabolcs David <davidsz@inf.u-szeged.hu>2018-09-25 12:57:35 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-10-23 21:20:43 +0000
commit80d73da6e89dc06e2d4a16df14df3e2a1119cce1 (patch)
treef36730f95492761434f264f58a114835a72e107f /src/core/web_contents_delegate_qt.cpp
parent5b865551348e695187f4d7c3bbcd77ebd8736248 (diff)
Unify updating navigation actions
On the Quick side, navigation actions were dependent on the context menu. They were only updated when requesting a new context menu and this is obviously wrong if an action is tied to a button or another type of UI element. Change-Id: I5f14b019b66215f16d027fb57d76f052b1604365 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/web_contents_delegate_qt.cpp')
-rw-r--r--src/core/web_contents_delegate_qt.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index 569b939d8..9472c0be9 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -263,6 +263,7 @@ void WebContentsDelegateQt::EmitLoadStarted(const QUrl &url, bool isErrorPage)
if (m_lastLoadProgress >= 0 && m_lastLoadProgress < 100) // already running
return;
m_viewClient->loadStarted(url, isErrorPage);
+ m_viewClient->updateNavigationActions();
m_viewClient->loadProgressChanged(0);
m_lastLoadProgress = 0;
}
@@ -287,6 +288,16 @@ void WebContentsDelegateQt::EmitLoadFinished(bool success, const QUrl &url, bool
m_lastLoadProgress = -1;
m_viewClient->loadProgressChanged(100);
m_viewClient->loadFinished(success, url, isErrorPage, errorCode, errorDescription);
+ m_viewClient->updateNavigationActions();
+}
+
+void WebContentsDelegateQt::EmitLoadCommitted()
+{
+ // Make sure that we don't set the findNext WebFindOptions on a new frame.
+ m_lastSearchedString = QString();
+
+ m_viewClient->loadCommitted();
+ m_viewClient->updateNavigationActions();
}
void WebContentsDelegateQt::DidFinishNavigation(content::NavigationHandle *navigation_handle)
@@ -302,11 +313,7 @@ void WebContentsDelegateQt::DidFinishNavigation(content::NavigationHandle *navig
profileAdapter->visitedLinksManager()->addUrl(url);
}
- // Make sure that we don't set the findNext WebFindOptions on a new frame.
- m_lastSearchedString = QString();
-
- // This is currently used for canGoBack/Forward values, which is flattened across frames. For other purposes we might have to pass is_main_frame.
- m_viewClient->loadCommitted();
+ EmitLoadCommitted();
}
// Success is reported by DidFinishLoad, but DidFailLoad is now dead code and needs to be handled below
if (navigation_handle->GetNetErrorCode() == net::OK)
@@ -325,10 +332,8 @@ void WebContentsDelegateQt::DidFinishNavigation(content::NavigationHandle *navig
EmitLoadStarted(toQt(GURL(content::kUnreachableWebDataURL)), true);
// If it is already committed we will not see another DidFinishNavigation call or a DidFinishLoad call.
- if (navigation_handle->HasCommitted()) {
- m_lastSearchedString = QString();
- m_viewClient->loadCommitted();
- }
+ if (navigation_handle->HasCommitted())
+ EmitLoadCommitted();
}
}