diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2021-02-01 18:10:23 +0100 |
---|---|---|
committer | Peter Varga <pvarga@inf.u-szeged.hu> | 2021-02-04 08:39:41 +0100 |
commit | 30ccee84327bd7d8156f1a4203bca23858c8defa (patch) | |
tree | 01ff9f0b7cdfced6c31cbb14ea43e6fe29639269 /src/core | |
parent | 10d30914e9c5e911492e690e4fba4dedaf0b6796 (diff) |
Enable chrome://user-actions WebUI
Also record some actions in WebContentsAdapter. The list is far from
complete but these seemed obvious.
Change-Id: I7dcddeef416efd6fb26618381a83d2b132b98d83
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/net/webui_controller_factory_qt.cpp | 7 | ||||
-rw-r--r-- | src/core/qtwebengine_sources.gni | 4 | ||||
-rw-r--r-- | src/core/web_contents_adapter.cpp | 22 |
3 files changed, 29 insertions, 4 deletions
diff --git a/src/core/net/webui_controller_factory_qt.cpp b/src/core/net/webui_controller_factory_qt.cpp index c6d50a447..d434ebe11 100644 --- a/src/core/net/webui_controller_factory_qt.cpp +++ b/src/core/net/webui_controller_factory_qt.cpp @@ -50,6 +50,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/devtools_ui.h" #include "chrome/browser/ui/webui/quota_internals/quota_internals_ui.h" +#include "chrome/browser/ui/webui/user_actions/user_actions_ui.h" #include "chrome/common/url_constants.h" #include "content/public/browser/web_ui.h" #include "content/public/common/url_utils.h" @@ -67,7 +68,6 @@ // or doesn't work, but would be interesting for us if they did: // #include "chrome/browser/ui/webui/inspect_ui.h" -// #include "chrome/browser/ui/webui/user_actions/user_actions_ui.h" // #if BUILDFLAG(ENABLE_WEBRTC) // #include "chrome/browser/ui/webui/media/webrtc_logs_ui.h" @@ -132,8 +132,9 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI *web_ui, Profile *profile, co if (url.host() == chrome::kChromeUIAccessibilityHost) return &NewWebUI<AccessibilityUI>; -// if (url.host_piece() == chrome::kChromeUIUserActionsHost) -// return &NewWebUI<UserActionsUI>; + if (url.host_piece() == chrome::kChromeUIUserActionsHost) + return &NewWebUI<UserActionsUI>; + // if (url.host_piece() == chrome::kChromeUIInspectHost) // return &NewWebUI<InspectUI>; // diff --git a/src/core/qtwebengine_sources.gni b/src/core/qtwebengine_sources.gni index 418638536..c715b6432 100644 --- a/src/core/qtwebengine_sources.gni +++ b/src/core/qtwebengine_sources.gni @@ -85,6 +85,10 @@ source_set("qtwebengine_sources") { "//chrome/browser/ui/webui/quota_internals/quota_internals_types.h", "//chrome/browser/ui/webui/quota_internals/quota_internals_ui.cc", "//chrome/browser/ui/webui/quota_internals/quota_internals_ui.h", + "//chrome/browser/ui/webui/user_actions/user_actions_ui.cc", + "//chrome/browser/ui/webui/user_actions/user_actions_ui.h", + "//chrome/browser/ui/webui/user_actions/user_actions_ui_handler.cc", + "//chrome/browser/ui/webui/user_actions/user_actions_ui_handler.h", "//chrome/common/custom_handlers/protocol_handler.cc", "//chrome/common/custom_handlers/protocol_handler.h", "//chrome/common/chrome_switches.cc", diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 6eff8e9ad..a5473372d 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" @@ -602,8 +603,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); @@ -615,6 +617,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()); @@ -628,6 +632,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()); @@ -652,6 +658,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 = @@ -780,6 +787,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 +842,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 +903,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 +914,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; @@ -1284,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); } @@ -1793,6 +1812,7 @@ FindTextHelper *WebContentsAdapter::findTextHelper() void WebContentsAdapter::viewSource() { CHECK_INITIALIZED(); + base::RecordAction(base::UserMetricsAction("ViewSource")); m_webContents->GetMainFrame()->ViewSource(); } |