diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/web_contents_adapter_client.h | 1 | ||||
-rw-r--r-- | src/core/web_contents_delegate_qt.cpp | 23 | ||||
-rw-r--r-- | src/core/web_contents_delegate_qt.h | 1 |
3 files changed, 16 insertions, 9 deletions
diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h index 6fd29ec61..514d3afb4 100644 --- a/src/core/web_contents_adapter_client.h +++ b/src/core/web_contents_adapter_client.h @@ -465,6 +465,7 @@ public: virtual void selectClientCert(const QSharedPointer<ClientCertSelectController> &selectController) = 0; virtual void updateScrollPosition(const QPointF &position) = 0; virtual void updateContentsSize(const QSizeF &size) = 0; + virtual void updateNavigationActions() = 0; virtual void startDragging(const content::DropData &dropData, Qt::DropActions allowedActions, const QPixmap &pixmap, const QPoint &offset) = 0; virtual bool supportsDragging() const = 0; 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(); } } diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index 124250a40..966494ec7 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -159,6 +159,7 @@ private: QWeakPointer<WebContentsAdapter> createWindow(std::unique_ptr<content::WebContents> new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture); void EmitLoadStarted(const QUrl &url, bool isErrorPage = false); void EmitLoadFinished(bool success, const QUrl &url, bool isErrorPage = false, int errorCode = 0, const QString &errorDescription = QString()); + void EmitLoadCommitted(); WebContentsAdapterClient *m_viewClient; QString m_lastSearchedString; |