diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-02-15 14:57:23 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-02-17 09:12:12 +0100 |
commit | cd12379d43f8c2df14b19ebced316aa94b3f6043 (patch) | |
tree | f8ff1ac93a1a5502e60c243c32c54f80b1bd332d /src/core/web_contents_adapter.cpp | |
parent | 4e6e907001d4cf0833465407f8a0fa68e6ce564b (diff) | |
parent | 4c94370394ccf1e00233669df01599cb6141a5dc (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Idee0142b0e33fdf8ca663f1ef1bcd8b932985043
Diffstat (limited to 'src/core/web_contents_adapter.cpp')
-rw-r--r-- | src/core/web_contents_adapter.cpp | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 61c6368f6..014fb6482 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -61,6 +61,7 @@ #include "web_engine_settings.h" #include "base/command_line.h" +#include "base/metrics/user_metrics.h" #include "base/run_loop.h" #include "base/task/current_thread.h" #include "base/task/post_task.h" @@ -604,8 +605,9 @@ bool WebContentsAdapter::canGoToOffset(int offset) const void WebContentsAdapter::stop() { CHECK_INITIALIZED(); - content::NavigationController& controller = m_webContents->GetController(); + base::RecordAction(base::UserMetricsAction("Stop")); + content::NavigationController& controller = m_webContents->GetController(); int index = controller.GetPendingEntryIndex(); if (index != -1) controller.RemoveEntryAtIndex(index); @@ -617,6 +619,8 @@ void WebContentsAdapter::stop() void WebContentsAdapter::reload() { CHECK_INITIALIZED(); + base::RecordAction(base::UserMetricsAction("Reload")); + bool wasDiscarded = (m_lifecycleState == LifecycleState::Discarded); setLifecycleState(LifecycleState::Active); CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost()); @@ -630,6 +634,8 @@ void WebContentsAdapter::reload() void WebContentsAdapter::reloadAndBypassCache() { CHECK_INITIALIZED(); + base::RecordAction(base::UserMetricsAction("ReloadBypassingCache")); + bool wasDiscarded = (m_lifecycleState == LifecycleState::Discarded); setLifecycleState(LifecycleState::Active); CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost()); @@ -654,6 +660,7 @@ void WebContentsAdapter::load(const QUrl &url) void WebContentsAdapter::load(const QWebEngineHttpRequest &request) { + base::RecordAction(base::UserMetricsAction("LoadURL")); GURL gurl = toGurl(request.url()); if (!isInitialized()) { scoped_refptr<content::SiteInstance> site = @@ -707,9 +714,10 @@ void WebContentsAdapter::load(const QWebEngineHttpRequest &request) // chromium accepts LOAD_TYPE_HTTP_POST only for the HTTP and HTTPS protocols if (!params.url.SchemeIsHTTPOrHTTPS()) { m_adapterClient->loadFinished(false, request.url(), false, - net::ERR_DISALLOWED_URL_SCHEME, - QCoreApplication::translate("WebContentsAdapter", - "HTTP-POST data can only be sent over HTTP(S) protocol")); + net::ERR_DISALLOWED_URL_SCHEME, + QCoreApplication::translate("WebContentsAdapter", + "HTTP-POST data can only be sent over HTTP(S) protocol"), + false); return; } params.post_data = network::ResourceRequestBody::CreateFromBytes( @@ -764,7 +772,7 @@ void WebContentsAdapter::setContent(const QByteArray &data, const QString &mimeT GURL dataUrlToLoad(urlString); if (dataUrlToLoad.spec().size() > url::kMaxURLChars) { - m_adapterClient->loadFinished(false, baseUrl, false, net::ERR_ABORTED); + m_adapterClient->loadFinished(false, baseUrl, false, net::ERR_ABORTED, QString(), false); return; } content::NavigationController::LoadURLParams params((dataUrlToLoad)); @@ -780,6 +788,7 @@ void WebContentsAdapter::setContent(const QByteArray &data, const QString &mimeT void WebContentsAdapter::save(const QString &filePath, int savePageFormat) { CHECK_INITIALIZED(); + base::RecordAction(base::UserMetricsAction("SavePage")); m_webContentsDelegate->setSavePageInfo(SavePageInfo(filePath, savePageFormat)); m_webContents->OnSavePage(); } @@ -834,42 +843,49 @@ QString WebContentsAdapter::selectedText() const void WebContentsAdapter::undo() { CHECK_INITIALIZED(); + base::RecordAction(base::UserMetricsAction("Undo")); m_webContents->Undo(); } void WebContentsAdapter::redo() { CHECK_INITIALIZED(); + base::RecordAction(base::UserMetricsAction("Redo")); m_webContents->Redo(); } void WebContentsAdapter::cut() { CHECK_INITIALIZED(); + base::RecordAction(base::UserMetricsAction("Cut")); m_webContents->Cut(); } void WebContentsAdapter::copy() { CHECK_INITIALIZED(); + base::RecordAction(base::UserMetricsAction("Copy")); m_webContents->Copy(); } void WebContentsAdapter::paste() { CHECK_INITIALIZED(); + base::RecordAction(base::UserMetricsAction("Paste")); m_webContents->Paste(); } void WebContentsAdapter::pasteAndMatchStyle() { CHECK_INITIALIZED(); + base::RecordAction(base::UserMetricsAction("PasteAndMatchStyle")); m_webContents->PasteAndMatchStyle(); } void WebContentsAdapter::selectAll() { CHECK_INITIALIZED(); + base::RecordAction(base::UserMetricsAction("SelectAll")); m_webContents->SelectAll(); } @@ -888,6 +904,7 @@ void WebContentsAdapter::unselect() void WebContentsAdapter::navigateBack() { CHECK_INITIALIZED(); + base::RecordAction(base::UserMetricsAction("Back")); CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost()); if (!m_webContents->GetController().CanGoBack()) return; @@ -898,6 +915,7 @@ void WebContentsAdapter::navigateBack() void WebContentsAdapter::navigateForward() { CHECK_INITIALIZED(); + base::RecordAction(base::UserMetricsAction("Forward")); CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost()); if (!m_webContents->GetController().CanGoForward()) return; @@ -1283,12 +1301,14 @@ void WebContentsAdapter::devToolsFrontendDestroyed(DevToolsFrontendQt *frontend) void WebContentsAdapter::exitFullScreen() { CHECK_INITIALIZED(); + base::RecordAction(base::UserMetricsAction("ToggleFullscreen")); m_webContents->ExitFullscreen(false); } void WebContentsAdapter::changedFullScreen() { CHECK_INITIALIZED(); + base::RecordAction(base::UserMetricsAction("ToggleFullscreen")); m_webContents->NotifyFullscreenChanged(false); } @@ -1792,6 +1812,7 @@ FindTextHelper *WebContentsAdapter::findTextHelper() void WebContentsAdapter::viewSource() { CHECK_INITIALIZED(); + base::RecordAction(base::UserMetricsAction("ViewSource")); m_webContents->GetMainFrame()->ViewSource(); } |