summaryrefslogtreecommitdiffstats
path: root/src/core/web_contents_adapter.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-06-03 16:01:24 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-09-09 15:19:07 +0200
commitcd61343ceb4a3de8ce16082917a2f197b2481d08 (patch)
treeae88767edf6b3dc07b8dcf54c97a779eb2812768 /src/core/web_contents_adapter.cpp
parentfc3893ea80296bd17e1797d5caf4479e0be4afd1 (diff)
Chromium 81-based adaptations
Change-Id: Ie422b327025da084bc8038c7a0aadee2db801f29 Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
Diffstat (limited to 'src/core/web_contents_adapter.cpp')
-rw-r--r--src/core/web_contents_adapter.cpp26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index ef482ef08..e3b1c2439 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -66,6 +66,8 @@
#include "base/task/sequence_manager/sequence_manager_impl.h"
#include "base/task/sequence_manager/thread_controller_with_message_pump_impl.h"
#include "base/values.h"
+#include "chrome/browser/tab_contents/form_interaction_tab_helper.h"
+#include "components/performance_manager/embedder/performance_manager_registry.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/text_input_manager.h"
#include "content/browser/web_contents/web_contents_impl.h"
@@ -86,9 +88,9 @@
#include "content/public/common/url_constants.h"
#include "content/public/common/web_preferences.h"
#include "extensions/buildflags/buildflags.h"
-#include "third_party/blink/public/common/media/media_player_action.h"
#include "third_party/blink/public/common/page/page_zoom.h"
#include "third_party/blink/public/common/peerconnection/webrtc_ip_handling_policy.h"
+#include "third_party/blink/public/mojom/frame/media_player_action.mojom.h"
#include "printing/buildflags/buildflags.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/clipboard/clipboard_constants.h"
@@ -525,6 +527,9 @@ void WebContentsAdapter::initialize(content::SiteInstance *site)
#if BUILDFLAG(ENABLE_EXTENSIONS)
extensions::ExtensionWebContentsObserverQt::CreateForWebContents(webContents());
#endif
+ FormInteractionTabHelper::CreateForWebContents(webContents());
+ if (auto *performance_manager_registry = performance_manager::PerformanceManagerRegistry::GetInstance())
+ performance_manager_registry->CreatePageNodeForWebContents(webContents());
// Create an instance of WebEngineVisitedLinksManager to catch the first
// content::NOTIFICATION_RENDERER_PROCESS_CREATED event. This event will
@@ -1185,22 +1190,22 @@ void WebContentsAdapter::copyImageAt(const QPoint &location)
m_webContents->GetRenderViewHost()->GetMainFrame()->CopyImageAt(location.x(), location.y());
}
-static blink::MediaPlayerAction::Type toBlinkMediaPlayerActionType(WebContentsAdapter::MediaPlayerAction action)
+static blink::mojom::MediaPlayerActionType toBlinkMediaPlayerActionType(WebContentsAdapter::MediaPlayerAction action)
{
switch (action) {
case WebContentsAdapter::MediaPlayerPlay:
- return blink::MediaPlayerAction::Type::kPlay;
+ return blink::mojom::MediaPlayerActionType::kPlay;
case WebContentsAdapter::MediaPlayerMute:
- return blink::MediaPlayerAction::Type::kMute;
+ return blink::mojom::MediaPlayerActionType::kMute;
case WebContentsAdapter::MediaPlayerLoop:
- return blink::MediaPlayerAction::Type::kLoop;
+ return blink::mojom::MediaPlayerActionType::kLoop;
case WebContentsAdapter::MediaPlayerControls:
- return blink::MediaPlayerAction::Type::kControls;
+ return blink::mojom::MediaPlayerActionType::kControls;
case WebContentsAdapter::MediaPlayerNoAction:
break;
}
NOTREACHED();
- return (blink::MediaPlayerAction::Type)-1;
+ return (blink::mojom::MediaPlayerActionType)-1;
}
void WebContentsAdapter::executeMediaPlayerActionAt(const QPoint &location, MediaPlayerAction action, bool enable)
@@ -1208,7 +1213,7 @@ void WebContentsAdapter::executeMediaPlayerActionAt(const QPoint &location, Medi
CHECK_INITIALIZED();
if (action == MediaPlayerNoAction)
return;
- blink::MediaPlayerAction blinkAction(toBlinkMediaPlayerActionType(action), enable);
+ blink::mojom::MediaPlayerAction blinkAction(toBlinkMediaPlayerActionType(action), enable);
m_webContents->GetRenderViewHost()->GetMainFrame()->ExecuteMediaPlayerActionAtLocation(toGfx(location), blinkAction);
}
@@ -1893,7 +1898,7 @@ WebContentsAdapter::LifecycleState WebContentsAdapter::determineRecommendedState
return LifecycleState::Frozen;
// Form input is not saved.
- if (m_webContents->GetPageImportanceSignals().had_form_interaction)
+ if (FormInteractionTabHelper::FromWebContents(m_webContents.get())->had_form_interaction())
return LifecycleState::Frozen;
// Do not discard PDFs as they might contain entry that is not saved and they
@@ -2001,6 +2006,9 @@ void WebContentsAdapter::discard()
#if BUILDFLAG(ENABLE_EXTENSIONS)
extensions::ExtensionWebContentsObserverQt::CreateForWebContents(webContents());
#endif
+ FormInteractionTabHelper::CreateForWebContents(webContents());
+ if (auto *performance_manager_registry = performance_manager::PerformanceManagerRegistry::GetInstance())
+ performance_manager_registry->CreatePageNodeForWebContents(webContents());
}
void WebContentsAdapter::undiscard()