summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-01-22 10:55:57 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-01-25 15:41:53 +0100
commitcde72003881c6b5680ac8ac0fe6d6971bb43e0d5 (patch)
treefcb50002765c1cb179dd6f62054380c3fed85e80 /src/core
parent3fb215dab139fd7b61473ce3fe1058b87a6b4fe3 (diff)
parent75d061bbc68875c08b3dc243e464e32a80da71df (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Including update to 87-based Change-Id: I36b6054e00de97ab055d0bc800cff08d0408fac6
Diffstat (limited to 'src/core')
-rw-r--r--src/core/accessibility_tree_formatter_qt.cpp53
-rw-r--r--src/core/api/core_api.pro1
-rw-r--r--src/core/api/qwebengineprofile.cpp11
-rw-r--r--src/core/browser_accessibility_manager_qt.cpp10
-rw-r--r--src/core/browser_accessibility_manager_qt.h7
-rw-r--r--src/core/browser_accessibility_qt.cpp34
-rw-r--r--src/core/browser_accessibility_qt.h4
-rw-r--r--src/core/browser_main_parts_qt.cpp11
-rw-r--r--src/core/browser_message_filter_qt.cpp99
-rw-r--r--src/core/browser_message_filter_qt.h57
-rw-r--r--src/core/browsing_data_remover_delegate_qt.cpp15
-rw-r--r--src/core/browsing_data_remover_delegate_qt.h7
-rw-r--r--src/core/chromium_overrides.cpp6
-rw-r--r--src/core/clipboard_qt.cpp91
-rw-r--r--src/core/clipboard_qt.h48
-rw-r--r--src/core/common/extensions/api/qtwebengine_extensions_features.gni4
-rw-r--r--src/core/common/extensions/extensions_api_provider_qt.cpp21
-rw-r--r--src/core/common/extensions/extensions_client_qt.cpp12
-rw-r--r--src/core/common/extensions/extensions_client_qt.h10
-rw-r--r--src/core/common/qt_messages.h41
-rw-r--r--src/core/config/common.pri9
-rw-r--r--src/core/config/linux.pri5
-rw-r--r--src/core/config/windows.pri3
-rw-r--r--src/core/configure.json15
-rw-r--r--src/core/content_browser_client_qt.cpp163
-rw-r--r--src/core/content_browser_client_qt.h58
-rw-r--r--src/core/content_client_qt.cpp7
-rw-r--r--src/core/content_main_delegate_qt.cpp11
-rw-r--r--src/core/core_chromium.pri4
-rw-r--r--src/core/core_module.pro6
-rw-r--r--src/core/desktop_screen_qt.cpp68
-rw-r--r--src/core/desktop_screen_qt.h23
-rw-r--r--src/core/devtools_frontend_qt.cpp4
-rw-r--r--src/core/download_manager_delegate_qt.cpp3
-rw-r--r--src/core/extensions/component_extension_resource_manager_qt.h1
-rw-r--r--src/core/extensions/extension_host_delegate_qt.cpp125
-rw-r--r--src/core/extensions/extension_host_delegate_qt.h77
-rw-r--r--src/core/extensions/extension_system_qt.cpp69
-rw-r--r--src/core/extensions/extension_system_qt.h16
-rw-r--r--src/core/extensions/extensions_api_client_qt.cpp11
-rw-r--r--src/core/extensions/extensions_api_client_qt.h6
-rw-r--r--src/core/extensions/extensions_browser_client_qt.cpp92
-rw-r--r--src/core/extensions/extensions_browser_client_qt.h3
-rw-r--r--src/core/extensions/messaging_delegate_qt.cpp56
-rw-r--r--src/core/extensions/messaging_delegate_qt.h66
-rw-r--r--src/core/file_picker_controller.cpp42
-rw-r--r--src/core/file_picker_controller.h18
-rw-r--r--src/core/find_text_helper.cpp2
-rw-r--r--src/core/location_provider_qt.cpp1
-rw-r--r--src/core/location_provider_qt.h4
-rw-r--r--src/core/media_capture_devices_dispatcher.cpp9
-rw-r--r--src/core/media_capture_devices_dispatcher.h2
-rw-r--r--src/core/net/client_cert_override.cpp6
-rw-r--r--src/core/net/cookie_monster_delegate_qt.cpp9
-rw-r--r--src/core/net/cookie_monster_delegate_qt.h2
-rw-r--r--src/core/net/custom_url_loader_factory.cpp29
-rw-r--r--src/core/net/custom_url_loader_factory.h4
-rw-r--r--src/core/net/proxying_restricted_cookie_manager_qt.cpp2
-rw-r--r--src/core/net/proxying_url_loader_factory_qt.cpp13
-rw-r--r--src/core/net/system_network_context_manager.cpp37
-rw-r--r--src/core/net/system_network_context_manager.h4
-rw-r--r--src/core/ozone/gl_share_context_qt.cpp2
-rw-r--r--src/core/ozone/gl_share_context_qt.h4
-rw-r--r--src/core/ozone/gl_surface_egl_qt.cpp19
-rw-r--r--src/core/ozone/gl_surface_glx_qt.cpp14
-rw-r--r--src/core/ozone/gl_surface_glx_qt.h4
-rw-r--r--src/core/ozone/gl_surface_qt.cpp8
-rw-r--r--src/core/ozone/ozone_platform_qt.cpp10
-rw-r--r--src/core/permission_manager_qt.cpp5
-rw-r--r--src/core/pref_service_adapter.cpp6
-rw-r--r--src/core/printing/print_view_manager_base_qt.cpp185
-rw-r--r--src/core/printing/print_view_manager_base_qt.h107
-rw-r--r--src/core/printing/print_view_manager_qt.cpp41
-rw-r--r--src/core/printing/print_view_manager_qt.h29
-rw-r--r--src/core/printing/printing_message_filter_qt.cpp101
-rw-r--r--src/core/printing/printing_message_filter_qt.h39
-rw-r--r--src/core/process_main.cpp6
-rw-r--r--src/core/profile_adapter.cpp1
-rw-r--r--src/core/profile_io_data_qt.cpp24
-rw-r--r--src/core/profile_io_data_qt.h8
-rw-r--r--src/core/qtwebengine.gni2
-rw-r--r--src/core/qtwebengine_sources.gni7
-rw-r--r--src/core/quota_permission_context_qt.cpp18
-rw-r--r--src/core/quota_permission_context_qt.h2
-rw-r--r--src/core/quota_request_controller_impl.cpp7
-rw-r--r--src/core/render_widget_host_view_qt.cpp94
-rw-r--r--src/core/render_widget_host_view_qt.h36
-rw-r--r--src/core/render_widget_host_view_qt_delegate_client.cpp30
-rw-r--r--src/core/renderer/content_renderer_client_qt.cpp36
-rw-r--r--src/core/renderer/content_renderer_client_qt.h8
-rw-r--r--src/core/renderer/content_settings_observer_qt.cpp66
-rw-r--r--src/core/renderer/content_settings_observer_qt.h13
-rw-r--r--src/core/renderer/extensions/extensions_dispatcher_delegate_qt.cpp9
-rw-r--r--src/core/renderer/extensions/extensions_dispatcher_delegate_qt.h3
-rw-r--r--src/core/renderer/extensions/extensions_renderer_client_qt.cpp12
-rw-r--r--src/core/renderer/extensions/extensions_renderer_client_qt.h4
-rw-r--r--src/core/renderer/render_frame_observer_qt.cpp2
-rw-r--r--src/core/renderer/render_frame_observer_qt.h2
-rw-r--r--src/core/renderer/user_resource_controller.cpp14
-rw-r--r--src/core/renderer_host/pepper/pepper_flash_browser_host_qt.cpp4
-rw-r--r--src/core/resource_bundle_qt.cpp12
-rw-r--r--src/core/touch_selection_controller_client_qt.cpp20
-rw-r--r--src/core/type_conversion.cpp15
-rw-r--r--src/core/type_conversion.h56
-rw-r--r--src/core/user_script.cpp4
-rw-r--r--src/core/web_contents_adapter.cpp89
-rw-r--r--src/core/web_contents_adapter.h9
-rw-r--r--src/core/web_contents_delegate_qt.cpp49
-rw-r--r--src/core/web_contents_delegate_qt.h25
-rw-r--r--src/core/web_contents_view_qt.cpp56
-rw-r--r--src/core/web_contents_view_qt.h17
-rw-r--r--src/core/web_engine_context.cpp13
-rw-r--r--src/core/web_engine_library_info.cpp21
-rw-r--r--src/core/web_engine_settings.cpp26
-rw-r--r--src/core/web_engine_settings.h11
-rw-r--r--src/core/web_event_factory.cpp38
116 files changed, 1696 insertions, 1374 deletions
diff --git a/src/core/accessibility_tree_formatter_qt.cpp b/src/core/accessibility_tree_formatter_qt.cpp
index 081856b37..51d33534b 100644
--- a/src/core/accessibility_tree_formatter_qt.cpp
+++ b/src/core/accessibility_tree_formatter_qt.cpp
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#include "content/browser/accessibility/accessibility_tree_formatter_browser.h"
+#include "content/browser/accessibility/accessibility_tree_formatter_base.h"
#include <utility>
@@ -53,19 +53,26 @@
namespace content {
#if QT_CONFIG(accessibility)
-class AccessibilityTreeFormatterQt : public AccessibilityTreeFormatterBrowser {
+class AccessibilityTreeFormatterQt : public AccessibilityTreeFormatterBase {
public:
explicit AccessibilityTreeFormatterQt();
~AccessibilityTreeFormatterQt() override;
+ std::unique_ptr<base::DictionaryValue> BuildAccessibilityTreeForSelector(const content::AccessibilityTreeFormatter::TreeSelector &)
+ { return nullptr; }
+ std::unique_ptr<base::DictionaryValue> BuildAccessibilityTreeForWindow(gfx::AcceleratedWidget) override { return nullptr; }
+ std::unique_ptr<base::DictionaryValue> BuildAccessibilityTree(content::BrowserAccessibility *) override;
+
private:
base::FilePath::StringType GetExpectedFileSuffix() override;
const std::string GetAllowEmptyString() override;
const std::string GetAllowString() override;
const std::string GetDenyString() override;
const std::string GetDenyNodeString() override;
- void AddProperties(const BrowserAccessibility &node, base::DictionaryValue* dict) override;
- base::string16 ProcessTreeForOutput(const base::DictionaryValue &node, base::DictionaryValue * = nullptr) override;
+ const std::string GetRunUntilEventString() override;
+ void RecursiveBuildAccessibilityTree(const content::BrowserAccessibility &node, base::DictionaryValue *dict) const;
+ void AddProperties(const BrowserAccessibility &node, base::DictionaryValue *dict) const;
+ std::string ProcessTreeForOutput(const base::DictionaryValue &node, base::DictionaryValue * = nullptr) override;
};
AccessibilityTreeFormatterQt::AccessibilityTreeFormatterQt()
@@ -76,7 +83,30 @@ AccessibilityTreeFormatterQt::~AccessibilityTreeFormatterQt()
{
}
-void AccessibilityTreeFormatterQt::AddProperties(const BrowserAccessibility &node, base::DictionaryValue *dict)
+std::unique_ptr<base::DictionaryValue> AccessibilityTreeFormatterQt::BuildAccessibilityTree(content::BrowserAccessibility *root)
+{
+ std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
+ RecursiveBuildAccessibilityTree(*root, dict.get());
+ return dict;
+}
+
+void AccessibilityTreeFormatterQt::RecursiveBuildAccessibilityTree(const BrowserAccessibility &node, base::DictionaryValue *dict) const
+{
+ AddProperties(node, dict);
+
+ auto children = std::make_unique<base::ListValue>();
+ for (size_t i = 0; i < node.PlatformChildCount(); ++i) {
+ std::unique_ptr<base::DictionaryValue> child_dict(new base::DictionaryValue);
+
+ content::BrowserAccessibility *child_node = node.PlatformGetChild(i);
+
+ RecursiveBuildAccessibilityTree(*child_node, child_dict.get());
+ children->Append(std::move(child_dict));
+ }
+ dict->Set(kChildrenDictAttr, std::move(children));
+}
+
+void AccessibilityTreeFormatterQt::AddProperties(const BrowserAccessibility &node, base::DictionaryValue *dict) const
{
dict->SetInteger("id", node.GetId());
const BrowserAccessibilityQt *acc_node = ToBrowserAccessibilityQt(&node);
@@ -142,13 +172,13 @@ void AccessibilityTreeFormatterQt::AddProperties(const BrowserAccessibility &nod
dict->SetString("description", acc_node->text(QAccessible::Description).toStdString());
}
-base::string16 AccessibilityTreeFormatterQt::ProcessTreeForOutput(const base::DictionaryValue &node, base::DictionaryValue *)
+std::string AccessibilityTreeFormatterQt::ProcessTreeForOutput(const base::DictionaryValue &node, base::DictionaryValue *)
{
- base::string16 error_value;
+ std::string error_value;
if (node.GetString("error", &error_value))
return error_value;
- base::string16 line;
+ std::string line;
std::string role_value;
node.GetString("role", &role_value);
if (!role_value.empty())
@@ -176,7 +206,7 @@ base::string16 AccessibilityTreeFormatterQt::ProcessTreeForOutput(const base::Di
node.GetInteger("id", &id_value);
WriteAttribute(false, base::StringPrintf("id=%d", id_value), &line);
- return line + base::ASCIIToUTF16("\n");
+ return line + "\n";
}
base::FilePath::StringType AccessibilityTreeFormatterQt::GetExpectedFileSuffix()
@@ -204,6 +234,11 @@ const std::string AccessibilityTreeFormatterQt::GetDenyNodeString()
return "@QT-DENY-NODE:";
}
+const std::string AccessibilityTreeFormatterQt::GetRunUntilEventString()
+{
+ return "@QT-RUN-UNTIL-EVENT:";
+}
+
#endif // QT_CONFIG(accessibility)
// static
diff --git a/src/core/api/core_api.pro b/src/core/api/core_api.pro
index e68d4bd8b..3a2a9708c 100644
--- a/src/core/api/core_api.pro
+++ b/src/core/api/core_api.pro
@@ -26,6 +26,7 @@ CHROMIUM_SRC_DIR = $$QTWEBENGINE_ROOT/$$getChromiumSrcDir()
CHROMIUM_GEN_DIR = $$OUT_PWD/../$$getConfigDir()/gen
INCLUDEPATH += $$QTWEBENGINE_ROOT/src/core \
$$CHROMIUM_GEN_DIR \
+ $$CHROMIUM_SRC_DIR/third_party/abseil-cpp \
$$CHROMIUM_SRC_DIR
gcc: QMAKE_CXXFLAGS_WARN_ON = -Wno-unused-parameter
diff --git a/src/core/api/qwebengineprofile.cpp b/src/core/api/qwebengineprofile.cpp
index 5704a139a..6f0e9d82c 100644
--- a/src/core/api/qwebengineprofile.cpp
+++ b/src/core/api/qwebengineprofile.cpp
@@ -807,6 +807,8 @@ void QWebEngineProfile::removeAllUrlSchemeHandlers()
/*!
\since 5.13
+ \obsolete
+
Sets if this profile is to be used for downloading and caching when needed
during certificate verification, for instance for OCSP, CRLs, and AIA.
@@ -815,11 +817,14 @@ void QWebEngineProfile::removeAllUrlSchemeHandlers()
needlessly re-downloading. If you set the option on a second profile,
it will be disabled on the profile it is currently set.
- Currently only affects Linux/NSS installations where it enables OCSP.
-
As long as one profile has \a enabled set to \c true, all other profiles
will be able to use it for their certificate verification.
+ Originally only affected Linux/NSS installations where it enabled OCSP.
+
+ Since 5.15.3, no longer does anything. Certificate verification is done
+ using AIO on the requesting profile.
+
\sa isUsedForGlobalCertificateVerification(), httpCacheType()
*/
void QWebEngineProfile::setUseForGlobalCertificateVerification(bool enabled)
@@ -831,6 +836,8 @@ void QWebEngineProfile::setUseForGlobalCertificateVerification(bool enabled)
/*!
\since 5.13
+ \obsolete
+
Returns \c true if this profile is currently being used for global
certificate verification.
*/
diff --git a/src/core/browser_accessibility_manager_qt.cpp b/src/core/browser_accessibility_manager_qt.cpp
index 5968bfd30..1d635a6e9 100644
--- a/src/core/browser_accessibility_manager_qt.cpp
+++ b/src/core/browser_accessibility_manager_qt.cpp
@@ -48,13 +48,11 @@ namespace content {
BrowserAccessibilityManager* BrowserAccessibilityManager::Create(
const ui::AXTreeUpdate& initialTree,
- BrowserAccessibilityDelegate* delegate,
- BrowserAccessibilityFactory* factory)
+ BrowserAccessibilityDelegate* delegate)
{
#if QT_CONFIG(accessibility)
- return new BrowserAccessibilityManagerQt(nullptr, initialTree, delegate, factory);
+ return new BrowserAccessibilityManagerQt(nullptr, initialTree, delegate);
#else
- delete factory;
return nullptr;
#endif // QT_CONFIG(accessibility)
}
@@ -71,8 +69,8 @@ BrowserAccessibility *BrowserAccessibility::Create()
#if QT_CONFIG(accessibility)
BrowserAccessibilityManagerQt::BrowserAccessibilityManagerQt(
QObject *parentObject, const ui::AXTreeUpdate &initialTree,
- BrowserAccessibilityDelegate* delegate, BrowserAccessibilityFactory* factory)
- : BrowserAccessibilityManager(delegate, factory)
+ BrowserAccessibilityDelegate* delegate)
+ : BrowserAccessibilityManager(delegate)
, m_parentObject(parentObject)
{
Initialize(initialTree);
diff --git a/src/core/browser_accessibility_manager_qt.h b/src/core/browser_accessibility_manager_qt.h
index 511f6bf9a..2a1d273b9 100644
--- a/src/core/browser_accessibility_manager_qt.h
+++ b/src/core/browser_accessibility_manager_qt.h
@@ -54,10 +54,9 @@ namespace content {
class BrowserAccessibilityManagerQt : public BrowserAccessibilityManager
{
public:
- BrowserAccessibilityManagerQt(QObject* parentObject,
- const ui::AXTreeUpdate& initialTree,
- BrowserAccessibilityDelegate* delegate,
- BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory());
+ BrowserAccessibilityManagerQt(QObject *parentObject,
+ const ui::AXTreeUpdate &initialTree,
+ BrowserAccessibilityDelegate *delegate);
~BrowserAccessibilityManagerQt() override;
void FireBlinkEvent(ax::mojom::Event event_type,
BrowserAccessibility* node) override;
diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp
index f4fe2f694..fabad0609 100644
--- a/src/core/browser_accessibility_qt.cpp
+++ b/src/core/browser_accessibility_qt.cpp
@@ -79,7 +79,7 @@ bool BrowserAccessibilityQt::isValid() const
QObject *BrowserAccessibilityQt::object() const
{
- return 0;
+ return nullptr;
}
QAccessibleInterface *BrowserAccessibilityQt::childAt(int x, int y) const
@@ -90,7 +90,7 @@ QAccessibleInterface *BrowserAccessibilityQt::childAt(int x, int y) const
if (childIface->rect().contains(x,y))
return childIface;
}
- return 0;
+ return nullptr;
}
void *BrowserAccessibilityQt::interface_cast(QAccessible::InterfaceType type)
@@ -132,7 +132,7 @@ void *BrowserAccessibilityQt::interface_cast(QAccessible::InterfaceType type)
default:
break;
}
- return 0;
+ return nullptr;
}
QAccessibleInterface *BrowserAccessibilityQt::parent() const
@@ -209,6 +209,13 @@ QAccessible::Role BrowserAccessibilityQt::role() const
case ax::mojom::Role::kUnknown:
return QAccessible::NoRole;
+ // Internal roles (matching auralinux and win)
+ case ax::mojom::Role::kKeyboard:
+ case ax::mojom::Role::kIgnored:
+ case ax::mojom::Role::kImeCandidate:
+ case ax::mojom::Role::kPresentational:
+ return QAccessible::NoRole;
+
// Used by Chromium to distinguish between the root of the tree
// for this page, and a web area for a frame within this page.
case ax::mojom::Role::kWebArea:
@@ -376,8 +383,6 @@ QAccessible::Role BrowserAccessibilityQt::role() const
return QAccessible::WebDocument;
case ax::mojom::Role::kIframePresentational:
return QAccessible::Grouping;
- case ax::mojom::Role::kIgnored:
- return QAccessible::NoRole;
case ax::mojom::Role::kImage:
return QAccessible::Graphic;
case ax::mojom::Role::kImageMap:
@@ -386,8 +391,6 @@ QAccessible::Role BrowserAccessibilityQt::role() const
return QAccessible::StaticText;
case ax::mojom::Role::kInputTime:
return QAccessible::SpinBox;
- case ax::mojom::Role::kKeyboard:
- return QAccessible::NoRole; // FIXME
case ax::mojom::Role::kLabelText:
return QAccessible::StaticText;
case ax::mojom::Role::kLayoutTable:
@@ -432,8 +435,6 @@ QAccessible::Role BrowserAccessibilityQt::role() const
return QAccessible::CheckBox;
case ax::mojom::Role::kMenuItemRadio:
return QAccessible::RadioButton;
- case ax::mojom::Role::kMenuButton:
- return QAccessible::MenuItem;
case ax::mojom::Role::kMenuListOption:
return QAccessible::MenuItem;
case ax::mojom::Role::kMenuListPopup:
@@ -458,8 +459,6 @@ QAccessible::Role BrowserAccessibilityQt::role() const
return QAccessible::Button;
case ax::mojom::Role::kPre:
return QAccessible::Section;
- case ax::mojom::Role::kPresentational:
- return QAccessible::NoRole; // FIXME
case ax::mojom::Role::kProgressIndicator:
return QAccessible::ProgressBar;
case ax::mojom::Role::kRadioButton:
@@ -646,16 +645,7 @@ QAccessible::State BrowserAccessibilityQt::state() const
return state;
}
-// Qt does not reference count accessibles
-void BrowserAccessibilityQt::NativeAddReference()
-{
-}
-
-// there is no reference counting, but BrowserAccessibility::Destroy
-// calls this (and that is the only place in the chromium sources,
-// so we can safely use it to dispose of ourselves here
-// (the default implementation of this function just contains a "delete this")
-void BrowserAccessibilityQt::NativeReleaseReference()
+void BrowserAccessibilityQt::Destroy()
{
// delete this
QAccessible::Id interfaceId = QAccessible::uniqueId(this);
@@ -987,7 +977,7 @@ QAccessibleInterface *BrowserAccessibilityQt::table() const
while (find_table && find_table->GetRole() != ax::mojom::Role::kTable)
find_table = find_table->PlatformGetParent();
if (!find_table)
- return 0;
+ return nullptr;
return static_cast<BrowserAccessibilityQt*>(find_table);
}
diff --git a/src/core/browser_accessibility_qt.h b/src/core/browser_accessibility_qt.h
index 19c7a1e54..32a4fc76b 100644
--- a/src/core/browser_accessibility_qt.h
+++ b/src/core/browser_accessibility_qt.h
@@ -80,9 +80,7 @@ public:
QAccessible::State state() const override;
// BrowserAccessible
- void NativeAddReference() override;
- void NativeReleaseReference() override;
- bool IsNative() const override { return true; }
+ void Destroy() override;
// QAccessibleActionInterface
QStringList actionNames() const override;
diff --git a/src/core/browser_main_parts_qt.cpp b/src/core/browser_main_parts_qt.cpp
index c1f4cbb2d..1add722a5 100644
--- a/src/core/browser_main_parts_qt.cpp
+++ b/src/core/browser_main_parts_qt.cpp
@@ -41,10 +41,9 @@
#include "api/qwebenginemessagepumpscheduler_p.h"
-#include "base/message_loop/message_loop.h"
-#include "base/message_loop/message_loop_current.h"
#include "base/message_loop/message_pump_for_ui.h"
#include "base/process/process.h"
+#include "base/task/current_thread.h"
#include "base/task/sequence_manager/sequence_manager_impl.h"
#include "base/task/sequence_manager/thread_controller_with_message_pump_impl.h"
#include "base/threading/thread_restrictions.h"
@@ -79,7 +78,7 @@
#include <QOpenGLContext>
#endif
-#if defined(OS_MACOSX)
+#if defined(OS_MAC)
#include "base/message_loop/message_pump_mac.h"
#include "ui/base/idle/idle.h"
#endif
@@ -150,7 +149,7 @@ private:
void ensureDelegate()
{
if (!m_delegate) {
- auto seqMan = base::MessageLoopCurrent::GetCurrentSequenceManagerImpl();
+ auto seqMan = base::CurrentThread::Get()->GetCurrentSequenceManagerImpl();
m_delegate = static_cast<base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl *>(
seqMan->controller_.get());
}
@@ -226,7 +225,7 @@ std::unique_ptr<base::MessagePump> messagePumpFactory()
madePrimaryPump = true;
return std::make_unique<MessagePumpForUIQt>();
}
-#if defined(OS_MACOSX)
+#if defined(OS_MAC)
return base::MessagePumpMac::Create();
#else
return std::make_unique<base::MessagePumpForUI>();
@@ -269,7 +268,7 @@ int BrowserMainPartsQt::PreCreateThreads()
{
base::ThreadRestrictions::SetIOAllowed(true);
-#if defined(OS_MACOSX)
+#if defined(OS_MAC)
ui::InitIdleMonitor();
#endif
diff --git a/src/core/browser_message_filter_qt.cpp b/src/core/browser_message_filter_qt.cpp
index a4b75f075..54d6551e4 100644
--- a/src/core/browser_message_filter_qt.cpp
+++ b/src/core/browser_message_filter_qt.cpp
@@ -64,90 +64,77 @@ BrowserMessageFilterQt::BrowserMessageFilterQt(int /*render_process_id*/, Profil
bool BrowserMessageFilterQt::OnMessageReceived(const IPC::Message& message)
{
IPC_BEGIN_MESSAGE_MAP(BrowserMessageFilterQt, message)
- IPC_MESSAGE_HANDLER(QtWebEngineHostMsg_AllowDatabase, OnAllowDatabase)
- IPC_MESSAGE_HANDLER(QtWebEngineHostMsg_AllowDOMStorage, OnAllowDOMStorage)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(QtWebEngineHostMsg_RequestFileSystemAccessSync,
- OnRequestFileSystemAccessSync)
- IPC_MESSAGE_HANDLER(QtWebEngineHostMsg_RequestFileSystemAccessAsync,
- OnRequestFileSystemAccessAsync)
- IPC_MESSAGE_HANDLER(QtWebEngineHostMsg_AllowIndexedDB, OnAllowIndexedDB)
+ IPC_MESSAGE_HANDLER(QtWebEngineHostMsg_AllowStorageAccess, OnAllowStorageAccess)
+ IPC_MESSAGE_HANDLER_DELAY_REPLY(QtWebEngineHostMsg_RequestStorageAccessSync,
+ OnRequestStorageAccessSync)
+ IPC_MESSAGE_HANDLER(QtWebEngineHostMsg_RequestStorageAccessAsync,
+ OnRequestStorageAccessAsync)
IPC_MESSAGE_UNHANDLED(return false)
IPC_END_MESSAGE_MAP()
return true;
}
-void BrowserMessageFilterQt::OnAllowDatabase(int /*render_frame_id*/,
- const GURL &origin_url,
- const GURL &top_origin_url,
- bool* allowed)
+void BrowserMessageFilterQt::OnAllowStorageAccess(int /*render_frame_id*/,
+ const GURL &origin_url,
+ const GURL &top_origin_url,
+ int /*storage_type*/,
+ bool *allowed)
{
*allowed = m_profileData->canGetCookies(toQt(top_origin_url), toQt(origin_url));
}
-void BrowserMessageFilterQt::OnAllowDOMStorage(int /*render_frame_id*/,
- const GURL &origin_url,
- const GURL &top_origin_url,
- bool /*local*/,
- bool *allowed)
-{
- *allowed = m_profileData->canGetCookies(toQt(top_origin_url), toQt(origin_url));
-}
-
-void BrowserMessageFilterQt::OnAllowIndexedDB(int /*render_frame_id*/,
- const GURL &origin_url,
- const GURL &top_origin_url,
- bool *allowed)
-{
- *allowed = m_profileData->canGetCookies(toQt(top_origin_url), toQt(origin_url));
-}
-
-void BrowserMessageFilterQt::OnRequestFileSystemAccessSync(int render_frame_id,
- const GURL& origin_url,
- const GURL& top_origin_url,
- IPC::Message* reply_msg)
+void BrowserMessageFilterQt::OnRequestStorageAccessSync(int render_frame_id,
+ const GURL& origin_url,
+ const GURL& top_origin_url,
+ int storage_type,
+ IPC::Message* reply_msg)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
base::Callback<void(bool)> callback = base::Bind(
- &BrowserMessageFilterQt::OnRequestFileSystemAccessSyncResponse,
+ &BrowserMessageFilterQt::OnRequestStorageAccessSyncResponse,
base::WrapRefCounted(this), reply_msg);
- OnRequestFileSystemAccess(render_frame_id,
- origin_url,
- top_origin_url,
- callback);
+ OnRequestStorageAccess(render_frame_id,
+ origin_url,
+ top_origin_url,
+ storage_type,
+ callback);
}
-void BrowserMessageFilterQt::OnRequestFileSystemAccessSyncResponse(IPC::Message *reply_msg, bool allowed)
+void BrowserMessageFilterQt::OnRequestStorageAccessSyncResponse(IPC::Message *reply_msg, bool allowed)
{
- QtWebEngineHostMsg_RequestFileSystemAccessSync::WriteReplyParams(reply_msg, allowed);
+ QtWebEngineHostMsg_RequestStorageAccessSync::WriteReplyParams(reply_msg, allowed);
Send(reply_msg);
}
-void BrowserMessageFilterQt::OnRequestFileSystemAccessAsync(int render_frame_id,
- int request_id,
- const GURL& origin_url,
- const GURL& top_origin_url)
+void BrowserMessageFilterQt::OnRequestStorageAccessAsync(int render_frame_id,
+ int request_id,
+ const GURL& origin_url,
+ const GURL& top_origin_url,
+ int storage_type)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
base::Callback<void(bool)> callback = base::Bind(
- &BrowserMessageFilterQt::OnRequestFileSystemAccessAsyncResponse,
+ &BrowserMessageFilterQt::OnRequestStorageAccessAsyncResponse,
base::WrapRefCounted(this), render_frame_id, request_id);
- OnRequestFileSystemAccess(render_frame_id,
- origin_url,
- top_origin_url,
- callback);
+ OnRequestStorageAccess(render_frame_id,
+ origin_url,
+ top_origin_url,
+ storage_type,
+ callback);
}
-void BrowserMessageFilterQt::OnRequestFileSystemAccessAsyncResponse(int render_frame_id,
- int request_id,
- bool allowed)
+void BrowserMessageFilterQt::OnRequestStorageAccessAsyncResponse(int render_frame_id,
+ int request_id,
+ bool allowed)
{
- Send(new QtWebEngineMsg_RequestFileSystemAccessAsyncResponse(render_frame_id, request_id, allowed));
+ Send(new QtWebEngineMsg_RequestStorageAccessAsyncResponse(render_frame_id, request_id, allowed));
}
-void BrowserMessageFilterQt::OnRequestFileSystemAccess(int /*render_frame_id*/,
- const GURL &origin_url,
- const GURL &top_origin_url,
- base::Callback<void(bool)> callback)
+void BrowserMessageFilterQt::OnRequestStorageAccess(int /*render_frame_id*/,
+ const GURL &origin_url,
+ const GURL &top_origin_url,
+ int /*storage_type*/,
+ base::Callback<void(bool)> callback)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
bool allowed = m_profileData->canGetCookies(toQt(top_origin_url), toQt(origin_url));
diff --git a/src/core/browser_message_filter_qt.h b/src/core/browser_message_filter_qt.h
index 4abc612f8..85de0486a 100644
--- a/src/core/browser_message_filter_qt.h
+++ b/src/core/browser_message_filter_qt.h
@@ -42,7 +42,6 @@
#include "base/callback.h"
#include "content/public/browser/browser_message_filter.h"
-#include "content/public/common/webplugininfo.h"
class GURL;
class Profile;
@@ -59,39 +58,33 @@ public:
private:
bool OnMessageReceived(const IPC::Message& message) override;
- void OnAllowDatabase(int render_frame_id,
- const GURL &origin_url,
- const GURL &top_origin_url,
- bool *allowed);
- void OnAllowDOMStorage(int render_frame_id,
- const GURL &origin_url,
- const GURL &top_origin_url,
- bool local,
- bool *allowed);
+ void OnAllowStorageAccess(int render_frame_id,
+ const GURL &origin_url,
+ const GURL &top_origin_url,
+ int storage_type,
+ bool *allowed);
- void OnAllowIndexedDB(int render_frame_id,
- const GURL &origin_url,
- const GURL &top_origin_url,
- bool *allowed);
-
- void OnRequestFileSystemAccessSync(int render_frame_id,
- const GURL &origin_url,
- const GURL &top_origin_url,
- IPC::Message *message);
- void OnRequestFileSystemAccessAsync(int render_frame_id,
- int request_id,
- const GURL &origin_url,
- const GURL &top_origin_url);
- void OnRequestFileSystemAccessSyncResponse(IPC::Message *reply_msg,
- bool allowed);
- void OnRequestFileSystemAccessAsyncResponse(int render_frame_id,
- int request_id,
- bool allowed);
- void OnRequestFileSystemAccess(int render_frame_id,
- const GURL &origin_url,
- const GURL &top_origin_url,
- base::Callback<void(bool)> callback);
+ void OnRequestStorageAccessSync(int render_frame_id,
+ const GURL &origin_url,
+ const GURL &top_origin_url,
+ int storage_type,
+ IPC::Message *message);
+ void OnRequestStorageAccessAsync(int render_frame_id,
+ int request_id,
+ const GURL &origin_url,
+ const GURL &top_origin_url,
+ int storage_type);
+ void OnRequestStorageAccessSyncResponse(IPC::Message *reply_msg,
+ bool allowed);
+ void OnRequestStorageAccessAsyncResponse(int render_frame_id,
+ int request_id,
+ bool allowed);
+ void OnRequestStorageAccess(int render_frame_id,
+ const GURL &origin_url,
+ const GURL &top_origin_url,
+ int storage_type,
+ base::Callback<void(bool)> callback);
ProfileIODataQt *m_profileData;
};
diff --git a/src/core/browsing_data_remover_delegate_qt.cpp b/src/core/browsing_data_remover_delegate_qt.cpp
index 344ba817f..6e79ab6c6 100644
--- a/src/core/browsing_data_remover_delegate_qt.cpp
+++ b/src/core/browsing_data_remover_delegate_qt.cpp
@@ -48,7 +48,7 @@
namespace QtWebEngineCore {
-bool DoesOriginMatchEmbedderMask(int origin_type_mask,
+bool DoesOriginMatchEmbedderMask(uint64_t origin_type_mask,
const url::Origin &origin,
storage::SpecialStoragePolicy *policy)
{
@@ -70,10 +70,10 @@ bool BrowsingDataRemoverDelegateQt::MayRemoveDownloadHistory()
void BrowsingDataRemoverDelegateQt::RemoveEmbedderData(const base::Time &delete_begin,
const base::Time &delete_end,
- int remove_mask,
+ uint64_t remove_mask,
content::BrowsingDataFilterBuilder *filter_builder,
- int origin_type_mask,
- base::OnceClosure callback)
+ uint64_t origin_type_mask,
+ base::OnceCallback<void(/*failed_data_types=*/uint64_t)> callback)
{
Q_UNUSED(delete_begin);
Q_UNUSED(delete_end);
@@ -83,7 +83,12 @@ void BrowsingDataRemoverDelegateQt::RemoveEmbedderData(const base::Time &delete_
if (remove_mask & content::BrowsingDataRemover::DATA_TYPE_CACHE)
web_cache::WebCacheManager::GetInstance()->ClearCache();
- std::move(callback).Run();
+ std::move(callback).Run(0);
+}
+
+std::vector<std::string> BrowsingDataRemoverDelegateQt::GetDomainsForDeferredCookieDeletion(uint64_t)
+{
+ return {};
}
} // namespace QtWebEngineCore
diff --git a/src/core/browsing_data_remover_delegate_qt.h b/src/core/browsing_data_remover_delegate_qt.h
index dc2761ffc..a10409f39 100644
--- a/src/core/browsing_data_remover_delegate_qt.h
+++ b/src/core/browsing_data_remover_delegate_qt.h
@@ -55,10 +55,11 @@ public:
void RemoveEmbedderData(
const base::Time &delete_begin,
const base::Time &delete_end,
- int remove_mask,
+ uint64_t remove_mask,
content::BrowsingDataFilterBuilder *filter_builder,
- int origin_type_mask,
- base::OnceClosure callback) override;
+ uint64_t origin_type_mask,
+ base::OnceCallback<void(/*failed_data_types=*/uint64_t)> callback) override;
+ std::vector<std::string> GetDomainsForDeferredCookieDeletion(uint64_t) override;
};
} // namespace QtWebEngineCore
diff --git a/src/core/chromium_overrides.cpp b/src/core/chromium_overrides.cpp
index 4aa652b81..019c7aac1 100644
--- a/src/core/chromium_overrides.cpp
+++ b/src/core/chromium_overrides.cpp
@@ -43,7 +43,6 @@
#include "base/values.h"
#include "content/browser/accessibility/accessibility_tree_formatter_blink.h"
-#include "content/browser/accessibility/accessibility_tree_formatter_browser.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/font_list.h"
@@ -63,7 +62,6 @@
#if defined(USE_AURA) && !defined(USE_OZONE)
#include "ui/base/dragdrop/os_exchange_data.h"
-#include "ui/base/dragdrop/os_exchange_data_provider_aura.h"
#include "ui/gfx/render_text.h"
#include "ui/gfx/platform_font.h"
#endif
@@ -194,7 +192,7 @@ void GrabViewSnapshotAsync(gfx::NativeView view,
} // namespace ui
#endif // defined(USE_AURA)
-std::unique_ptr<ui::OSExchangeData::Provider>
-ui::OSExchangeDataProviderFactory::CreateProvider() {
+std::unique_ptr<ui::OSExchangeDataProvider> ui::OSExchangeDataProviderFactory::CreateProvider()
+{
return nullptr;
}
diff --git a/src/core/clipboard_qt.cpp b/src/core/clipboard_qt.cpp
index a1dba8150..65e3e90ac 100644
--- a/src/core/clipboard_qt.cpp
+++ b/src/core/clipboard_qt.cpp
@@ -51,6 +51,7 @@
#include "ui/base/clipboard/custom_data_helper.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/clipboard/clipboard_constants.h"
+#include "ui/base/clipboard/clipboard_data_endpoint.h"
#include "ui/base/clipboard/clipboard_format_type.h"
#include <QGuiApplication>
@@ -106,7 +107,7 @@ Clipboard *Clipboard::Create()
namespace QtWebEngineCore {
-void ClipboardQt::WritePortableRepresentations(ui::ClipboardBuffer type, const ObjectMap &objects)
+void ClipboardQt::WritePortableRepresentations(ui::ClipboardBuffer type, const ObjectMap &objects, std::unique_ptr<ui::ClipboardDataEndpoint> data_src)
{
DCHECK(CalledOnValidThread());
DCHECK(IsSupportedClipboardBuffer(type));
@@ -125,12 +126,15 @@ void ClipboardQt::WritePortableRepresentations(ui::ClipboardBuffer type, const O
if (text_iter != objects.end()) {
// Copy text and SourceTag to the selection clipboard.
WritePortableRepresentations(ui::ClipboardBuffer::kSelection,
- ObjectMap(text_iter, text_iter + 1));
+ ObjectMap(text_iter, text_iter + 1),
+ std::move(data_src));
}
}
}
-void ClipboardQt::WritePlatformRepresentations(ui::ClipboardBuffer buffer, std::vector<ui::Clipboard::PlatformRepresentation> platform_representations)
+void ClipboardQt::WritePlatformRepresentations(ui::ClipboardBuffer buffer,
+ std::vector<ui::Clipboard::PlatformRepresentation> platform_representations,
+ std::unique_ptr<ui::ClipboardDataEndpoint> data_src)
{
DCHECK(CalledOnValidThread());
DCHECK(IsSupportedClipboardBuffer(buffer));
@@ -188,7 +192,9 @@ void ClipboardQt::WriteData(const ui::ClipboardFormatType &format, const char *d
getUncommittedData()->setData(QString::fromStdString(format.GetName()), QByteArray(data_data, data_len));
}
-bool ClipboardQt::IsFormatAvailable(const ui::ClipboardFormatType &format, ui::ClipboardBuffer type) const
+bool ClipboardQt::IsFormatAvailable(const ui::ClipboardFormatType &format,
+ ui::ClipboardBuffer type,
+ const ui::ClipboardDataEndpoint *data_dst) const
{
const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(
type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection);
@@ -201,10 +207,11 @@ void ClipboardQt::Clear(ui::ClipboardBuffer type)
: QClipboard::Selection);
}
-void ClipboardQt::ReadAvailableTypes(ui::ClipboardBuffer type, std::vector<base::string16> *types,
- bool *contains_filenames) const
+void ClipboardQt::ReadAvailableTypes(ui::ClipboardBuffer type,
+ const ui::ClipboardDataEndpoint *data_dst,
+ std::vector<base::string16> *types) const
{
- if (!types || !contains_filenames) {
+ if (!types) {
NOTREACHED();
return;
}
@@ -219,13 +226,14 @@ void ClipboardQt::ReadAvailableTypes(ui::ClipboardBuffer type, std::vector<base:
const QStringList formats = mimeData->formats();
for (const QString &mimeType : formats)
types->push_back(toString16(mimeType));
- *contains_filenames = false;
const QByteArray customData = mimeData->data(QString::fromLatin1(ui::kMimeTypeWebCustomData));
ui::ReadCustomDataTypes(customData.constData(), customData.size(), types);
}
-void ClipboardQt::ReadText(ui::ClipboardBuffer type, base::string16 *result) const
+void ClipboardQt::ReadText(ui::ClipboardBuffer type,
+ const ui::ClipboardDataEndpoint *data_dst,
+ base::string16 *result) const
{
const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(
type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection);
@@ -233,7 +241,9 @@ void ClipboardQt::ReadText(ui::ClipboardBuffer type, base::string16 *result) con
*result = toString16(mimeData->text());
}
-void ClipboardQt::ReadAsciiText(ui::ClipboardBuffer type, std::string *result) const
+void ClipboardQt::ReadAsciiText(ui::ClipboardBuffer type,
+ const ui::ClipboardDataEndpoint *data_dst,
+ std::string *result) const
{
const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(
type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection);
@@ -241,7 +251,9 @@ void ClipboardQt::ReadAsciiText(ui::ClipboardBuffer type, std::string *result) c
*result = mimeData->text().toStdString();
}
-void ClipboardQt::ReadHTML(ui::ClipboardBuffer type, base::string16 *markup, std::string *src_url,
+void ClipboardQt::ReadHTML(ui::ClipboardBuffer type,
+ const ui::ClipboardDataEndpoint *data_dst,
+ base::string16 *markup, std::string *src_url,
uint32_t *fragment_start, uint32_t *fragment_end) const
{
markup->clear();
@@ -258,7 +270,9 @@ void ClipboardQt::ReadHTML(ui::ClipboardBuffer type, base::string16 *markup, std
*fragment_end = static_cast<uint32_t>(markup->length());
}
-void ClipboardQt::ReadRTF(ui::ClipboardBuffer type, std::string *result) const
+void ClipboardQt::ReadRTF(ui::ClipboardBuffer type,
+ const ui::ClipboardDataEndpoint *data_dst,
+ std::string *result) const
{
const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(
type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection);
@@ -268,7 +282,9 @@ void ClipboardQt::ReadRTF(ui::ClipboardBuffer type, std::string *result) const
*result = std::string(byteArray.constData(), byteArray.length());
}
-void ClipboardQt::ReadImage(ui::ClipboardBuffer type, ReadImageCallback callback) const
+void ClipboardQt::ReadImage(ui::ClipboardBuffer type,
+ const ui::ClipboardDataEndpoint *data_dst,
+ ReadImageCallback callback) const
{
const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(
type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection);
@@ -294,7 +310,9 @@ void ClipboardQt::ReadImage(ui::ClipboardBuffer type, ReadImageCallback callback
return std::move(callback).Run(bitmap);
}
-void ClipboardQt::ReadCustomData(ui::ClipboardBuffer clipboard_type, const base::string16 &type, base::string16 *result) const
+void ClipboardQt::ReadCustomData(ui::ClipboardBuffer clipboard_type, const base::string16 &type,
+ const ui::ClipboardDataEndpoint *data_dst,
+ base::string16 *result) const
{
const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(
clipboard_type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection);
@@ -304,12 +322,33 @@ void ClipboardQt::ReadCustomData(ui::ClipboardBuffer clipboard_type, const base:
ui::ReadCustomDataForType(customData.constData(), customData.size(), type, result);
}
-void ClipboardQt::ReadBookmark(base::string16 *title, std::string *url) const
+void ClipboardQt::ReadBookmark(const ui::ClipboardDataEndpoint *data_dst, base::string16 *title, std::string *url) const
{
NOTIMPLEMENTED();
}
-void ClipboardQt::ReadData(const ui::ClipboardFormatType &format, std::string *result) const
+void ClipboardQt::ReadSvg(ui::ClipboardBuffer clipboard_type,
+ const ui::ClipboardDataEndpoint *,
+ base::string16 *result) const
+{
+ const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(
+ clipboard_type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection);
+ if (!mimeData)
+ return;
+ const QByteArray svgData = mimeData->data(QString::fromLatin1(ui::kMimeTypeSvg));
+ if (!svgData.isEmpty())
+ *result = toString16(QString::fromUtf8(svgData));
+}
+
+void ClipboardQt::WriteSvg(const char *svg_data, size_t data_len)
+{
+ getUncommittedData()->setData(QString::fromLatin1(ui::kMimeTypeSvg),
+ QByteArray(svg_data, data_len));
+}
+
+void ClipboardQt::ReadData(const ui::ClipboardFormatType &format,
+ const ui::ClipboardDataEndpoint *data_dst,
+ std::string *result) const
{
const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData();
if (!mimeData)
@@ -324,18 +363,28 @@ uint64_t ClipboardQt::GetSequenceNumber(ui::ClipboardBuffer type) const
: QClipboard::Selection);
}
-std::vector<base::string16> ClipboardQt::ReadAvailablePlatformSpecificFormatNames(ui::ClipboardBuffer buffer) const
+
+#if defined(USE_OZONE)
+bool ClipboardQt::IsSelectionBufferAvailable() const
+{
+ return QGuiApplication::clipboard()->supportsSelection();
+}
+#endif
+
+std::vector<base::string16> ClipboardQt::ReadAvailablePlatformSpecificFormatNames(ui::ClipboardBuffer buffer, const ui::ClipboardDataEndpoint *data_dst) const
{
// based on ClipboardAura
std::vector<base::string16> types;
- if (IsFormatAvailable(ui::ClipboardFormatType::GetPlainTextType(), buffer))
+ if (IsFormatAvailable(ui::ClipboardFormatType::GetPlainTextType(), buffer, data_dst))
types.push_back(base::UTF8ToUTF16(ui::ClipboardFormatType::GetPlainTextType().GetName()));
- if (IsFormatAvailable(ui::ClipboardFormatType::GetHtmlType(), buffer))
+ if (IsFormatAvailable(ui::ClipboardFormatType::GetHtmlType(), buffer, data_dst))
types.push_back(base::UTF8ToUTF16(ui::ClipboardFormatType::GetHtmlType().GetName()));
- if (IsFormatAvailable(ui::ClipboardFormatType::GetRtfType(), buffer))
+ if (IsFormatAvailable(ui::ClipboardFormatType::GetRtfType(), buffer, data_dst))
types.push_back(base::UTF8ToUTF16(ui::ClipboardFormatType::GetRtfType().GetName()));
- if (IsFormatAvailable(ui::ClipboardFormatType::GetBitmapType(), buffer))
+ if (IsFormatAvailable(ui::ClipboardFormatType::GetBitmapType(), buffer, data_dst))
types.push_back(base::UTF8ToUTF16(ui::kMimeTypePNG));
+ if (IsFormatAvailable(ui::ClipboardFormatType::GetSvgType(), buffer, data_dst))
+ types.push_back(base::UTF8ToUTF16(ui::kMimeTypeSvg));
return types;
}
diff --git a/src/core/clipboard_qt.h b/src/core/clipboard_qt.h
index cc1b95a32..b4c9d4c7d 100644
--- a/src/core/clipboard_qt.h
+++ b/src/core/clipboard_qt.h
@@ -44,31 +44,43 @@
namespace QtWebEngineCore {
-class ClipboardQt : public ui::Clipboard {
+class ClipboardQt : public ui::Clipboard
+{
public:
uint64_t GetSequenceNumber(ui::ClipboardBuffer type) const override;
- bool IsFormatAvailable(const ui::ClipboardFormatType &format, ui::ClipboardBuffer type) const override;
+ bool IsFormatAvailable(const ui::ClipboardFormatType &format,
+ ui::ClipboardBuffer buffer,
+ const ui::ClipboardDataEndpoint *data_dst) const override;
void Clear(ui::ClipboardBuffer type) override;
- void ReadAvailableTypes(ui::ClipboardBuffer type, std::vector<base::string16> *types,
- bool *contains_filenames) const override;
- void ReadText(ui::ClipboardBuffer type, base::string16 *result) const override;
- void ReadAsciiText(ui::ClipboardBuffer type, std::string *result) const override;
- void ReadHTML(ui::ClipboardBuffer type, base::string16 *markup, std::string *src_url, uint32_t *fragment_start,
+ void ReadAvailableTypes(ui::ClipboardBuffer type,
+ const ui::ClipboardDataEndpoint *data_dst,
+ std::vector<base::string16> *types) const override;
+ void ReadText(ui::ClipboardBuffer type, const ui::ClipboardDataEndpoint *data_dst, base::string16 *result) const override;
+ void ReadAsciiText(ui::ClipboardBuffer type, const ui::ClipboardDataEndpoint *data_dst, std::string *result) const override;
+ void ReadHTML(ui::ClipboardBuffer type, const ui::ClipboardDataEndpoint *data_dst, base::string16 *markup, std::string *src_url, uint32_t *fragment_start,
uint32_t *fragment_end) const override;
- void ReadRTF(ui::ClipboardBuffer type, std::string *result) const override;
- void ReadImage(ui::ClipboardBuffer buffer, ReadImageCallback callback) const override;
- void ReadCustomData(ui::ClipboardBuffer clipboard_type, const base::string16 &type, base::string16 *result) const override;
- void ReadBookmark(base::string16 *title, std::string *url) const override;
- void ReadData(const ui::ClipboardFormatType &format, std::string *result) const override;
-
+ void ReadRTF(ui::ClipboardBuffer type, const ui::ClipboardDataEndpoint *data_dst, std::string *result) const override;
+ void ReadImage(ui::ClipboardBuffer buffer, const ui::ClipboardDataEndpoint *data_dst, ReadImageCallback callback) const override;
+ void ReadCustomData(ui::ClipboardBuffer clipboard_type, const base::string16 &type, const ui::ClipboardDataEndpoint *data_dst, base::string16 *result) const override;
+ void ReadBookmark(const ui::ClipboardDataEndpoint *data_dst, base::string16 *title, std::string *url) const override;
+ void ReadData(const ui::ClipboardFormatType &format, const ui::ClipboardDataEndpoint *data_dst, std::string *result) const override;
+#if defined(USE_OZONE)
+ bool IsSelectionBufferAvailable() const override;
+#endif
void OnPreShutdown() override {}
-
- std::vector<base::string16> ReadAvailablePlatformSpecificFormatNames(ui::ClipboardBuffer buffer) const override;
+ void ReadSvg(ui::ClipboardBuffer, const ui::ClipboardDataEndpoint *, base::string16 *) const override;
+ void WriteSvg(const char *, size_t) override;
+ std::vector<base::string16> ReadAvailablePlatformSpecificFormatNames(ui::ClipboardBuffer buffer, const ui::ClipboardDataEndpoint *data_dst) const override;
protected:
- void WritePortableRepresentations(ui::ClipboardBuffer type, const ObjectMap &objects) override;
- void WritePlatformRepresentations(ui::ClipboardBuffer type,
- std::vector<ui::Clipboard::PlatformRepresentation> platform_representations) override;
+ void WritePortableRepresentations(
+ ui::ClipboardBuffer buffer,
+ const ObjectMap &objects,
+ std::unique_ptr<ui::ClipboardDataEndpoint> data_src) override;
+ void WritePlatformRepresentations(
+ ui::ClipboardBuffer buffer,
+ std::vector<Clipboard::PlatformRepresentation> platform_representations,
+ std::unique_ptr<ui::ClipboardDataEndpoint> data_src) override;
void WriteText(const char *text_data, size_t text_len) override;
void WriteHTML(const char *markup_data, size_t markup_len, const char *url_data, size_t url_len) override;
void WriteRTF(const char *rtf_data, size_t data_len) override;
diff --git a/src/core/common/extensions/api/qtwebengine_extensions_features.gni b/src/core/common/extensions/api/qtwebengine_extensions_features.gni
index ed7e713c6..3873e235a 100644
--- a/src/core/common/extensions/api/qtwebengine_extensions_features.gni
+++ b/src/core/common/extensions/api/qtwebengine_extensions_features.gni
@@ -12,7 +12,8 @@ json_features("qt_permission_features") {
feature_type = "PermissionFeature"
method_name = "AddQtPermissionFeatures"
sources = [
- "//extensions/common/api/_permission_features.json"
+ "//chrome/common/extensions/api/_permission_features.json",
+ "//extensions/common/api/_permission_features.json",
]
}
@@ -20,6 +21,7 @@ group("qtwebengine_extensions_features") {
public_deps = [
":qt_api_features",
":qt_permission_features",
+ "//chrome/common/extensions/api:extensions_features",
"//extensions/common/api:extensions_features",
]
}
diff --git a/src/core/common/extensions/extensions_api_provider_qt.cpp b/src/core/common/extensions/extensions_api_provider_qt.cpp
index 22154a9d1..81eb76f3e 100644
--- a/src/core/common/extensions/extensions_api_provider_qt.cpp
+++ b/src/core/common/extensions/extensions_api_provider_qt.cpp
@@ -39,6 +39,8 @@
#include "extensions_api_provider_qt.h"
+#include "chrome/common/extensions/permissions/chrome_api_permissions.h"
+#include "chrome/common/extensions/api/generated_schemas.h"
#include "chrome/grit/common_resources.h"
#include "extensions/common/api/api_features.h"
@@ -51,6 +53,7 @@
#include "extensions/common/features/json_feature_provider_source.h"
#include "extensions/common/permissions/permissions_info.h"
#include "extensions/grit/extensions_resources.h"
+#include "qtwebengine/common/extensions/api/generated_schemas.h"
#include "qt_api_features.h"
//#include "qt_behavior_features.h"
@@ -85,16 +88,30 @@ void ExtensionsAPIProviderQt::AddPermissionFeatures(FeatureProvider *provider)
bool ExtensionsAPIProviderQt::IsAPISchemaGenerated(const std::string &name)
{
- return api::GeneratedSchemas::IsGenerated(name);
+ return api::GeneratedSchemas::IsGenerated(name) ||
+ api::ChromeGeneratedSchemas::IsGenerated(name) ||
+ api::QtWebEngineGeneratedSchemas::IsGenerated(name);
}
base::StringPiece ExtensionsAPIProviderQt::GetAPISchema(const std::string &name)
{
- return api::GeneratedSchemas::Get(name);
+ if (!api::GeneratedSchemas::Get(name).empty())
+ return api::GeneratedSchemas::Get(name);
+
+ if (!api::ChromeGeneratedSchemas::Get(name).empty())
+ return api::ChromeGeneratedSchemas::Get(name);
+
+ if (!api::QtWebEngineGeneratedSchemas::Get(name).empty())
+ return api::QtWebEngineGeneratedSchemas::Get(name);
+
+ return "";
}
void ExtensionsAPIProviderQt::RegisterPermissions(PermissionsInfo* permissions_info)
{
+ permissions_info->RegisterPermissions(
+ chrome_api_permissions::GetPermissionInfos(),
+ chrome_api_permissions::GetPermissionAliases());
}
}
diff --git a/src/core/common/extensions/extensions_client_qt.cpp b/src/core/common/extensions/extensions_client_qt.cpp
index dd1de1483..c4cc2321a 100644
--- a/src/core/common/extensions/extensions_client_qt.cpp
+++ b/src/core/common/extensions/extensions_client_qt.cpp
@@ -108,18 +108,18 @@ void ExtensionsClientQt::FilterHostPermissions(const URLPatternSet &hosts,
{
}
-// Replaces the scripting whitelist with |whitelist|. Used in the renderer{}
+// Replaces the scripting allowlist with |allowlist|. Used in the renderer{}
// only used for testing in the browser process.
-void ExtensionsClientQt::SetScriptingWhitelist(const ExtensionsClient::ScriptingWhitelist &whitelist)
+void ExtensionsClientQt::SetScriptingAllowlist(const ExtensionsClient::ScriptingAllowlist &allowlist)
{
- scripting_whitelist_ = whitelist;
+ scripting_allowlist_ = allowlist;
}
-// Return the whitelist of extensions that can run content scripts on
+// Return the allowlist of extensions that can run content scripts on
// any origin.
-const ExtensionsClient::ScriptingWhitelist &ExtensionsClientQt::GetScriptingWhitelist() const
+const ExtensionsClient::ScriptingAllowlist &ExtensionsClientQt::GetScriptingAllowlist() const
{
- return scripting_whitelist_;
+ return scripting_allowlist_;
}
// Get the set of chrome:// hosts that |extension| can run content scripts on.
diff --git a/src/core/common/extensions/extensions_client_qt.h b/src/core/common/extensions/extensions_client_qt.h
index e689f76b7..2466e14e3 100644
--- a/src/core/common/extensions/extensions_client_qt.h
+++ b/src/core/common/extensions/extensions_client_qt.h
@@ -87,13 +87,13 @@ public:
URLPatternSet *new_hosts,
PermissionIDSet *permissions) const override;
- // Replaces the scripting whitelist with |whitelist|. Used in the renderer;
+ // Replaces the scripting allowlist with |allowlist|. Used in the renderer;
// only used for testing in the browser process.
- void SetScriptingWhitelist(const ScriptingWhitelist &whitelist) override;
+ void SetScriptingAllowlist(const ScriptingAllowlist &allowlist) override;
- // Return the whitelist of extensions that can run content scripts on
+ // Return the allowlist of extensions that can run content scripts on
// any origin.
- const ScriptingWhitelist &GetScriptingWhitelist() const override;
+ const ScriptingAllowlist &GetScriptingAllowlist() const override;
// Get the set of chrome:// hosts that |extension| can run content scripts on.
URLPatternSet GetPermittedChromeSchemeHosts(const Extension *extension,
@@ -127,7 +127,7 @@ public:
static ExtensionsClientQt *GetInstance();
private:
- ScriptingWhitelist scripting_whitelist_;
+ ScriptingAllowlist scripting_allowlist_;
const ChromePermissionMessageProvider permission_message_provider_;
mutable GURL update_url_;
mutable GURL base_url_;
diff --git a/src/core/common/qt_messages.h b/src/core/common/qt_messages.h
index 7713b6286..ebf49e8c3 100644
--- a/src/core/common/qt_messages.h
+++ b/src/core/common/qt_messages.h
@@ -12,8 +12,12 @@
#define IPC_MESSAGE_START QtMsgStart
-// Tells the renderer whether or not a file system access has been allowed.
-IPC_MESSAGE_ROUTED2(QtWebEngineMsg_RequestFileSystemAccessAsyncResponse,
+//-----------------------------------------------------------------------------
+// RenderView messages
+// These are messages sent from the browser to the renderer process.
+
+// Tells the renderer whether or not a storage access has been allowed.
+IPC_MESSAGE_ROUTED2(QtWebEngineMsg_RequestStorageAccessAsyncResponse,
int /* request_id */,
bool /* allowed */)
@@ -27,43 +31,26 @@ IPC_MESSAGE_ROUTED0(RenderViewObserverHostQt_DidFirstVisuallyNonEmptyLayout)
// Misc messages
// These are messages sent from the renderer to the browser process.
-// Sent by the renderer process to check whether access to web databases is
-// granted by content settings.
-IPC_SYNC_MESSAGE_CONTROL3_1(QtWebEngineHostMsg_AllowDatabase,
+IPC_SYNC_MESSAGE_CONTROL4_1(QtWebEngineHostMsg_AllowStorageAccess,
int /* render_frame_id */,
GURL /* origin_url */,
GURL /* top origin url */,
+ int /* storage_type */,
bool /* allowed */)
-// Sent by the renderer process to check whether access to DOM Storage is
-// granted by content settings.
-IPC_SYNC_MESSAGE_CONTROL4_1(QtWebEngineHostMsg_AllowDOMStorage,
+IPC_SYNC_MESSAGE_CONTROL4_1(QtWebEngineHostMsg_RequestStorageAccessSync,
int /* render_frame_id */,
GURL /* origin_url */,
GURL /* top origin url */,
- bool /* if true local storage, otherwise session */,
+ int /* storage_type */,
bool /* allowed */)
-// Sent by the renderer process to check whether access to FileSystem is
+// Sent by the renderer process to check whether access to storage is
// granted by content settings.
-IPC_SYNC_MESSAGE_CONTROL3_1(QtWebEngineHostMsg_RequestFileSystemAccessSync,
- int /* render_frame_id */,
- GURL /* origin_url */,
- GURL /* top origin url */,
- bool /* allowed */)
-
-// Sent by the renderer process to check whether access to FileSystem is
-// granted by content settings.
-IPC_MESSAGE_CONTROL4(QtWebEngineHostMsg_RequestFileSystemAccessAsync,
+IPC_MESSAGE_CONTROL5(QtWebEngineHostMsg_RequestStorageAccessAsync,
int /* render_frame_id */,
int /* request_id */,
GURL /* origin_url */,
- GURL /* top origin url */)
+ GURL /* top origin url */,
+ int /* storage_type */)
-// Sent by the renderer process to check whether access to Indexed DB is
-// granted by content settings.
-IPC_SYNC_MESSAGE_CONTROL3_1(QtWebEngineHostMsg_AllowIndexedDB,
- int /* render_frame_id */,
- GURL /* origin_url */,
- GURL /* top origin url */,
- bool /* allowed */)
diff --git a/src/core/config/common.pri b/src/core/config/common.pri
index 8ffd59e99..b48d0b496 100644
--- a/src/core/config/common.pri
+++ b/src/core/config/common.pri
@@ -1,4 +1,3 @@
-
qtConfig(webengine-printing-and-pdf) {
gn_args += enable_basic_printing=true enable_print_preview=true
gn_args += enable_pdf=true
@@ -22,7 +21,7 @@ qtConfig(webengine-spellchecker) {
qtConfig(webengine-webrtc) {
gn_args += enable_webrtc=true
} else {
- gn_args += enable_webrtc=false audio_processing_in_audio_service_supported=false
+ gn_args += enable_webrtc=false
}
qtConfig(webengine-proprietary-codecs) {
@@ -47,8 +46,4 @@ qtConfig(webengine-kerberos) {
gn_args += use_kerberos=false
}
-qtConfig(webengine-nodejs) {
- gn_args += have_nodejs=true
-} else {
- gn_args += have_nodejs=false
-}
+!qtConfig(webengine-nodejs10): gn_args += use_rollup=false
diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri
index 26d0dcf7d..3e490a0d5 100644
--- a/src/core/config/linux.pri
+++ b/src/core/config/linux.pri
@@ -41,9 +41,4 @@ qtConfig(webengine-embedded-build) {
qtConfig(webengine-system-ffmpeg): gn_args += use_system_ffmpeg=true
qtConfig(webengine-system-re2): gn_args += use_system_re2=true
qtConfig(webengine-system-lcms2): gn_args += use_system_lcms2=true
-
- # FIXME:
- #qtConfig(webengine-system-protobuf): gn_args += use_system_protobuf=true
- #qtConfig(webengine-system-jsoncpp): gn_args += use_system_jsoncpp=true
- #qtConfig(webengine-system-libsrtp: gn_args += use_system_libsrtp=true
}
diff --git a/src/core/config/windows.pri b/src/core/config/windows.pri
index 732a61e28..9543daf90 100644
--- a/src/core/config/windows.pri
+++ b/src/core/config/windows.pri
@@ -6,6 +6,3 @@ qtConfig(build-qtwebengine-core):qtConfig(webengine-spellchecker) {
} else {
gn_args += use_browser_spellchecker=false
}
-
-# Avoid conflicting vulkan.h headers
-gn_args += enable_vulkan=false
diff --git a/src/core/configure.json b/src/core/configure.json
index 4cd6174fc..9e39ae59a 100644
--- a/src/core/configure.json
+++ b/src/core/configure.json
@@ -91,10 +91,6 @@
"webengine-embedded-build": {
"label": "embedded build",
"type": "detectEmbedded"
- },
- "webengine-nodejs": {
- "label": "node.js",
- "type": "detectNodeJS"
}
},
"features": {
@@ -212,11 +208,6 @@
{ "type": "privateConfig", "name": "v8base_debug" },
{ "type": "privateConfig", "name": "webcore_debug" }
]
- },
- "webengine-nodejs": {
- "label": "Node.js",
- "condition": "tests.webengine-nodejs",
- "output": [ "privateFeature" ]
}
},
@@ -235,11 +226,6 @@
"type": "warning",
"condition": "config.unix && config.cross_compile && !features.webengine-v8-snapshot-support",
"message": "V8 snapshot cannot be built. Most likely, the 32-bit host compiler does not work. Please make sure you have 32-bit devel environment installed."
- },
- {
- "type": "warning",
- "condition": "!features.webengine-nodejs",
- "message": "Building without node.js will disable some features of QtWebEngine DevTools."
}
],
@@ -261,7 +247,6 @@
"webengine-webchannel",
"webengine-kerberos",
"webengine-extensions",
- "webengine-nodejs",
{
"type": "feature",
"args": "webengine-ozone",
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index c90901ad9..426c3beb2 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -43,7 +43,6 @@
#include "base/optional.h"
#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
-#include "base/message_loop/message_loop.h"
#include "base/task/post_task.h"
#include "base/threading/thread_restrictions.h"
#include "chrome/browser/custom_handlers/protocol_handler_registry.h"
@@ -56,15 +55,12 @@
#include "components/navigation_interception/navigation_params.h"
#include "components/network_hints/browser/simple_network_hints_handler_impl.h"
#include "components/performance_manager/embedder/performance_manager_registry.h"
-#include "components/performance_manager/graph/process_node_impl.h"
-#include "components/performance_manager/performance_manager_impl.h"
-#include "components/performance_manager/public/mojom/coordination_unit.mojom.h"
#include "components/performance_manager/public/performance_manager.h"
-#include "components/performance_manager/render_process_user_data.h"
#include "components/spellcheck/spellcheck_buildflags.h"
#include "content/browser/renderer_host/render_view_host_delegate.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/url_schemes.h"
+#include "content/public/browser/browser_main_runner.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_security_policy.h"
@@ -90,6 +86,7 @@
#include "extensions/buildflags/buildflags.h"
#include "extensions/browser/extension_protocols.h"
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
+#include "extensions/browser/process_map.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "mojo/public/cpp/bindings/binding_set.h"
#include "mojo/public/cpp/bindings/remote.h"
@@ -98,11 +95,12 @@
#include "qtwebengine/browser/qtwebengine_content_renderer_overlay_manifest.h"
#include "net/ssl/client_cert_identity.h"
#include "net/ssl/client_cert_store.h"
+#include "sandbox/policy/switches.h"
#include "services/network/network_service.h"
#include "services/network/public/cpp/features.h"
+#include "services/service_manager/switches.h"
#include "services/service_manager/public/cpp/connector.h"
#include "services/service_manager/public/cpp/service.h"
-#include "services/service_manager/sandbox/switches.h"
#include "storage/browser/quota/quota_settings.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
#include "third_party/blink/public/common/loader/url_loader_throttle.h"
@@ -165,6 +163,7 @@
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "content/public/browser/file_url_loader.h"
#include "extensions/browser/extension_message_filter.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/browser/guest_view/extensions_guest_view_message_filter.h"
#include "extensions/browser/url_loader_factory_manager.h"
#include "extensions/common/constants.h"
@@ -265,7 +264,7 @@ void ContentBrowserClientQt::RenderProcessWillLaunch(content::RenderProcessHost
#endif //ENABLE_EXTENSIONS
bool is_incognito_process = profile->IsOffTheRecord();
- qtwebengine::mojom::RendererConfigurationAssociatedPtr renderer_configuration;
+ mojo::AssociatedRemote<qtwebengine::mojom::RendererConfiguration> renderer_configuration;
host->GetChannel()->GetRemoteAssociatedInterface(&renderer_configuration);
renderer_configuration->SetInitialConfiguration(is_incognito_process);
}
@@ -282,12 +281,16 @@ content::MediaObserver *ContentBrowserClientQt::GetMediaObserver()
return MediaCaptureDevicesDispatcher::GetInstance();
}
-void ContentBrowserClientQt::OverrideWebkitPrefs(content::RenderViewHost *rvh, content::WebPreferences *web_prefs)
+void ContentBrowserClientQt::OverrideWebkitPrefs(content::RenderViewHost *rvh, blink::web_pref::WebPreferences *web_prefs)
{
if (content::WebContents *webContents = rvh->GetDelegate()->GetAsWebContents()) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
if (guest_view::GuestViewBase::IsGuest(webContents))
return;
+
+ WebContentsViewQt *view = WebContentsViewQt::from(static_cast<content::WebContentsImpl *>(webContents)->GetView());
+ if (!view->client())
+ return;
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
WebContentsDelegateQt* delegate = static_cast<WebContentsDelegateQt*>(webContents->GetDelegate());
if (delegate)
@@ -360,7 +363,7 @@ void ContentBrowserClientQt::AppendExtraCommandLineSwitches(base::CommandLine* c
url::CustomScheme::SaveSchemes(command_line);
std::string processType = command_line->GetSwitchValueASCII(switches::kProcessType);
- if (processType == service_manager::switches::kZygoteProcess)
+ if (processType == switches::kZygoteProcess)
command_line->AppendSwitchASCII(switches::kLang, GetApplicationLocale());
}
@@ -469,23 +472,6 @@ private:
WEB_CONTENTS_USER_DATA_KEY_IMPL(ServiceDriver)
-void ContentBrowserClientQt::InitFrameInterfaces()
-{
- m_frameInterfaces = std::make_unique<service_manager::BinderRegistry>();
- m_frameInterfacesParameterized = std::make_unique<service_manager::BinderRegistryWithArgs<content::RenderFrameHost*>>();
-}
-
-void ContentBrowserClientQt::BindInterfaceRequestFromFrame(content::RenderFrameHost* render_frame_host,
- const std::string& interface_name,
- mojo::ScopedMessagePipeHandle interface_pipe)
-{
- if (!m_frameInterfaces.get() && !m_frameInterfacesParameterized.get())
- InitFrameInterfaces();
-
- if (!m_frameInterfacesParameterized->TryBindInterface(interface_name, &interface_pipe, render_frame_host))
- m_frameInterfaces->TryBindInterface(interface_name, &interface_pipe);
-}
-
void ContentBrowserClientQt::BindHostReceiverForRenderer(content::RenderProcessHost *render_process_host,
mojo::GenericPendingReceiver receiver)
{
@@ -505,41 +491,19 @@ static void BindNetworkHintsHandler(content::RenderFrameHost *frame_host,
void ContentBrowserClientQt::RegisterBrowserInterfaceBindersForFrame(
content::RenderFrameHost *render_frame_host,
- service_manager::BinderMapWithContext<content::RenderFrameHost *> *map)
+ mojo::BinderMapWithContext<content::RenderFrameHost *> *map)
{
Q_UNUSED(render_frame_host);
map->Add<blink::mojom::InsecureInputService>(base::BindRepeating(&ServiceDriver::BindInsecureInputService));
map->Add<network_hints::mojom::NetworkHintsHandler>(base::BindRepeating(&BindNetworkHintsHandler));
}
-namespace {
-void BindProcessNode(int render_process_host_id,
- mojo::PendingReceiver<performance_manager::mojom::ProcessCoordinationUnit> receiver)
-{
- content::RenderProcessHost *render_process_host = content::RenderProcessHost::FromID(render_process_host_id);
- if (!render_process_host)
- return;
-
- performance_manager::RenderProcessUserData *user_data =
- performance_manager::RenderProcessUserData::GetForRenderProcessHost(render_process_host);
-
- DCHECK(performance_manager::PerformanceManagerImpl::IsAvailable());
- performance_manager::PerformanceManagerImpl::CallOnGraphImpl(
- FROM_HERE, base::BindOnce(&performance_manager::ProcessNodeImpl::Bind,
- base::Unretained(user_data->process_node()),
- std::move(receiver)));
-}
-} // namespace
-
void ContentBrowserClientQt::ExposeInterfacesToRenderer(service_manager::BinderRegistry *registry,
blink::AssociatedInterfaceRegistry *associated_registry,
content::RenderProcessHost *render_process_host)
{
Q_UNUSED(associated_registry);
- registry->AddInterface(base::BindRepeating(&BindProcessNode, render_process_host->GetID()),
- base::SequencedTaskRunnerHandle::Get());
-
- performance_manager::PerformanceManagerRegistry::GetInstance()->CreateProcessNodeForRenderProcessHost(render_process_host);
+ performance_manager::PerformanceManagerRegistry::GetInstance()->CreateProcessNodeAndExposeInterfacesToRendererProcess(registry, render_process_host);
}
void ContentBrowserClientQt::RunServiceInstance(const service_manager::Identity &identity,
@@ -650,36 +614,41 @@ bool ContentBrowserClientQt::WillCreateRestrictedCookieManager(network::mojom::R
bool ContentBrowserClientQt::AllowAppCache(const GURL &manifest_url,
const GURL &first_party,
+ const base::Optional<url::Origin> &top_frame_origin,
content::BrowserContext *context)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
return static_cast<ProfileQt *>(context)->profileAdapter()->cookieStore()->d_func()->canAccessCookies(toQt(first_party), toQt(manifest_url));
}
-bool ContentBrowserClientQt::AllowServiceWorkerOnIO(const GURL &scope,
+content::AllowServiceWorkerResult
+ContentBrowserClientQt::AllowServiceWorkerOnIO(const GURL &scope,
const GURL &site_for_cookies,
const base::Optional<url::Origin> & /*top_frame_origin*/,
const GURL & /*script_url*/,
- content::ResourceContext *context,
- base::RepeatingCallback<content::WebContents*()> wc_getter)
+ content::ResourceContext *context)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
// FIXME: Chrome also checks if javascript is enabled here to check if has been disabled since the service worker
// was started.
- return ProfileIODataQt::FromResourceContext(context)->canGetCookies(toQt(site_for_cookies), toQt(scope));
+ return ProfileIODataQt::FromResourceContext(context)->canGetCookies(toQt(site_for_cookies), toQt(scope))
+ ? content::AllowServiceWorkerResult::Yes()
+ : content::AllowServiceWorkerResult::No();
}
-bool ContentBrowserClientQt::AllowServiceWorkerOnUI(const GURL &scope,
+content::AllowServiceWorkerResult
+ContentBrowserClientQt::AllowServiceWorkerOnUI(const GURL &scope,
const GURL &site_for_cookies,
const base::Optional<url::Origin> & /*top_frame_origin*/,
const GURL & /*script_url*/,
- content::BrowserContext *context,
- base::RepeatingCallback<content::WebContents*()> wc_getter)
+ content::BrowserContext *context)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
// FIXME: Chrome also checks if javascript is enabled here to check if has been disabled since the service worker
// was started.
- return static_cast<ProfileQt *>(context)->profileAdapter()->cookieStore()->d_func()->canAccessCookies(toQt(site_for_cookies), toQt(scope));
+ return static_cast<ProfileQt *>(context)->profileAdapter()->cookieStore()->d_func()->canAccessCookies(toQt(site_for_cookies), toQt(scope))
+ ? content::AllowServiceWorkerResult::Yes()
+ : content::AllowServiceWorkerResult::No();
}
// We control worker access to FS and indexed-db using cookie permissions, this is mirroring Chromium's logic.
@@ -769,7 +738,8 @@ public:
const network::mojom::URLResponseHead &response_head,
bool *defer,
std::vector<std::string> *to_be_removed_headers,
- net::HttpRequestHeaders *modified_headers) override
+ net::HttpRequestHeaders *modified_headers,
+ net::HttpRequestHeaders *modified_cors_exempt_headers) override
{
TranslateUrl(&redirect_info->new_url);
}
@@ -839,6 +809,11 @@ static bool navigationThrottleCallback(content::WebContents *source,
ProfileQt *profile = static_cast<ProfileQt *>(source->GetBrowserContext());
if (params.is_external_protocol() && !profile->profileAdapter()->urlSchemeHandler(toQByteArray(params.url().scheme())))
return false;
+
+ WebContentsViewQt *view = WebContentsViewQt::from(static_cast<content::WebContentsImpl *>(source)->GetView());
+ if (!view->client())
+ return false;
+
int navigationRequestAction = WebContentsAdapterClient::AcceptRequest;
WebContentsDelegateQt *delegate = static_cast<WebContentsDelegateQt *>(source->GetDelegate());
WebContentsAdapterClient *client = delegate->adapterClient();
@@ -971,22 +946,19 @@ void ContentBrowserClientQt::OnNetworkServiceCreated(network::mojom::NetworkServ
SystemNetworkContextManager::GetInstance()->OnNetworkServiceCreated(network_service);
}
-mojo::Remote<network::mojom::NetworkContext> ContentBrowserClientQt::CreateNetworkContext(
+void ContentBrowserClientQt::ConfigureNetworkContextParams(
content::BrowserContext *context,
bool in_memory,
- const base::FilePath &relative_partition_path)
+ const base::FilePath &relative_partition_path,
+ network::mojom::NetworkContextParams *network_context_params,
+ network::mojom::CertVerifierCreationParams *cert_verifier_creation_params)
{
- mojo::Remote<network::mojom::NetworkContext> network_context;
- // ### do we need to pass in_memory and relative_partition_path to ProfileIODataQt::CreateNetworkContextParams() ?
- network::mojom::NetworkContextParamsPtr context_params = ProfileIODataQt::FromBrowserContext(context)->CreateNetworkContextParams();
- content::GetNetworkService()->CreateNetworkContext(
- network_context.BindNewPipeAndPassReceiver(), std::move(context_params));
+ ProfileIODataQt::FromBrowserContext(context)->ConfigureNetworkContextParams(in_memory, relative_partition_path,
+ network_context_params, cert_verifier_creation_params);
- network::mojom::CookieManagerPtrInfo cookie_manager_info;
- network_context->GetCookieManager(mojo::MakeRequest(&cookie_manager_info));
- ProfileIODataQt::FromBrowserContext(context)->cookieDelegate()->setMojoCookieManager(std::move(cookie_manager_info));
-
- return network_context;
+ mojo::PendingRemote<network::mojom::CookieManager> cookie_manager_remote;
+ network_context_params->cookie_manager = cookie_manager_remote.InitWithNewPipeAndPassReceiver();
+ ProfileIODataQt::FromBrowserContext(context)->cookieDelegate()->setMojoCookieManager(std::move(cookie_manager_remote));
}
std::vector<base::FilePath> ContentBrowserClientQt::GetNetworkContextsParentDirectory()
@@ -997,8 +969,11 @@ std::vector<base::FilePath> ContentBrowserClientQt::GetNetworkContextsParentDire
}
void ContentBrowserClientQt::RegisterNonNetworkNavigationURLLoaderFactories(int frame_tree_node_id,
+ base::UkmSourceId ukm_source_id,
+ NonNetworkURLLoaderFactoryDeprecatedMap *uniquely_owned_factories,
NonNetworkURLLoaderFactoryMap *factories)
{
+ Q_UNUSED(uniquely_owned_factories);
content::WebContents *web_contents = content::WebContents::FromFrameTreeNodeId(frame_tree_node_id);
Profile *profile = Profile::FromBrowserContext(web_contents->GetBrowserContext());
ProfileAdapter *profileAdapter = static_cast<ProfileQt *>(profile)->profileAdapter();
@@ -1009,7 +984,7 @@ void ContentBrowserClientQt::RegisterNonNetworkNavigationURLLoaderFactories(int
#if BUILDFLAG(ENABLE_EXTENSIONS)
factories->emplace(
extensions::kExtensionScheme,
- extensions::CreateExtensionNavigationURLLoaderFactory(profile,
+ extensions::CreateExtensionNavigationURLLoaderFactory(profile, ukm_source_id,
!!extensions::WebViewGuest::FromWebContents(web_contents)));
#endif
}
@@ -1025,8 +1000,10 @@ void ContentBrowserClientQt::RegisterNonNetworkWorkerMainResourceURLLoaderFactor
}
void ContentBrowserClientQt::RegisterNonNetworkSubresourceURLLoaderFactories(int render_process_id, int render_frame_id,
+ NonNetworkURLLoaderFactoryDeprecatedMap *uniquely_owned_factories,
NonNetworkURLLoaderFactoryMap *factories)
{
+ Q_UNUSED(uniquely_owned_factories);
content::RenderProcessHost *process_host = content::RenderProcessHost::FromID(render_process_id);
Profile *profile = Profile::FromBrowserContext(process_host->GetBrowserContext());
ProfileAdapter *profileAdapter = static_cast<ProfileQt *>(profile)->profileAdapter();
@@ -1092,9 +1069,9 @@ void ContentBrowserClientQt::RegisterNonNetworkSubresourceURLLoaderFactories(int
}
if (!allowed_webui_hosts.empty()) {
factories->emplace(content::kChromeUIScheme,
- content::CreateWebUIURLLoader(frame_host,
- content::kChromeUIScheme,
- std::move(allowed_webui_hosts)));
+ content::CreateWebUIURLLoaderFactory(frame_host,
+ content::kChromeUIScheme,
+ std::move(allowed_webui_hosts)));
}
#endif
}
@@ -1106,6 +1083,7 @@ bool ContentBrowserClientQt::WillCreateURLLoaderFactory(
URLLoaderFactoryType type,
const url::Origin &request_initiator,
base::Optional<int64_t> navigation_id,
+ base::UkmSourceId ukm_source_id,
mojo::PendingReceiver<network::mojom::URLLoaderFactory> *factory_receiver,
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient> *header_client,
bool *bypass_redirect_checks,
@@ -1121,6 +1099,9 @@ bool ContentBrowserClientQt::WillCreateURLLoaderFactory(
if (web_contents) {
WebContentsAdapterClient *client =
WebContentsViewQt::from(static_cast<content::WebContentsImpl *>(web_contents)->GetView())->client();
+ if (!client)
+ return false;
+
page_interceptor = client->webContentsAdapter()->requestInterceptor();
}
@@ -1137,4 +1118,36 @@ bool ContentBrowserClientQt::WillCreateURLLoaderFactory(
return false;
}
+void ContentBrowserClientQt::SiteInstanceGotProcess(content::SiteInstance *site_instance)
+{
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+ content::BrowserContext *context = site_instance->GetBrowserContext();
+ extensions::ExtensionRegistry *registry = extensions::ExtensionRegistry::Get(context);
+ const extensions::Extension *extension = registry->enabled_extensions().GetExtensionOrAppByURL(site_instance->GetSiteURL());
+ if (!extension)
+ return;
+
+ extensions::ProcessMap *processMap = extensions::ProcessMap::Get(context);
+ processMap->Insert(extension->id(), site_instance->GetProcess()->GetID(), site_instance->GetId());
+#endif
+}
+
+void ContentBrowserClientQt::SiteInstanceDeleting(content::SiteInstance *site_instance)
+{
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+ // Don't do anything if we're shutting down.
+ if (content::BrowserMainRunner::ExitedMainMessageLoop() || !site_instance->HasProcess())
+ return;
+
+ content::BrowserContext *context = site_instance->GetBrowserContext();
+ extensions::ExtensionRegistry *registry = extensions::ExtensionRegistry::Get(context);
+ const extensions::Extension *extension = registry->enabled_extensions().GetExtensionOrAppByURL(site_instance->GetSiteURL());
+ if (!extension)
+ return;
+
+ extensions::ProcessMap *processMap = extensions::ProcessMap::Get(context);
+ processMap->Remove(extension->id(), site_instance->GetProcess()->GetID(), site_instance->GetId());
+#endif
+}
+
} // namespace QtWebEngineCore
diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h
index 876e6e529..05a814ead 100644
--- a/src/core/content_browser_client_qt.h
+++ b/src/core/content_browser_client_qt.h
@@ -88,7 +88,8 @@ public:
gl::GLShareGroup* GetInProcessGpuShareGroup() override;
content::MediaObserver* GetMediaObserver() override;
scoped_refptr<content::QuotaPermissionContext> CreateQuotaPermissionContext() override;
- void OverrideWebkitPrefs(content::RenderViewHost *, content::WebPreferences *) override;
+ void OverrideWebkitPrefs(content::RenderViewHost *render_view_host,
+ blink::web_pref::WebPreferences *prefs) override;
void AllowCertificateError(content::WebContents *web_contents,
int cert_error,
const net::SSLInfo &ssl_info,
@@ -112,13 +113,10 @@ public:
void GetAdditionalWebUISchemes(std::vector<std::string>* additional_schemes) override;
void GetAdditionalAllowedSchemesForFileSystem(std::vector<std::string>* additional_schemes) override;
- void BindInterfaceRequestFromFrame(content::RenderFrameHost* render_frame_host,
- const std::string& interface_name,
- mojo::ScopedMessagePipeHandle interface_pipe) override;
void BindHostReceiverForRenderer(content::RenderProcessHost *render_process_host,
mojo::GenericPendingReceiver receiver) override;
void RegisterBrowserInterfaceBindersForFrame(content::RenderFrameHost *render_frame_host,
- service_manager::BinderMapWithContext<content::RenderFrameHost *> *map) override;
+ mojo::BinderMapWithContext<content::RenderFrameHost *> *map) override;
void RunServiceInstance(const service_manager::Identity &identity,
mojo::PendingReceiver<service_manager::mojom::Service> *receiver) override;
void ExposeInterfacesToRenderer(service_manager::BinderRegistry *registry,
@@ -155,21 +153,20 @@ public:
bool AllowAppCache(const GURL &manifest_url,
const GURL &first_party,
+ const base::Optional<url::Origin> &top_frame_origin,
content::BrowserContext *context) override;
-
- bool AllowServiceWorkerOnIO(const GURL &scope,
- const GURL &site_for_cookies,
- const base::Optional<url::Origin> &top_frame_origin,
- const GURL &script_url,
- content::ResourceContext *context,
- base::RepeatingCallback<content::WebContents*()> wc_getter) override;
-
- bool AllowServiceWorkerOnUI(const GURL &scope,
- const GURL &site_for_cookies,
- const base::Optional<url::Origin> &top_frame_origin,
- const GURL &script_url,
- content::BrowserContext *context,
- base::RepeatingCallback<content::WebContents*()> wc_getter) override;
+ content::AllowServiceWorkerResult AllowServiceWorkerOnIO(
+ const GURL &scope,
+ const GURL &site_for_cookies,
+ const base::Optional<url::Origin> &top_frame_origin,
+ const GURL &script_url,
+ content::ResourceContext *context) override;
+ content::AllowServiceWorkerResult AllowServiceWorkerOnUI(
+ const GURL &scope,
+ const GURL &site_for_cookies,
+ const base::Optional<url::Origin> &top_frame_origin,
+ const GURL &script_url,
+ content::BrowserContext *context) override;
void AllowWorkerFileSystem(const GURL &url,
content::BrowserContext *context,
@@ -239,6 +236,7 @@ public:
URLLoaderFactoryType type,
const url::Origin &request_initiator,
base::Optional<int64_t> navigation_id,
+ base::UkmSourceId ukm_source_id,
mojo::PendingReceiver<network::mojom::URLLoaderFactory> *factory_receiver,
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient> *header_client,
bool *bypass_redirect_checks,
@@ -247,15 +245,23 @@ public:
scoped_refptr<network::SharedURLLoaderFactory> GetSystemSharedURLLoaderFactory() override;
network::mojom::NetworkContext *GetSystemNetworkContext() override;
void OnNetworkServiceCreated(network::mojom::NetworkService *network_service) override;
- mojo::Remote<network::mojom::NetworkContext> CreateNetworkContext(content::BrowserContext *context,
- bool in_memory,
- const base::FilePath &relative_partition_path) override;
+ void ConfigureNetworkContextParams(content::BrowserContext *context,
+ bool in_memory,
+ const base::FilePath &relative_partition_path,
+ network::mojom::NetworkContextParams *network_context_params,
+ network::mojom::CertVerifierCreationParams *cert_verifier_creation_params) override;
+
std::vector<base::FilePath> GetNetworkContextsParentDirectory() override;
- void RegisterNonNetworkNavigationURLLoaderFactories(int frame_tree_node_id, NonNetworkURLLoaderFactoryMap *factories) override;
+ void RegisterNonNetworkNavigationURLLoaderFactories(int frame_tree_node_id, base::UkmSourceId ukm_source_id,
+ NonNetworkURLLoaderFactoryDeprecatedMap *uniquely_owned_factories,
+ NonNetworkURLLoaderFactoryMap *factories) override;
void RegisterNonNetworkSubresourceURLLoaderFactories(int render_process_id, int render_frame_id,
- NonNetworkURLLoaderFactoryMap* factories) override;
+ NonNetworkURLLoaderFactoryDeprecatedMap *uniquely_owned_factories,
+ NonNetworkURLLoaderFactoryMap *factories) override;
void RegisterNonNetworkWorkerMainResourceURLLoaderFactories(content::BrowserContext* browser_context,
NonNetworkURLLoaderFactoryMap* factories) override;
+ void SiteInstanceGotProcess(content::SiteInstance *site_instance) override;
+ void SiteInstanceDeleting(content::SiteInstance *site_instance) override;
static std::string getUserAgent();
@@ -263,11 +269,7 @@ public:
std::string GetProduct() override;
private:
- void InitFrameInterfaces();
-
scoped_refptr<ShareGroupQt> m_shareGroupQt;
- std::unique_ptr<service_manager::BinderRegistry> m_frameInterfaces;
- std::unique_ptr<service_manager::BinderRegistryWithArgs<content::RenderFrameHost*>> m_frameInterfacesParameterized;
};
} // namespace QtWebEngineCore
diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp
index 647d45819..d74e7eb76 100644
--- a/src/core/content_client_qt.cpp
+++ b/src/core/content_client_qt.cpp
@@ -54,7 +54,7 @@
#include "ui/base/layout.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
-#include "services/service_manager/embedder/switches.h"
+#include "services/service_manager/switches.h"
#include "type_conversion.h"
#include <QCoreApplication>
@@ -71,7 +71,7 @@
// File name of the CDM on different platforms.
const char kWidevineCdmFileName[] =
-#if defined(OS_MACOSX)
+#if defined(OS_MAC)
"widevinecdm.plugin";
#elif defined(OS_WIN)
"widevinecdm.dll";
@@ -422,8 +422,7 @@ void ContentClientQt::AddContentDecryptionModules(std::vector<content::CdmInfo>
content::CdmCapability capability(
{}, {media::EncryptionScheme::kCenc, media::EncryptionScheme::kCbcs},
{media::CdmSessionType::kTemporary,
- media::CdmSessionType::kPersistentLicense},
- {});
+ media::CdmSessionType::kPersistentLicense});
// Register kExternalClearKeyDifferentGuidTestKeySystem first separately.
// Otherwise, it'll be treated as a sub-key-system of normal
diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp
index cf8582ef2..59d7050a4 100644
--- a/src/core/content_main_delegate_qt.cpp
+++ b/src/core/content_main_delegate_qt.cpp
@@ -42,6 +42,7 @@
#include "base/command_line.h"
#include "base/i18n/rtl.h"
#include "base/logging.h"
+#include "base/no_destructor.h"
#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/grit/generated_resources.h"
@@ -55,8 +56,8 @@
#include "ui/base/webui/jstemplate_builder.h"
#include "net/grit/net_resources.h"
#include "net/base/net_module.h"
-#include "services/service_manager/embedder/switches.h"
-#include "services/service_manager/sandbox/switches.h"
+#include "sandbox/policy/switches.h"
+#include "services/service_manager/switches.h"
#include "url/url_util_qt.h"
#include "content_client_qt.h"
@@ -82,7 +83,7 @@
#include "media/gpu/windows/media_foundation_video_encode_accelerator_win.h"
#endif
-#if defined(OS_MACOSX)
+#if defined(OS_MAC)
#include "content/public/common/content_features.h"
#include "media/gpu/mac/vt_video_decode_accelerator_mac.h"
#endif
@@ -216,7 +217,7 @@ void ContentMainDelegateQt::PreSandboxStartup()
media::MediaFoundationVideoEncodeAccelerator::PreSandboxInitialization();
#endif
-#if defined(OS_MACOSX)
+#if defined(OS_MAC)
if (base::FeatureList::IsEnabled(features::kMacV2GPUSandbox)) {
TRACE_EVENT0("gpu", "Initialize VideoToolbox");
media::InitializeVideoToolbox();
@@ -260,7 +261,7 @@ content::ContentRendererClient *ContentMainDelegateQt::CreateContentRendererClie
#if defined(OS_LINUX)
base::CommandLine *parsedCommandLine = base::CommandLine::ForCurrentProcess();
std::string process_type = parsedCommandLine->GetSwitchValueASCII(switches::kProcessType);
- bool no_sandbox = parsedCommandLine->HasSwitch(service_manager::switches::kNoSandbox);
+ bool no_sandbox = parsedCommandLine->HasSwitch(sandbox::policy::switches::kNoSandbox);
// Reload locale if the renderer process is sandboxed
if (process_type == switches::kRendererProcess && !no_sandbox) {
diff --git a/src/core/core_chromium.pri b/src/core/core_chromium.pri
index 63e9718e7..c22d5901f 100644
--- a/src/core/core_chromium.pri
+++ b/src/core/core_chromium.pri
@@ -323,11 +323,13 @@ qtConfig(webengine-extensions) {
common/extensions/extensions_api_provider_qt.cpp \
common/extensions/extensions_client_qt.cpp \
extensions/component_extension_resource_manager_qt.cpp \
+ extensions/extension_host_delegate_qt.cpp \
extensions/extension_system_qt.cpp \
extensions/extension_system_factory_qt.cpp \
extensions/extension_web_contents_observer_qt.cpp \
extensions/extensions_api_client_qt.cpp \
extensions/extensions_browser_client_qt.cpp \
+ extensions/messaging_delegate_qt.cpp \
extensions/mime_handler_view_guest_delegate_qt.cpp \
net/plugin_response_interceptor_url_loader_throttle.cpp \
renderer/extensions/extensions_dispatcher_delegate_qt.cpp \
@@ -339,11 +341,13 @@ qtConfig(webengine-extensions) {
common/extensions/extensions_api_provider_qt.h \
common/extensions/extensions_client_qt.h \
extensions/component_extension_resource_manager_qt.h \
+ extensions/extension_host_delegate_qt.h \
extensions/extension_system_qt.h \
extensions/extension_system_factory_qt.h \
extensions/extension_web_contents_observer_qt.h \
extensions/extensions_api_client_qt.h \
extensions/extensions_browser_client_qt.h \
+ extensions/messaging_delegate_qt.h \
extensions/mime_handler_view_guest_delegate_qt.h \
net/plugin_response_interceptor_url_loader_throttle.h \
renderer/extensions/extensions_dispatcher_delegate_qt.h \
diff --git a/src/core/core_module.pro b/src/core/core_module.pro
index 3b439e818..733e40534 100644
--- a/src/core/core_module.pro
+++ b/src/core/core_module.pro
@@ -41,7 +41,11 @@ QMAKE_INFO_PLIST = Info_mac.plist
# and doesn't let Chromium get access to libc symbols through dlsym.
CONFIG -= bsymbolic_functions
-linux:qtConfig(separate_debug_info): QMAKE_POST_LINK="cd $(DESTDIR) && $(STRIP) --strip-unneeded $(TARGET)"
+linux {
+ QMAKE_LINK="ulimit -n 4096 && $$QMAKE_LINK"
+ QMAKE_LINK_SHLIB="ulimit -n 4096 && $$QMAKE_LINK_SHLIB"
+ qtConfig(separate_debug_info): QMAKE_POST_LINK="cd $(DESTDIR) && $(STRIP) --strip-unneeded $(TARGET)"
+}
REPACK_DIR = $$OUT_PWD/$$getConfigDir()
diff --git a/src/core/desktop_screen_qt.cpp b/src/core/desktop_screen_qt.cpp
index 15a3856fc..1f715444b 100644
--- a/src/core/desktop_screen_qt.cpp
+++ b/src/core/desktop_screen_qt.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtWebEngine module of the Qt Toolkit.
@@ -40,74 +40,20 @@
#include "desktop_screen_qt.h"
#include "ui/display/display.h"
-#include "ui/gfx/geometry/point.h"
-
-#include <QtGlobal>
namespace QtWebEngineCore {
-gfx::Point DesktopScreenQt::GetCursorScreenPoint()
-{
- Q_UNREACHABLE();
- return gfx::Point();
-}
-
-bool DesktopScreenQt::IsWindowUnderCursor(gfx::NativeWindow)
-{
- Q_UNREACHABLE();
- return false;
-}
-
-gfx::NativeWindow DesktopScreenQt::GetWindowAtScreenPoint(const gfx::Point& point)
+DesktopScreenQt::DesktopScreenQt()
{
- Q_UNREACHABLE();
- return gfx::NativeWindow();
+ ProcessDisplayChanged(display::Display::GetDefaultDisplay(), true /* is_primary */);
}
-int DesktopScreenQt::GetNumDisplays() const
-{
- Q_UNREACHABLE();
- return 0;
-}
-
-std::vector<display::Display>& DesktopScreenQt::GetAllDisplays() const
-{
- static std::vector<display::Display> empty;
- return empty;
-}
-
-display::Display DesktopScreenQt::GetDisplayNearestWindow(gfx::NativeWindow window) const
-{
- // RenderViewHostImpl::OnStartDragging uses this to determine
- // the scale factor for the view.
- return display::Display(0);
-}
-
-display::Display DesktopScreenQt::GetDisplayNearestPoint(const gfx::Point& point) const
-{
- Q_UNREACHABLE();
- return display::Display();
-}
-
-display::Display DesktopScreenQt::GetDisplayMatching(const gfx::Rect& match_rect) const
-{
- Q_UNREACHABLE();
- return display::Display();
-}
-
-display::Display DesktopScreenQt::GetPrimaryDisplay() const
-{
- return display::Display(0);
-}
-
-void DesktopScreenQt::AddObserver(display::DisplayObserver* observer)
-{
- Q_UNREACHABLE();
-}
+DesktopScreenQt::~DesktopScreenQt()
+{}
-void DesktopScreenQt::RemoveObserver(display::DisplayObserver* observer)
+display::Display DesktopScreenQt::GetDisplayNearestWindow(gfx::NativeWindow /*window*/) const
{
- Q_UNREACHABLE();
+ return GetPrimaryDisplay();
}
} // namespace QtWebEngineCore
diff --git a/src/core/desktop_screen_qt.h b/src/core/desktop_screen_qt.h
index 0c52c615a..f47cfabbc 100644
--- a/src/core/desktop_screen_qt.h
+++ b/src/core/desktop_screen_qt.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtWebEngine module of the Qt Toolkit.
@@ -40,24 +40,17 @@
#ifndef DESKTOP_SCREEN_QT_H
#define DESKTOP_SCREEN_QT_H
-#include "ui/display/screen.h"
+#include "ui/display/screen_base.h"
namespace QtWebEngineCore {
-class DesktopScreenQt : public display::Screen {
+class DesktopScreenQt : public display::ScreenBase
+{
public:
- // Overridden from gfx::Screen:
- gfx::Point GetCursorScreenPoint() override;
- bool IsWindowUnderCursor(gfx::NativeWindow) override;
- gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override;
- int GetNumDisplays() const override;
- std::vector<display::Display>& GetAllDisplays() const override;
- display::Display GetDisplayNearestWindow(gfx::NativeWindow window) const override;
- display::Display GetDisplayNearestPoint(const gfx::Point& point) const override;
- display::Display GetDisplayMatching(const gfx::Rect& match_rect) const override;
- display::Display GetPrimaryDisplay() const override;
- void AddObserver(display::DisplayObserver* observer) override;
- void RemoveObserver(display::DisplayObserver* observer) override;
+ DesktopScreenQt();
+ ~DesktopScreenQt() override;
+
+ display::Display GetDisplayNearestWindow(gfx::NativeWindow /*window*/) const override;
};
} // namespace QtWebEngineCore
diff --git a/src/core/devtools_frontend_qt.cpp b/src/core/devtools_frontend_qt.cpp
index da82a46d3..028f5f0d3 100644
--- a/src/core/devtools_frontend_qt.cpp
+++ b/src/core/devtools_frontend_qt.cpp
@@ -442,11 +442,11 @@ void DevToolsFrontendQt::HandleMessageFromDevToolsFrontend(const std::string &me
resource_request->site_for_cookies = net::SiteForCookies::FromUrl(gurl);
resource_request->headers.AddHeadersFromString(headers);
- std::unique_ptr<network::mojom::URLLoaderFactory> file_url_loader_factory;
+ mojo::Remote<network::mojom::URLLoaderFactory> file_url_loader_factory;
scoped_refptr<network::SharedURLLoaderFactory> network_url_loader_factory;
network::mojom::URLLoaderFactory *url_loader_factory;
if (gurl.SchemeIsFile()) {
- file_url_loader_factory = content::CreateFileURLLoaderFactory(base::FilePath(), nullptr);
+ file_url_loader_factory.Bind(content::CreateFileURLLoaderFactory(base::FilePath(), nullptr));
url_loader_factory = file_url_loader_factory.get();
} else if (content::HasWebUIScheme(gurl)) {
base::DictionaryValue response;
diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp
index 3760ebb49..b3abf6bdd 100644
--- a/src/core/download_manager_delegate_qt.cpp
+++ b/src/core/download_manager_delegate_qt.cpp
@@ -94,6 +94,7 @@ void DownloadManagerDelegateQt::cancelDownload(content::DownloadTargetCallback c
download::DownloadDangerType::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT,
download::DownloadItem::UNKNOWN,
base::FilePath(),
+ base::nullopt,
download::DownloadInterruptReason::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED);
}
@@ -134,6 +135,7 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem *
download::DownloadDangerType::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
download::DownloadItem::VALIDATED,
item->GetForcedFilePath(),
+ base::nullopt,
download::DownloadInterruptReason::DOWNLOAD_INTERRUPT_REASON_NONE);
return true;
}
@@ -214,6 +216,7 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem *
download::DownloadDangerType::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT,
download::DownloadItem::VALIDATED,
filePathForCallback.AddExtension(toFilePathString("download")),
+ base::nullopt,
download::DownloadInterruptReason::DOWNLOAD_INTERRUPT_REASON_NONE);
} else
cancelDownload(std::move(*callback));
diff --git a/src/core/extensions/component_extension_resource_manager_qt.h b/src/core/extensions/component_extension_resource_manager_qt.h
index b719c8960..992e9f87c 100644
--- a/src/core/extensions/component_extension_resource_manager_qt.h
+++ b/src/core/extensions/component_extension_resource_manager_qt.h
@@ -47,6 +47,7 @@
#include <map>
#include "base/files/file_path.h"
+#include "base/macros.h"
#include "extensions/browser/component_extension_resource_manager.h"
struct GritResourceMap;
diff --git a/src/core/extensions/extension_host_delegate_qt.cpp b/src/core/extensions/extension_host_delegate_qt.cpp
new file mode 100644
index 000000000..1a44dee7a
--- /dev/null
+++ b/src/core/extensions/extension_host_delegate_qt.cpp
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "extension_host_delegate_qt.h"
+#include "extension_web_contents_observer_qt.h"
+#include "media_capture_devices_dispatcher.h"
+#include "extension_system_qt.h"
+
+#include "extensions/browser/extension_host.h"
+
+namespace extensions {
+
+ExtensionHostDelegateQt::ExtensionHostDelegateQt()
+{
+}
+
+void ExtensionHostDelegateQt::OnExtensionHostCreated(content::WebContents *web_contents)
+{
+ extensions::ExtensionWebContentsObserverQt::CreateForWebContents(web_contents);
+}
+
+void ExtensionHostDelegateQt::OnRenderViewCreatedForBackgroundPage(ExtensionHost *host)
+{
+ Q_UNUSED(host);
+}
+
+content::JavaScriptDialogManager *ExtensionHostDelegateQt::GetJavaScriptDialogManager()
+{
+ Q_UNREACHABLE();
+ return nullptr;
+}
+
+void ExtensionHostDelegateQt::CreateTab(std::unique_ptr<content::WebContents> web_contents,
+ const std::string &extension_id,
+ WindowOpenDisposition disposition,
+ const gfx::Rect &initial_rect,
+ bool user_gesture)
+{
+ Q_UNUSED(web_contents);
+ Q_UNUSED(extension_id);
+ Q_UNUSED(disposition);
+ Q_UNUSED(initial_rect);
+ Q_UNUSED(user_gesture);
+
+ Q_UNREACHABLE();
+}
+
+void ExtensionHostDelegateQt::ProcessMediaAccessRequest(content::WebContents *web_contents,
+ const content::MediaStreamRequest &request,
+ content::MediaResponseCallback callback,
+ const Extension *extension)
+{
+ Q_UNUSED(extension);
+
+ QtWebEngineCore::MediaCaptureDevicesDispatcher::GetInstance()->processMediaAccessRequest(web_contents, request, std::move(callback));
+}
+
+bool ExtensionHostDelegateQt::CheckMediaAccessPermission(content::RenderFrameHost *render_frame_host,
+ const GURL &security_origin,
+ blink::mojom::MediaStreamType type,
+ const Extension *extension)
+{
+ Q_UNUSED(render_frame_host);
+ Q_UNUSED(security_origin);
+ Q_UNUSED(type);
+ Q_UNUSED(extension);
+
+ Q_UNREACHABLE();
+ return false;
+}
+
+content::PictureInPictureResult ExtensionHostDelegateQt::EnterPictureInPicture(content::WebContents *web_contents,
+ const viz::SurfaceId &surface_id,
+ const gfx::Size &natural_size)
+{
+ Q_UNUSED(web_contents);
+ Q_UNUSED(surface_id);
+ Q_UNUSED(natural_size);
+
+ Q_UNREACHABLE();
+ return content::PictureInPictureResult::kNotSupported;
+}
+
+void ExtensionHostDelegateQt::ExitPictureInPicture()
+{
+ Q_UNREACHABLE();
+}
+
+} // namespace extensions
diff --git a/src/core/extensions/extension_host_delegate_qt.h b/src/core/extensions/extension_host_delegate_qt.h
new file mode 100644
index 000000000..42ff56a53
--- /dev/null
+++ b/src/core/extensions/extension_host_delegate_qt.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef EXTENSION_HOST_DELEGATE_QT_H
+#define EXTENSION_HOST_DELEGATE_QT_H
+
+#include "extensions/browser/extension_host_delegate.h"
+
+namespace extensions {
+
+class ExtensionHostDelegateQt : public ExtensionHostDelegate
+{
+public:
+ ExtensionHostDelegateQt();
+
+ // EtensionHostDelegate implementation.
+ void OnExtensionHostCreated(content::WebContents *web_contents) override;
+ void OnRenderViewCreatedForBackgroundPage(ExtensionHost *host) override;
+ content::JavaScriptDialogManager *GetJavaScriptDialogManager() override;
+ void CreateTab(std::unique_ptr<content::WebContents> web_contents,
+ const std::string &extension_id,
+ WindowOpenDisposition disposition,
+ const gfx::Rect &initial_rect,
+ bool user_gesture) override;
+ void ProcessMediaAccessRequest(content::WebContents *web_contents,
+ const content::MediaStreamRequest &request,
+ content::MediaResponseCallback callback,
+ const Extension *extension) override;
+ bool CheckMediaAccessPermission(content::RenderFrameHost *render_frame_host,
+ const GURL &security_origin,
+ blink::mojom::MediaStreamType type,
+ const Extension *extension) override;
+ content::PictureInPictureResult EnterPictureInPicture(content::WebContents *web_contents,
+ const viz::SurfaceId &surface_id,
+ const gfx::Size &natural_size) override;
+ void ExitPictureInPicture() override;
+};
+
+} // namespace extensions
+
+#endif // EXTENSION_HOST_DELEGATE_QT_H
diff --git a/src/core/extensions/extension_system_qt.cpp b/src/core/extensions/extension_system_qt.cpp
index 96532d9f6..9c080e9aa 100644
--- a/src/core/extensions/extension_system_qt.cpp
+++ b/src/core/extensions/extension_system_qt.cpp
@@ -61,6 +61,7 @@
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
+#include "chrome/common/buildflags.h"
#include "components/crx_file/id_util.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
@@ -83,11 +84,10 @@
#include "extensions/browser/quota_service.h"
#include "extensions/browser/renderer_startup_helper.h"
#include "extensions/browser/runtime_data.h"
-#include "extensions/browser/shared_user_script_master.h"
+#include "extensions/browser/shared_user_script_manager.h"
#include "extensions/browser/service_worker_manager.h"
#include "extensions/browser/value_store/value_store_factory_impl.h"
#include "extensions/common/constants.h"
-#include "extensions/common/extension_messages.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_handlers/mime_types_handler.h"
#include "extensions/common/manifest_url_handlers.h"
@@ -278,9 +278,9 @@ ManagementPolicy *ExtensionSystemQt::management_policy()
return nullptr;
}
-SharedUserScriptMaster *ExtensionSystemQt::shared_user_script_master()
+SharedUserScriptManager *ExtensionSystemQt::shared_user_script_manager()
{
- return shared_user_script_master_.get();
+ return shared_user_script_manager_.get();
}
StateStore *ExtensionSystemQt::state_store()
@@ -349,8 +349,8 @@ void ExtensionSystemQt::Init(bool extensions_enabled)
quota_service_.reset(new QuotaService);
app_sorting_.reset(new NullAppSorting);
- shared_user_script_master_ =
- std::make_unique<SharedUserScriptMaster>(browser_context_);
+ shared_user_script_manager_ =
+ std::make_unique<SharedUserScriptManager>(browser_context_);
// Make the chrome://extension-icon/ resource available.
// content::URLDataSource::Add(browser_context_, new ExtensionIconSource(browser_context_));
@@ -358,20 +358,30 @@ void ExtensionSystemQt::Init(bool extensions_enabled)
if (extensions_enabled) {
// Inform the rest of the extensions system to start.
ready_.Signal();
- content::NotificationService::current()->Notify(
- NOTIFICATION_EXTENSIONS_READY_DEPRECATED,
- content::Source<content::BrowserContext>(browser_context_),
- content::NotificationService::NoDetails());
-
- std::string pdf_manifest = ui::ResourceBundle::GetSharedInstance().GetRawDataResource(IDR_PDF_MANIFEST).as_string();
- base::ReplaceFirstSubstringAfterOffset(&pdf_manifest, 0, "<NAME>", "chromium-pdf");
-
- std::unique_ptr<base::DictionaryValue> pdfManifestDict = ParseManifest(pdf_manifest);
- base::FilePath path;
- base::PathService::Get(base::DIR_QT_LIBRARY_DATA, &path);
- path = path.Append(base::FilePath(FILE_PATH_LITERAL("pdf")));
- std::string id = GenerateId(pdfManifestDict.get(), path);
- LoadExtension(id, std::move(pdfManifestDict), path);
+
+ {
+ std::string pdf_manifest = ui::ResourceBundle::GetSharedInstance().GetRawDataResource(IDR_PDF_MANIFEST).as_string();
+ base::ReplaceFirstSubstringAfterOffset(&pdf_manifest, 0, "<NAME>", "chromium-pdf");
+
+ std::unique_ptr<base::DictionaryValue> pdfManifestDict = ParseManifest(pdf_manifest);
+ base::FilePath path;
+ base::PathService::Get(base::DIR_QT_LIBRARY_DATA, &path);
+ path = path.Append(base::FilePath(FILE_PATH_LITERAL("pdf")));
+ std::string id = GenerateId(pdfManifestDict.get(), path);
+ LoadExtension(id, std::move(pdfManifestDict), path);
+ }
+
+#if BUILDFLAG(ENABLE_HANGOUT_SERVICES_EXTENSION)
+ {
+ std::string hangout_manifest = ui::ResourceBundle::GetSharedInstance().GetRawDataResource(IDR_HANGOUT_SERVICES_MANIFEST).as_string();
+ std::unique_ptr<base::DictionaryValue> hangoutManifestDict = ParseManifest(hangout_manifest);
+ base::FilePath path;
+ base::PathService::Get(base::DIR_QT_LIBRARY_DATA, &path);
+ path = path.Append(base::FilePath(FILE_PATH_LITERAL("hangout_services")));
+ std::string id = GenerateId(hangoutManifestDict.get(), path);
+ LoadExtension(id, std::move(hangoutManifestDict), path);
+ }
+#endif // BUILDFLAG(ENABLE_HANGOUT_SERVICES_EXTENSION)
}
}
@@ -390,19 +400,6 @@ std::unique_ptr<ExtensionSet> ExtensionSystemQt::GetDependentExtensions(const Ex
return base::WrapUnique(new ExtensionSet());
}
-#if !defined(TOOLKIT_QT)
-void ExtensionSystemQt::InstallUpdate(const std::string &extension_id,
- const std::string &public_key,
- const base::FilePath &unpacked_dir,
- bool install_immediately,
- InstallUpdateCallback install_update_callback)
-{
- NOTREACHED() << "Not yet implemented";
- base::DeleteFile(unpacked_dir, true /* recursive */);
- std::move(install_update_callback).Run(CrxInstallError(CrxInstallErrorType::DECLINED, CrxInstallErrorDetail::DISALLOWED_BY_POLICY));
-}
-#endif
-
void ExtensionSystemQt::RegisterExtensionWithRequestContexts(const Extension *extension,
base::OnceClosure callback)
{
@@ -426,4 +423,10 @@ void ExtensionSystemQt::UnregisterExtensionWithRequestContexts(const std::string
FROM_HERE, {BrowserThread::IO},
base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason));
}
+
+bool ExtensionSystemQt::is_ready() const
+{
+ return ready_.is_signaled();
+}
+
} // namespace extensions
diff --git a/src/core/extensions/extension_system_qt.h b/src/core/extensions/extension_system_qt.h
index e3762e8a6..59835657a 100644
--- a/src/core/extensions/extension_system_qt.h
+++ b/src/core/extensions/extension_system_qt.h
@@ -89,7 +89,7 @@ public:
RuntimeData *runtime_data() override;
ManagementPolicy *management_policy() override;
ServiceWorkerManager *service_worker_manager() override;
- SharedUserScriptMaster *shared_user_script_master() override;
+ SharedUserScriptManager *shared_user_script_manager() override;
StateStore *state_store() override;
StateStore *rules_store() override;
scoped_refptr<ValueStoreFactory> store_factory() override;
@@ -106,20 +106,14 @@ public:
ContentVerifier *content_verifier() override;
std::unique_ptr<ExtensionSet> GetDependentExtensions(const Extension *extension) override;
-#if !defined(TOOLKIT_QT)
- void InstallUpdate(const std::string &extension_id,
- const std::string &public_key,
- const base::FilePath &unpacked_dir,
- bool install_immediately,
- InstallUpdateCallback install_update_callback) override;
-#endif // TOOLKIT_QT
- //friend class ExtensionSystemSharedFactory;
-
bool FinishDelayedInstallationIfReady(const std::string &extension_id, bool install_immediately) override;
void Init(bool extensions_enabled);
const base::OneShotEvent &ready() const override { return ready_; }
+ bool is_ready() const override;
+
+ void PerformActionBasedOnOmahaAttributes(const std::string &, const base::Value &) override { /* fixme? */}
private:
void OnExtensionRegisteredWithRequestContexts(scoped_refptr<const extensions::Extension> extension);
@@ -135,7 +129,7 @@ private:
std::unique_ptr<RuntimeData> runtime_data_;
std::unique_ptr<QuotaService> quota_service_;
std::unique_ptr<AppSorting> app_sorting_;
- std::unique_ptr<SharedUserScriptMaster> shared_user_script_master_;
+ std::unique_ptr<SharedUserScriptManager> shared_user_script_manager_;
// For verifying the contents of extensions read from disk.
diff --git a/src/core/extensions/extensions_api_client_qt.cpp b/src/core/extensions/extensions_api_client_qt.cpp
index 731b79a63..81d9efde2 100644
--- a/src/core/extensions/extensions_api_client_qt.cpp
+++ b/src/core/extensions/extensions_api_client_qt.cpp
@@ -43,13 +43,13 @@
// found in the LICENSE file.
#include "extensions_api_client_qt.h"
+#include "messaging_delegate_qt.h"
#include <memory>
-//#include "base/memory/ptr_util.h"
-#include "extension_web_contents_observer_qt.h"
#include "components/pdf/browser/pdf_web_contents_helper.h"
#include "extensions/browser/guest_view/extensions_guest_view_manager_delegate.h"
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest_delegate.h"
+#include "extension_web_contents_observer_qt.h"
#include "printing/print_view_manager_qt.h"
namespace extensions {
@@ -82,4 +82,11 @@ void ExtensionsAPIClientQt::AttachWebContentsHelpers(content::WebContents *web_c
ExtensionWebContentsObserverQt::CreateForWebContents(web_contents);
}
+MessagingDelegate *ExtensionsAPIClientQt::GetMessagingDelegate()
+{
+ if (!m_messagingDelegate)
+ m_messagingDelegate = std::make_unique<MessagingDelegateQt>();
+ return m_messagingDelegate.get();
+}
+
} // namespace extensions
diff --git a/src/core/extensions/extensions_api_client_qt.h b/src/core/extensions/extensions_api_client_qt.h
index 2fa69f539..b1b6356e8 100644
--- a/src/core/extensions/extensions_api_client_qt.h
+++ b/src/core/extensions/extensions_api_client_qt.h
@@ -49,6 +49,8 @@
namespace extensions {
+class MessagingDelegate;
+
class ExtensionsAPIClientQt : public ExtensionsAPIClient
{
public:
@@ -61,6 +63,10 @@ public:
std::unique_ptr<MimeHandlerViewGuestDelegate>
CreateMimeHandlerViewGuestDelegate(MimeHandlerViewGuest *guest) const override;
void AttachWebContentsHelpers(content::WebContents *web_contents) const override;
+ MessagingDelegate *GetMessagingDelegate() override;
+
+private:
+ std::unique_ptr<MessagingDelegate> m_messagingDelegate;
};
} // namespace extensions
diff --git a/src/core/extensions/extensions_browser_client_qt.cpp b/src/core/extensions/extensions_browser_client_qt.cpp
index b285aadd8..6bcf37d85 100644
--- a/src/core/extensions/extensions_browser_client_qt.cpp
+++ b/src/core/extensions/extensions_browser_client_qt.cpp
@@ -49,25 +49,24 @@
#include "base/files/file_path.h"
#include "base/memory/weak_ptr.h"
#include "base/path_service.h"
-#include "base/strings/stringprintf.h"
#include "base/task/post_task.h"
#include "base/memory/ref_counted_memory.h"
+#include "chrome/browser/extensions/api/generated_api_registration.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/browser_context.h"
-#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_frame_host.h"
#include "extensions/browser/api/extensions_api_client.h"
#include "extensions/browser/api/runtime/runtime_api_delegate.h"
-#include "extensions/browser/app_sorting.h"
#include "extensions/browser/core_extensions_browser_api_provider.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_host_delegate.h"
#include "extensions/browser/extension_protocols.h"
+#include "extensions/browser/extensions_browser_api_provider.h"
#include "extensions/browser/extensions_browser_interface_binders.h"
#include "extensions/browser/url_request_util.h"
#include "extensions/common/file_util.h"
-#include "net/base/completion_once_callback.h"
#include "net/base/mime_util.h"
+#include "qtwebengine/browser/extensions/api/generated_api_registration.h"
#include "services/network/public/mojom/url_loader.mojom.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "third_party/zlib/google/compression_utils.h"
@@ -78,10 +77,10 @@
#include "extension_web_contents_observer_qt.h"
#include "extensions_api_client_qt.h"
#include "extensions_browser_client_qt.h"
+#include "extension_host_delegate_qt.h"
#include "web_engine_library_info.h"
using content::BrowserContext;
-using content::BrowserThread;
namespace {
@@ -111,29 +110,13 @@ scoped_refptr<base::RefCountedMemory> GetResource(int resource_id, const std::st
extension_id)
: nullptr;
- bool is_gzipped = rb.IsGzipped(resource_id);
- if (!bytes->size() || (!replacements && !is_gzipped)) {
- return bytes;
- }
-
- base::StringPiece input(reinterpret_cast<const char *>(bytes->front()), bytes->size());
-
- std::string temp_str;
-
- base::StringPiece source = input;
- if (is_gzipped) {
- temp_str.resize(compression::GetUncompressedSize(input));
- source = temp_str;
- CHECK(compression::GzipUncompress(input, source));
- }
-
if (replacements) {
- temp_str = ui::ReplaceTemplateExpressions(source, *replacements);
+ base::StringPiece input(reinterpret_cast<const char *>(bytes->front()), bytes->size());
+ std::string temp_str = ui::ReplaceTemplateExpressions(input, *replacements);
+ DCHECK(!temp_str.empty());
+ return base::RefCountedString::TakeString(&temp_str);
}
-
- DCHECK(!temp_str.empty());
-
- return base::RefCountedString::TakeString(&temp_str);
+ return bytes;
}
// Loads an extension resource in a Chrome .pak file. These are used by
@@ -156,7 +139,9 @@ public:
// mojom::URLLoader implementation:
void FollowRedirect(const std::vector<std::string> &removed_headers,
- const net::HttpRequestHeaders &modified_headers, const base::Optional<GURL> &new_url) override
+ const net::HttpRequestHeaders &modified_headers,
+ const net::HttpRequestHeaders &modified_cors_exempt_headers,
+ const base::Optional<GURL> &new_url) override
{
NOTREACHED() << "No redirects for local file loads.";
}
@@ -210,11 +195,10 @@ private:
return;
}
head->headers = response_headers_;
- head->headers->AddHeader(base::StringPrintf("%s: %s", net::HttpRequestHeaders::kContentLength,
- base::NumberToString(head->content_length).c_str()));
+ head->headers->AddHeader(net::HttpRequestHeaders::kContentLength,
+ base::NumberToString(head->content_length).c_str());
if (!head->mime_type.empty()) {
- head->headers->AddHeader(
- base::StringPrintf("%s: %s", net::HttpRequestHeaders::kContentType, head->mime_type.c_str()));
+ head->headers->AddHeader(net::HttpRequestHeaders::kContentType, head->mime_type.c_str());
}
client_->OnReceiveResponse(std::move(head));
client_->OnStartLoadingResponseBody(std::move(pipe.consumer_handle));
@@ -266,11 +250,46 @@ private:
namespace extensions {
+// Copied from chrome/browser/extensions/chrome_extensions_browser_api_provider.(h|cc)
+class ChromeExtensionsBrowserAPIProvider : public ExtensionsBrowserAPIProvider
+{
+public:
+ ChromeExtensionsBrowserAPIProvider() = default;
+ ~ChromeExtensionsBrowserAPIProvider() override = default;
+
+ void RegisterExtensionFunctions(ExtensionFunctionRegistry *registry) override
+ {
+ // Generated APIs from Chrome.
+ api::ChromeGeneratedFunctionRegistry::RegisterAll(registry);
+ }
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(ChromeExtensionsBrowserAPIProvider);
+};
+
+class QtWebEngineExtensionsBrowserAPIProvider : public ExtensionsBrowserAPIProvider
+{
+public:
+ QtWebEngineExtensionsBrowserAPIProvider() = default;
+ ~QtWebEngineExtensionsBrowserAPIProvider() override = default;
+
+ void RegisterExtensionFunctions(ExtensionFunctionRegistry *registry) override
+ {
+ // Generated APIs from QtWebEngine.
+ api::QtWebEngineGeneratedFunctionRegistry::RegisterAll(registry);
+ }
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(QtWebEngineExtensionsBrowserAPIProvider);
+};
+
ExtensionsBrowserClientQt::ExtensionsBrowserClientQt()
: api_client_(new ExtensionsAPIClientQt)
, resource_manager_(new ComponentExtensionResourceManagerQt)
{
AddAPIProvider(std::make_unique<CoreExtensionsBrowserAPIProvider>());
+ AddAPIProvider(std::make_unique<ChromeExtensionsBrowserAPIProvider>());
+ AddAPIProvider(std::make_unique<QtWebEngineExtensionsBrowserAPIProvider>());
}
ExtensionsBrowserClientQt::~ExtensionsBrowserClientQt()
@@ -385,10 +404,13 @@ bool ExtensionsBrowserClientQt::AllowCrossRendererResourceLoad(const GURL &url,
const ExtensionSet &extensions,
const ProcessMap &process_map)
{
-
if (extension && extension->id() == extension_misc::kPdfExtensionId)
return true;
+ // hangout services id
+ if (extension && extension->id() == "nkeimhogjdpnpccoofpliimaahmaaome")
+ return true;
+
bool allowed = false;
if (url_request_util::AllowCrossRendererResourceLoad(url, resource_type,
page_transition, child_id,
@@ -417,9 +439,7 @@ ProcessManagerDelegate *ExtensionsBrowserClientQt::GetProcessManagerDelegate() c
std::unique_ptr<ExtensionHostDelegate> ExtensionsBrowserClientQt::CreateExtensionHostDelegate()
{
- // TODO(extensions): Implement to support Apps.
- NOTREACHED();
- return std::unique_ptr<ExtensionHostDelegate>();
+ return std::unique_ptr<ExtensionHostDelegate>(new ExtensionHostDelegateQt);
}
bool ExtensionsBrowserClientQt::DidVersionUpdate(BrowserContext *context)
@@ -448,7 +468,7 @@ ExtensionSystemProvider *ExtensionsBrowserClientQt::GetExtensionSystemFactory()
}
void ExtensionsBrowserClientQt::RegisterBrowserInterfaceBindersForFrame(
- service_manager::BinderMapWithContext<content::RenderFrameHost*> *binder_map,
+ mojo::BinderMapWithContext<content::RenderFrameHost*> *binder_map,
content::RenderFrameHost* render_frame_host,
const Extension* extension) const
{
diff --git a/src/core/extensions/extensions_browser_client_qt.h b/src/core/extensions/extensions_browser_client_qt.h
index b7f944635..5889694b7 100644
--- a/src/core/extensions/extensions_browser_client_qt.h
+++ b/src/core/extensions/extensions_browser_client_qt.h
@@ -93,8 +93,9 @@ public:
bool IsRunningInForcedAppMode() override;
bool IsLoggedInAsPublicAccount() override;
ExtensionSystemProvider *GetExtensionSystemFactory() override;
- void RegisterBrowserInterfaceBindersForFrame(service_manager::BinderMapWithContext<content::RenderFrameHost*> *,
+ void RegisterBrowserInterfaceBindersForFrame(mojo::BinderMapWithContext<content::RenderFrameHost*> *,
content::RenderFrameHost *, const extensions::Extension *) const override;
+
std::unique_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate(content::BrowserContext *context) const override;
const ComponentExtensionResourceManager *
GetComponentExtensionResourceManager() override;
diff --git a/src/core/extensions/messaging_delegate_qt.cpp b/src/core/extensions/messaging_delegate_qt.cpp
new file mode 100644
index 000000000..c666daa09
--- /dev/null
+++ b/src/core/extensions/messaging_delegate_qt.cpp
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "messaging_delegate_qt.h"
+
+#include <QtGlobal>
+
+namespace extensions {
+
+MessagingDelegateQt::MessagingDelegateQt()
+{
+}
+
+std::unique_ptr<base::DictionaryValue> MessagingDelegateQt::MaybeGetTabInfo(content::WebContents *web_contents)
+{
+ Q_UNUSED(web_contents);
+ return nullptr;
+}
+
+} // namespace extensions
diff --git a/src/core/extensions/messaging_delegate_qt.h b/src/core/extensions/messaging_delegate_qt.h
new file mode 100644
index 000000000..44bfdc2d5
--- /dev/null
+++ b/src/core/extensions/messaging_delegate_qt.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MESSAGING_DELEGATE_QT_H
+#define MESSAGING_DELEGATE_QT_H
+
+#include "extensions/browser/api/messaging/messaging_delegate.h"
+
+namespace base {
+class DictionaryValue;
+}
+
+namespace content {
+class WebContents;
+}
+
+namespace extensions {
+
+class MessagingDelegateQt : public MessagingDelegate
+{
+public:
+ MessagingDelegateQt();
+
+ // MessagingDelegate implementation.
+ std::unique_ptr<base::DictionaryValue> MaybeGetTabInfo(content::WebContents *web_contents) override;
+};
+
+} // namespace extensions
+
+#endif // MESSAGING_DELEGATE_QT_H
diff --git a/src/core/file_picker_controller.cpp b/src/core/file_picker_controller.cpp
index 65e2c6f00..334321273 100644
--- a/src/core/file_picker_controller.cpp
+++ b/src/core/file_picker_controller.cpp
@@ -53,16 +53,32 @@
namespace QtWebEngineCore {
-FilePickerController::FilePickerController(FileChooserMode mode, std::unique_ptr<content::FileSelectListener> listener, const QString &defaultFileName, const QStringList &acceptedMimeTypes, QObject *parent)
+class FilePickerControllerPrivate {
+public:
+ FilePickerController::FileChooserMode mode;
+ scoped_refptr<content::FileSelectListener> listener;
+ QString defaultFileName;
+ QStringList acceptedMimeTypes;
+};
+
+FilePickerController *createFilePickerController(
+ FilePickerController::FileChooserMode mode, scoped_refptr<content::FileSelectListener> listener,
+ const QString &defaultFileName, const QStringList &acceptedMimeTypes, QObject *parent = nullptr)
+{
+ auto priv = new FilePickerControllerPrivate{mode, listener, defaultFileName, acceptedMimeTypes};
+ return new FilePickerController(priv, parent);
+}
+
+FilePickerController::FilePickerController(FilePickerControllerPrivate *priv, QObject *parent)
: QObject(parent)
- , m_defaultFileName(defaultFileName)
- , m_acceptedMimeTypes(acceptedMimeTypes)
- , m_listener(std::move(listener))
- , m_mode(mode)
+ , d_ptr(priv)
{
}
-FilePickerController::~FilePickerController() = default;
+FilePickerController::~FilePickerController()
+{
+ delete d_ptr;
+}
void FilePickerController::accepted(const QStringList &files)
{
@@ -178,7 +194,7 @@ ASSERT_ENUMS_MATCH(FilePickerController::Save, blink::mojom::FileChooserParams_M
void FilePickerController::filesSelectedInChooser(const QStringList &filesList)
{
QStringList files(filesList);
- if (this->m_mode == UploadFolder && !filesList.isEmpty()
+ if (d_ptr->mode == UploadFolder && !filesList.isEmpty()
&& QFileInfo(filesList.first()).isDir()) // Enumerate the directory
files = listRecursively(QDir(filesList.first()));
@@ -189,26 +205,26 @@ void FilePickerController::filesSelectedInChooser(const QStringList &filesList)
}
if (files.isEmpty())
- m_listener->FileSelectionCanceled();
+ d_ptr->listener->FileSelectionCanceled();
else
- m_listener->FileSelected(std::move(chooser_files),
+ d_ptr->listener->FileSelected(std::move(chooser_files),
/* FIXME? */ base::FilePath(),
- static_cast<blink::mojom::FileChooserParams::Mode>(this->m_mode));
+ static_cast<blink::mojom::FileChooserParams::Mode>(d_ptr->mode));
}
QStringList FilePickerController::acceptedMimeTypes() const
{
- return m_acceptedMimeTypes;
+ return d_ptr->acceptedMimeTypes;
}
FilePickerController::FileChooserMode FilePickerController::mode() const
{
- return m_mode;
+ return d_ptr->mode;
}
QString FilePickerController::defaultFileName() const
{
- return m_defaultFileName;
+ return d_ptr->defaultFileName;
}
QStringList FilePickerController::nameFilters(const QStringList &acceptedMimeTypes)
diff --git a/src/core/file_picker_controller.h b/src/core/file_picker_controller.h
index 0b680161a..0b84c889e 100644
--- a/src/core/file_picker_controller.h
+++ b/src/core/file_picker_controller.h
@@ -53,17 +53,12 @@
#include "qtwebenginecoreglobal_p.h"
-#include <memory>
-
#include <QObject>
#include <QStringList>
-namespace content {
- class FileSelectListener;
-}
-
namespace QtWebEngineCore {
+class FilePickerControllerPrivate;
class Q_WEBENGINECORE_PRIVATE_EXPORT FilePickerController : public QObject {
Q_OBJECT
public:
@@ -74,8 +69,9 @@ public:
Save
};
- FilePickerController(FileChooserMode mode, std::unique_ptr<content::FileSelectListener> listener, const QString &defaultFileName, const QStringList &acceptedMimeTypes, QObject * = 0);
+ FilePickerController(FilePickerControllerPrivate *priv, QObject *parent = nullptr);
~FilePickerController() override;
+
QStringList acceptedMimeTypes() const;
QString defaultFileName() const;
FileChooserMode mode() const;
@@ -89,13 +85,9 @@ public Q_SLOTS:
private:
void filesSelectedInChooser(const QStringList &filesList);
- QString m_defaultFileName;
- QStringList m_acceptedMimeTypes;
- std::unique_ptr<content::FileSelectListener> m_listener;
- FileChooserMode m_mode;
-
+ FilePickerControllerPrivate *d_ptr;
};
-} // namespace
+} // namespace QtWebEngineCore
#endif // FILE_PICKER_CONTROLLER_H
diff --git a/src/core/find_text_helper.cpp b/src/core/find_text_helper.cpp
index da9d7f352..c3b407ab1 100644
--- a/src/core/find_text_helper.cpp
+++ b/src/core/find_text_helper.cpp
@@ -116,7 +116,7 @@ void FindTextHelper::startFinding(const QString &findText, bool caseSensitively,
blink::mojom::FindOptionsPtr options = blink::mojom::FindOptions::New();
options->forward = !findBackward;
options->match_case = caseSensitively;
- options->find_next = findText == m_previousFindText;
+ options->new_session = findText != m_previousFindText;
m_previousFindText = findText;
m_currentFindRequestId = m_findRequestIdCounter++;
diff --git a/src/core/location_provider_qt.cpp b/src/core/location_provider_qt.cpp
index d5a7f1297..94f6c6c9a 100644
--- a/src/core/location_provider_qt.cpp
+++ b/src/core/location_provider_qt.cpp
@@ -50,7 +50,6 @@
#include "base/bind.h"
#include "base/memory/weak_ptr.h"
-#include "base/message_loop/message_loop.h"
#include "content/public/browser/browser_thread.h"
#include "services/device/geolocation/geolocation_provider.h"
#include "services/device/geolocation/geolocation_provider_impl.h"
diff --git a/src/core/location_provider_qt.h b/src/core/location_provider_qt.h
index 8e5ad0e54..db6b94e20 100644
--- a/src/core/location_provider_qt.h
+++ b/src/core/location_provider_qt.h
@@ -47,10 +47,6 @@
QT_FORWARD_DECLARE_CLASS(QThread)
-namespace base {
-class MessageLoop;
-}
-
namespace QtWebEngineCore {
class QtPositioningHelper;
diff --git a/src/core/media_capture_devices_dispatcher.cpp b/src/core/media_capture_devices_dispatcher.cpp
index 9600f220e..cf31b9b59 100644
--- a/src/core/media_capture_devices_dispatcher.cpp
+++ b/src/core/media_capture_devices_dispatcher.cpp
@@ -59,9 +59,9 @@
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
#include "content/public/browser/render_process_host.h"
-#include "content/public/common/origin_util.h"
#include "media/audio/audio_device_description.h"
#include "media/audio/audio_manager_base.h"
+#include "third_party/blink/public/common/loader/network_utils.h"
#include "ui/base/l10n/l10n_util.h"
#if QT_CONFIG(webengine_webrtc)
@@ -381,7 +381,7 @@ void MediaCaptureDevicesDispatcher::Observe(int type, const content::Notificatio
}
}
-void MediaCaptureDevicesDispatcher::processMediaAccessRequest(WebContentsAdapterClient *adapterClient, content::WebContents *webContents, const content::MediaStreamRequest &request, content::MediaResponseCallback callback)
+void MediaCaptureDevicesDispatcher::processMediaAccessRequest(content::WebContents *webContents, const content::MediaStreamRequest &request, content::MediaResponseCallback callback)
{
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -391,10 +391,13 @@ void MediaCaptureDevicesDispatcher::processMediaAccessRequest(WebContentsAdapter
return;
}
+ WebContentsDelegateQt *delegate = static_cast<WebContentsDelegateQt *>(webContents->GetDelegate());
+ WebContentsAdapterClient *adapterClient = delegate->adapterClient();
+
if (flags.testFlag(WebContentsAdapterClient::MediaDesktopVideoCapture)) {
const bool screenCaptureEnabled = adapterClient->webEngineSettings()->testAttribute(
QWebEngineSettings::ScreenCaptureEnabled);
- const bool originIsSecure = content::IsOriginSecure(request.security_origin);
+ const bool originIsSecure = blink::network_utils::IsOriginSecure(request.security_origin);
if (!screenCaptureEnabled || !originIsSecure) {
std::move(callback).Run(blink::MediaStreamDevices(), MediaStreamRequestResult::INVALID_STATE, std::unique_ptr<content::MediaStreamUI>());
return;
diff --git a/src/core/media_capture_devices_dispatcher.h b/src/core/media_capture_devices_dispatcher.h
index 17cb5d5c9..2db457d33 100644
--- a/src/core/media_capture_devices_dispatcher.h
+++ b/src/core/media_capture_devices_dispatcher.h
@@ -66,7 +66,7 @@ class MediaCaptureDevicesDispatcher : public content::MediaObserver,
public:
static MediaCaptureDevicesDispatcher *GetInstance();
- void processMediaAccessRequest(WebContentsAdapterClient *, content::WebContents *, const content::MediaStreamRequest &, content::MediaResponseCallback);
+ void processMediaAccessRequest(content::WebContents *, const content::MediaStreamRequest &, content::MediaResponseCallback);
// Called back from our WebContentsAdapter to grant the requested permission.
void handleMediaAccessPermissionResponse(content::WebContents *, const QUrl &securityOrigin, WebContentsAdapterClient::MediaRequestFlags);
diff --git a/src/core/net/client_cert_override.cpp b/src/core/net/client_cert_override.cpp
index f33515f63..d768092e8 100644
--- a/src/core/net/client_cert_override.cpp
+++ b/src/core/net/client_cert_override.cpp
@@ -65,7 +65,7 @@
#include "net/ssl/client_cert_store_win.h"
#endif
-#if defined(OS_MACOSX)
+#if defined(OS_MAC)
#include "net/ssl/client_cert_store_mac.h"
#endif
@@ -83,7 +83,7 @@ public:
std::move(private_key_callback).Run(m_key);
}
-#if defined(OS_MACOSX)
+#if defined(OS_MAC)
SecIdentityRef sec_identity_ref() const override
{
return nullptr;
@@ -167,7 +167,7 @@ std::unique_ptr<net::ClientCertStore> ClientCertOverrideStore::createNativeStore
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreNSS(net::ClientCertStoreNSS::PasswordDelegateFactory()));
#elif defined(OS_WIN)
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreWin());
-#elif defined(OS_MACOSX)
+#elif defined(OS_MAC)
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreMac());
#else
return nullptr;
diff --git a/src/core/net/cookie_monster_delegate_qt.cpp b/src/core/net/cookie_monster_delegate_qt.cpp
index a7a3a9348..792d34373 100644
--- a/src/core/net/cookie_monster_delegate_qt.cpp
+++ b/src/core/net/cookie_monster_delegate_qt.cpp
@@ -143,7 +143,7 @@ void CookieMonsterDelegateQt::setCookie(quint64 callbackId, const QNetworkCookie
if (callbackId != CallbackDirectory::NoCallbackId)
callback = base::BindOnce(&CookieMonsterDelegateQt::SetCookieCallbackOnUIThread, this, callbackId);
- net::CanonicalCookie::CookieInclusionStatus inclusion;
+ net::CookieInclusionStatus inclusion;
auto canonCookie = net::CanonicalCookie::Create(gurl, cookie_line, base::Time::Now(), base::nullopt, &inclusion);
if (!inclusion.IsInclude()) {
LOG(WARNING) << "QWebEngineCookieStore::setCookie() - Tried to set invalid cookie";
@@ -151,7 +151,8 @@ void CookieMonsterDelegateQt::setCookie(quint64 callbackId, const QNetworkCookie
}
net::CookieOptions options;
options.set_include_httponly();
- m_mojoCookieManager->SetCanonicalCookie(*canonCookie.get(), gurl.scheme(), options, std::move(callback));
+ options.set_same_site_cookie_context(net::CookieOptions::SameSiteCookieContext::MakeInclusiveForSet());
+ m_mojoCookieManager->SetCanonicalCookie(*canonCookie.get(), gurl, options, std::move(callback));
}
void CookieMonsterDelegateQt::deleteCookie(const QNetworkCookie &cookie, const QUrl &origin)
@@ -272,10 +273,10 @@ void CookieMonsterDelegateQt::GetAllCookiesCallbackOnUIThread(qint64 callbackId,
m_client->d_func()->onGetAllCallbackResult(callbackId, rawCookies);
}
-void CookieMonsterDelegateQt::SetCookieCallbackOnUIThread(qint64 callbackId, net::CanonicalCookie::CookieInclusionStatus status)
+void CookieMonsterDelegateQt::SetCookieCallbackOnUIThread(qint64 callbackId, net::CookieAccessResult status)
{
if (m_client)
- m_client->d_func()->onSetCallbackResult(callbackId, status.IsInclude());
+ m_client->d_func()->onSetCallbackResult(callbackId, status.status.IsInclude());
}
void CookieMonsterDelegateQt::DeleteCookiesCallbackOnUIThread(qint64 callbackId, uint numCookies)
diff --git a/src/core/net/cookie_monster_delegate_qt.h b/src/core/net/cookie_monster_delegate_qt.h
index a8432e125..9078bcd58 100644
--- a/src/core/net/cookie_monster_delegate_qt.h
+++ b/src/core/net/cookie_monster_delegate_qt.h
@@ -114,7 +114,7 @@ public:
private:
void GetAllCookiesCallbackOnUIThread(qint64 callbackId, const net::CookieList &cookies);
- void SetCookieCallbackOnUIThread(qint64 callbackId, net::CanonicalCookie::CookieInclusionStatus status);
+ void SetCookieCallbackOnUIThread(qint64 callbackId, net::CookieAccessResult status);
void DeleteCookiesCallbackOnUIThread(qint64 callbackId, uint numCookies);
};
diff --git a/src/core/net/custom_url_loader_factory.cpp b/src/core/net/custom_url_loader_factory.cpp
index 709e4451b..10b4a9e0f 100644
--- a/src/core/net/custom_url_loader_factory.cpp
+++ b/src/core/net/custom_url_loader_factory.cpp
@@ -91,6 +91,7 @@ public:
// network::mojom::URLLoader:
void FollowRedirect(const std::vector<std::string> &removed_headers,
const net::HttpRequestHeaders &modified_headers,
+ const net::HttpRequestHeaders &modified_cors_exempt_headers, // FIXME: do something with this?
const base::Optional<GURL> &new_url) override
{
// We can be asked for follow our own redirect
@@ -287,9 +288,9 @@ private:
if (!m_redirect.is_empty()) {
m_head->content_length = m_head->encoded_body_length = -1;
- net::URLRequest::FirstPartyURLPolicy first_party_url_policy =
- m_request.update_first_party_url_on_redirect ? net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT
- : net::URLRequest::NEVER_CHANGE_FIRST_PARTY_URL;
+ net::RedirectInfo::FirstPartyURLPolicy first_party_url_policy =
+ m_request.update_first_party_url_on_redirect ? net::RedirectInfo::FirstPartyURLPolicy::UPDATE_URL_ON_REDIRECT
+ : net::RedirectInfo::FirstPartyURLPolicy::NEVER_CHANGE_URL;
net::RedirectInfo redirectInfo = net::RedirectInfo::ComputeRedirectInfo(
m_request.method, m_request.url,
m_request.site_for_cookies,
@@ -457,10 +458,13 @@ private:
class CustomURLLoaderFactory : public network::mojom::URLLoaderFactory {
public:
- CustomURLLoaderFactory(ProfileAdapter *profileAdapter)
+ CustomURLLoaderFactory(ProfileAdapter *profileAdapter, mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver)
: m_taskRunner(base::CreateSequencedTaskRunner({ content::BrowserThread::IO }))
, m_profileAdapter(profileAdapter)
{
+ m_receivers.set_disconnect_handler(base::BindRepeating(
+ &CustomURLLoaderFactory::OnDisconnect, base::Unretained(this)));
+ m_receivers.Add(this, std::move(receiver));
}
~CustomURLLoaderFactory() override = default;
@@ -491,6 +495,19 @@ public:
m_receivers.Add(this, std::move(receiver));
}
+ void OnDisconnect()
+ {
+ if (m_receivers.empty())
+ delete this;
+ }
+
+ static mojo::PendingRemote<network::mojom::URLLoaderFactory> Create(ProfileAdapter *profileAdapter)
+ {
+ mojo::PendingRemote<network::mojom::URLLoaderFactory> pending_remote;
+ new CustomURLLoaderFactory(profileAdapter, pending_remote.InitWithNewPipeAndPassReceiver());
+ return pending_remote;
+ }
+
const scoped_refptr<base::SequencedTaskRunner> m_taskRunner;
mojo::ReceiverSet<network::mojom::URLLoaderFactory> m_receivers;
QPointer<ProfileAdapter> m_profileAdapter;
@@ -499,9 +516,9 @@ public:
} // namespace
-std::unique_ptr<network::mojom::URLLoaderFactory> CreateCustomURLLoaderFactory(ProfileAdapter *profileAdapter)
+mojo::PendingRemote<network::mojom::URLLoaderFactory> CreateCustomURLLoaderFactory(ProfileAdapter *profileAdapter)
{
- return std::make_unique<CustomURLLoaderFactory>(profileAdapter);
+ return CustomURLLoaderFactory::Create(profileAdapter);
}
} // namespace QtWebEngineCore
diff --git a/src/core/net/custom_url_loader_factory.h b/src/core/net/custom_url_loader_factory.h
index 58adf4b79..a9eecbd1c 100644
--- a/src/core/net/custom_url_loader_factory.h
+++ b/src/core/net/custom_url_loader_factory.h
@@ -51,7 +51,7 @@
#ifndef CUSTOM_URL_LOADER_FACTORY_H_
#define CUSTOM_URL_LOADER_FACTORY_H_
-#include <memory>
+#include "mojo/public/cpp/bindings/pending_remote.h"
namespace network {
namespace mojom {
@@ -62,7 +62,7 @@ class URLLoaderFactory;
namespace QtWebEngineCore {
class ProfileAdapter;
-std::unique_ptr<network::mojom::URLLoaderFactory> CreateCustomURLLoaderFactory(ProfileAdapter *profileAdapter);
+mojo::PendingRemote<network::mojom::URLLoaderFactory> CreateCustomURLLoaderFactory(ProfileAdapter *profileAdapter);
} // namespace QtWebEngineCore
diff --git a/src/core/net/proxying_restricted_cookie_manager_qt.cpp b/src/core/net/proxying_restricted_cookie_manager_qt.cpp
index b0b46c817..b0d3787de 100644
--- a/src/core/net/proxying_restricted_cookie_manager_qt.cpp
+++ b/src/core/net/proxying_restricted_cookie_manager_qt.cpp
@@ -126,7 +126,7 @@ void ProxyingRestrictedCookieManagerQt::GetAllForUrl(const GURL &url,
if (allowCookies(url, site_for_cookies)) {
underlying_restricted_cookie_manager_->GetAllForUrl(url, site_for_cookies, top_frame_origin, std::move(options), std::move(callback));
} else {
- std::move(callback).Run(std::vector<net::CanonicalCookie>());
+ std::move(callback).Run(std::vector<net::CookieWithAccessResult>());
}
}
diff --git a/src/core/net/proxying_url_loader_factory_qt.cpp b/src/core/net/proxying_url_loader_factory_qt.cpp
index 2b1472e88..f174df46c 100644
--- a/src/core/net/proxying_url_loader_factory_qt.cpp
+++ b/src/core/net/proxying_url_loader_factory_qt.cpp
@@ -137,7 +137,9 @@ public:
// network::mojom::URLLoader
void FollowRedirect(const std::vector<std::string> &removed_headers,
- const net::HttpRequestHeaders &modified_headers, const base::Optional<GURL> &new_url) override;
+ const net::HttpRequestHeaders &modified_headers,
+ const net::HttpRequestHeaders &modified_cors_exempt_headers,
+ const base::Optional<GURL> &new_url) override;
void SetPriority(net::RequestPriority priority, int32_t intra_priority_value) override;
void PauseReadingBodyFromNet() override;
void ResumeReadingBodyFromNet() override;
@@ -285,9 +287,9 @@ void InterceptedRequest::ContinueAfterIntercept()
}
if (info.shouldRedirectRequest) {
- net::URLRequest::FirstPartyURLPolicy first_party_url_policy =
- request_.update_first_party_url_on_redirect ? net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT
- : net::URLRequest::NEVER_CHANGE_FIRST_PARTY_URL;
+ net::RedirectInfo::FirstPartyURLPolicy first_party_url_policy =
+ request_.update_first_party_url_on_redirect ? net::RedirectInfo::FirstPartyURLPolicy::UPDATE_URL_ON_REDIRECT
+ : net::RedirectInfo::FirstPartyURLPolicy::NEVER_CHANGE_URL;
net::RedirectInfo redirectInfo = net::RedirectInfo::ComputeRedirectInfo(
request_.method, request_.url, request_.site_for_cookies,
first_party_url_policy, request_.referrer_policy, request_.referrer.spec(),
@@ -369,10 +371,11 @@ void InterceptedRequest::OnComplete(const network::URLLoaderCompletionStatus &st
void InterceptedRequest::FollowRedirect(const std::vector<std::string> &removed_headers,
const net::HttpRequestHeaders &modified_headers,
+ const net::HttpRequestHeaders &modified_cors_exempt_headers,
const base::Optional<GURL> &new_url)
{
if (target_loader_)
- target_loader_->FollowRedirect(removed_headers, modified_headers, new_url);
+ target_loader_->FollowRedirect(removed_headers, modified_headers, modified_cors_exempt_headers, new_url);
// If |OnURLLoaderClientError| was called then we're just waiting for the
// connection error handler of |proxied_loader_binding_|. Don't restart the
diff --git a/src/core/net/system_network_context_manager.cpp b/src/core/net/system_network_context_manager.cpp
index 611b5eafa..99a207c0e 100644
--- a/src/core/net/system_network_context_manager.cpp
+++ b/src/core/net/system_network_context_manager.cpp
@@ -64,7 +64,6 @@
#include "components/network_session_configurator/common/network_switches.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/cors_exempt_headers.h"
#include "content/public/browser/network_service_instance.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
@@ -102,7 +101,7 @@ network::mojom::HttpAuthDynamicParamsPtr CreateHttpAuthDynamicParams()
network::mojom::HttpAuthDynamicParamsPtr auth_dynamic_params = network::mojom::HttpAuthDynamicParams::New();
auto *command_line = base::CommandLine::ForCurrentProcess();
- auth_dynamic_params->server_allowlist = command_line->GetSwitchValueASCII(switches::kAuthServerWhitelist);
+ auth_dynamic_params->server_allowlist = command_line->GetSwitchValueASCII(switches::kAuthServerAllowlist);
// auth_dynamic_params->delegate_allowlist = command_line->GetSwitchValueASCII(switches::kAuthNegotiateDelegateWhitelist);
// auth_dynamic_params->enable_negotiate_port = command_line->HasSwitch(switches::kEnableAuthNegotiatePort);
@@ -241,8 +240,7 @@ void SystemNetworkContextManager::OnNetworkServiceCreated(network::mojom::Networ
network_service->SetUpHttpAuth(CreateHttpAuthStaticParams());
network_service->ConfigureHttpAuthPrefs(CreateHttpAuthDynamicParams());
- // The system NetworkContext must be created first, since it sets
- // |primary_network_context| to true.
+ // The system NetworkContext is created first
network_service_network_context_.reset();
network_service->CreateNetworkContext(
network_service_network_context_.BindNewPipeAndPassReceiver(),
@@ -263,41 +261,21 @@ void SystemNetworkContextManager::AddSSLConfigToNetworkContextParams(network::mo
network_context_params->initial_ssl_config->symantec_enforcement_disabled = true;
}
-network::mojom::NetworkContextParamsPtr SystemNetworkContextManager::CreateDefaultNetworkContextParams()
+void SystemNetworkContextManager::ConfigureDefaultNetworkContextParams(network::mojom::NetworkContextParams *network_context_params)
{
- network::mojom::NetworkContextParamsPtr network_context_params = network::mojom::NetworkContextParams::New();
- content::UpdateCorsExemptHeader(network_context_params.get());
-
network_context_params->enable_brotli = true;
- // network_context_params->user_agent = GetUserAgent();
-
// Disable referrers by default. Any consumer that enables referrers should
// respect prefs::kEnableReferrers from the appropriate pref store.
network_context_params->enable_referrers = false;
- // const base::CommandLine& command_line =
- // *base::CommandLine::ForCurrentProcess();
-
- // // TODO(eroman): Figure out why this doesn't work in single-process mode,
- // // or if it does work, now.
- // // Should be possible now that a private isolate is used.
- // // http://crbug.com/474654
- // if (!command_line.HasSwitch(switches::kWinHttpProxyResolver)) {
- // if (command_line.HasSwitch(switches::kSingleProcess)) {
- // LOG(ERROR) << "Cannot use V8 Proxy resolver in single process mode.";
- // } else {
network_context_params->proxy_resolver_factory = ChromeMojoProxyResolverFactory::CreateWithSelfOwnedReceiver();
- // }
- // }
-
- // network_context_params->pac_quick_check_enabled = local_state_->GetBoolean(prefs::kQuickCheckEnabled);
// Use the SystemNetworkContextManager to populate and update SSL
// configuration. The SystemNetworkContextManager is owned by the
// BrowserProcess itself, so will only be destroyed on shutdown, at which
// point, all NetworkContexts will be destroyed as well.
- AddSSLConfigToNetworkContextParams(network_context_params.get());
+ AddSSLConfigToNetworkContextParams(network_context_params);
// CT is only enabled on Desktop platforms for now.
network_context_params->enforce_chrome_ct_policy = true;
@@ -308,14 +286,13 @@ network::mojom::NetworkContextParamsPtr SystemNetworkContextManager::CreateDefau
log_info->name = ct_log.log_name;
network_context_params->ct_logs.push_back(std::move(log_info));
}
-
- return network_context_params;
}
network::mojom::NetworkContextParamsPtr SystemNetworkContextManager::CreateNetworkContextParams()
{
// TODO(mmenke): Set up parameters here (in memory cookie store, etc).
- network::mojom::NetworkContextParamsPtr network_context_params = CreateDefaultNetworkContextParams();
+ network::mojom::NetworkContextParamsPtr network_context_params = network::mojom::NetworkContextParams::New();
+ ConfigureDefaultNetworkContextParams(network_context_params.get());
network_context_params->context_name = std::string("system");
@@ -328,8 +305,6 @@ network::mojom::NetworkContextParamsPtr SystemNetworkContextManager::CreateNetwo
network_context_params->enable_ftp_url_support = true;
#endif
- network_context_params->primary_network_context = false;
-
proxy_config_monitor_.AddToNetworkContextParams(network_context_params.get());
return network_context_params;
diff --git a/src/core/net/system_network_context_manager.h b/src/core/net/system_network_context_manager.h
index 0dd503ce1..bd12fe217 100644
--- a/src/core/net/system_network_context_manager.h
+++ b/src/core/net/system_network_context_manager.h
@@ -130,8 +130,8 @@ public:
// SSL configuration updates.
void AddSSLConfigToNetworkContextParams(network::mojom::NetworkContextParams *network_context_params);
- // Returns default set of parameters for configuring the network service.
- network::mojom::NetworkContextParamsPtr CreateDefaultNetworkContextParams();
+ // Configures the default set of parameters for the network context.
+ void ConfigureDefaultNetworkContextParams(network::mojom::NetworkContextParams *);
private:
class URLLoaderFactoryForSystem;
diff --git a/src/core/ozone/gl_share_context_qt.cpp b/src/core/ozone/gl_share_context_qt.cpp
index c2cfecb8b..a17321455 100644
--- a/src/core/ozone/gl_share_context_qt.cpp
+++ b/src/core/ozone/gl_share_context_qt.cpp
@@ -81,7 +81,7 @@ QtShareGLContext::QtShareGLContext(QOpenGLContext *qtContext)
#endif // QT_CONFIG(opengl)
}
-unsigned int QtShareGLContext::CheckStickyGraphicsResetStatus()
+unsigned int QtShareGLContext::CheckStickyGraphicsResetStatusImpl()
{
#if QT_CONFIG(opengl)
if (QOpenGLContext *context = QOpenGLContext::globalShareContext()) {
diff --git a/src/core/ozone/gl_share_context_qt.h b/src/core/ozone/gl_share_context_qt.h
index 26e884e10..b07f5123e 100644
--- a/src/core/ozone/gl_share_context_qt.h
+++ b/src/core/ozone/gl_share_context_qt.h
@@ -55,14 +55,14 @@ class QtShareGLContext : public gl::GLContext
public:
QtShareGLContext(QOpenGLContext *qtContext);
void *GetHandle() override { return m_handle; }
- unsigned int CheckStickyGraphicsResetStatus() override;
+ unsigned int CheckStickyGraphicsResetStatusImpl() override;
// We don't care about the rest, this context shouldn't be used except for its handle.
bool Initialize(gl::GLSurface *, const gl::GLContextAttribs &) override
{
Q_UNREACHABLE();
return false;
}
- bool MakeCurrent(gl::GLSurface *) override
+ bool MakeCurrentImpl(gl::GLSurface *) override
{
Q_UNREACHABLE();
return false;
diff --git a/src/core/ozone/gl_surface_egl_qt.cpp b/src/core/ozone/gl_surface_egl_qt.cpp
index 8e8e66f63..91402abfe 100644
--- a/src/core/ozone/gl_surface_egl_qt.cpp
+++ b/src/core/ozone/gl_surface_egl_qt.cpp
@@ -44,7 +44,7 @@
#include "gl_context_qt.h"
#include "ozone/gl_surface_egl_qt.h"
-#if !defined(OS_MACOSX)
+#if !defined(OS_MAC)
#include "ui/gl/egl_util.h"
#include "ui/gl/gl_surface_egl.h"
#include "ui/gl/init/gl_factory.h"
@@ -181,6 +181,21 @@ bool GLSurfaceEGL::IsANGLEFeatureControlSupported()
return false;
}
+bool GLSurfaceEGL::IsANGLEPowerPreferenceSupported()
+{
+ return false;
+}
+
+bool GLSurfaceEGL::IsDisplaySemaphoreShareGroupSupported()
+{
+ return false;
+}
+
+bool GLSurfaceEGL::IsRobustnessVideoMemoryPurgeSupported()
+{
+ return false;
+}
+
void GLSurfaceEGL::ShutdownOneOff()
{
}
@@ -340,4 +355,4 @@ std::string DriverEGL::GetPlatformExtensions()
return "";
}
} // namespace gl
-#endif // !defined(OS_MACOSX)
+#endif // !defined(OS_MAC)
diff --git a/src/core/ozone/gl_surface_glx_qt.cpp b/src/core/ozone/gl_surface_glx_qt.cpp
index e150c940a..188a92729 100644
--- a/src/core/ozone/gl_surface_glx_qt.cpp
+++ b/src/core/ozone/gl_surface_glx_qt.cpp
@@ -45,8 +45,7 @@
#include "ozone/gl_surface_glx_qt.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_surface_glx.h"
-#include <GL/glx.h>
-#include <GL/glxext.h>
+#include "ui/gfx/x/x11_types.h"
namespace gl {
@@ -106,6 +105,11 @@ bool GLSurfaceGLX::IsTextureFromPixmapSupported()
return ExtensionsContain(GLSurfaceQt::g_extensions, "GLX_EXT_texture_from_pixmap");
}
+bool GLSurfaceGLX::IsRobustnessVideoMemoryPurgeSupported()
+{
+ return false;
+}
+
const char* GLSurfaceGLX::GetGLXExtensions()
{
return GLSurfaceQt::g_extensions;
@@ -171,9 +175,9 @@ bool GLSurfaceGLXQt::Initialize(GLSurfaceFormat format)
const int pbuffer_attributes[] = {
GLX_PBUFFER_WIDTH, m_size.width(),
GLX_PBUFFER_HEIGHT, m_size.height(),
- GLX_LARGEST_PBUFFER, x11::False,
- GLX_PRESERVED_CONTENTS, x11::False,
- x11::None // MEMO doc: ...must be terminated with None or NULL
+ GLX_LARGEST_PBUFFER, GL_FALSE,
+ GLX_PRESERVED_CONTENTS, GL_FALSE,
+ GL_NONE // MEMO doc: ...must be terminated with None or NULL
};
m_surfaceBuffer = glXCreatePbuffer(display, static_cast<GLXFBConfig>(g_config), pbuffer_attributes);
diff --git a/src/core/ozone/gl_surface_glx_qt.h b/src/core/ozone/gl_surface_glx_qt.h
index 3a465f448..e894423b7 100644
--- a/src/core/ozone/gl_surface_glx_qt.h
+++ b/src/core/ozone/gl_surface_glx_qt.h
@@ -42,9 +42,7 @@
#include "gl_surface_qt.h"
-extern "C" {
-#include <X11/Xlib.h>
-}
+#include "ui/gfx/x/x11_types.h"
namespace gl {
diff --git a/src/core/ozone/gl_surface_qt.cpp b/src/core/ozone/gl_surface_qt.cpp
index 90f486532..2c464c11c 100644
--- a/src/core/ozone/gl_surface_qt.cpp
+++ b/src/core/ozone/gl_surface_qt.cpp
@@ -43,7 +43,7 @@
#include "gl_surface_qt.h"
-#if !defined(OS_MACOSX)
+#if !defined(OS_MAC)
#include <QGuiApplication>
#include "gl_context_qt.h"
@@ -254,6 +254,10 @@ UINT DirectCompositionSurfaceWin::GetOverlaySupportFlags(DXGI_FORMAT format)
Q_UNUSED(format);
return 0;
}
+
+void DirectCompositionSurfaceWin::DisableDecodeSwapChain()
+{
+}
} // namespace gl
#endif
-#endif // !defined(OS_MACOSX)
+#endif // !defined(OS_MAC)
diff --git a/src/core/ozone/ozone_platform_qt.cpp b/src/core/ozone/ozone_platform_qt.cpp
index 3674ccfe6..9db5b9986 100644
--- a/src/core/ozone/ozone_platform_qt.cpp
+++ b/src/core/ozone/ozone_platform_qt.cpp
@@ -40,11 +40,11 @@
#include "ozone_platform_qt.h"
#if defined(USE_OZONE)
+#include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h"
#include "ui/base/ime/input_method.h"
#include "ui/display/types/native_display_delegate.h"
#include "ui/ozone/common/stub_client_native_pixmap_factory.h"
#include "ui/ozone/common/stub_overlay_manager.h"
-#include "ui/ozone/public/cursor_factory_ozone.h"
#include "ui/ozone/public/gpu_platform_support_host.h"
#include "ui/ozone/public/input_controller.h"
#include "ui/ozone/public/ozone_platform.h"
@@ -66,7 +66,7 @@ public:
~OzonePlatformQt() override;
ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override;
- ui::CursorFactoryOzone* GetCursorFactoryOzone() override;
+ ui::CursorFactory* GetCursorFactory() override;
GpuPlatformSupportHost* GetGpuPlatformSupportHost() override;
std::unique_ptr<PlatformWindow> CreatePlatformWindow(PlatformWindowDelegate* delegate, PlatformWindowInitProperties properties) override;
std::unique_ptr<display::NativeDisplayDelegate> CreateNativeDisplayDelegate() override;
@@ -80,7 +80,7 @@ private:
void InitializeGPU(const ui::OzonePlatform::InitParams &) override;
std::unique_ptr<QtWebEngineCore::SurfaceFactoryQt> surface_factory_ozone_;
- std::unique_ptr<CursorFactoryOzone> cursor_factory_ozone_;
+ std::unique_ptr<CursorFactory> cursor_factory_ozone_;
std::unique_ptr<GpuPlatformSupportHost> gpu_platform_support_host_;
std::unique_ptr<InputController> input_controller_;
@@ -99,7 +99,7 @@ ui::SurfaceFactoryOzone* OzonePlatformQt::GetSurfaceFactoryOzone()
return surface_factory_ozone_.get();
}
-ui::CursorFactoryOzone* OzonePlatformQt::GetCursorFactoryOzone()
+ui::CursorFactory* OzonePlatformQt::GetCursorFactory()
{
return cursor_factory_ozone_.get();
}
@@ -138,7 +138,7 @@ std::unique_ptr<display::NativeDisplayDelegate> OzonePlatformQt::CreateNativeDis
void OzonePlatformQt::InitializeUI(const ui::OzonePlatform::InitParams &)
{
overlay_manager_.reset(new StubOverlayManager());
- cursor_factory_ozone_.reset(new CursorFactoryOzone());
+ cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone());
gpu_platform_support_host_.reset(ui::CreateStubGpuPlatformSupportHost());
input_controller_ = CreateStubInputController();
}
diff --git a/src/core/permission_manager_qt.cpp b/src/core/permission_manager_qt.cpp
index 8b9eab3eb..f476a5aa1 100644
--- a/src/core/permission_manager_qt.cpp
+++ b/src/core/permission_manager_qt.cpp
@@ -68,6 +68,7 @@ static ProfileAdapter::PermissionType toQt(content::PermissionType type)
case content::PermissionType::NOTIFICATIONS:
return ProfileAdapter::NotificationPermission;
case content::PermissionType::ACCESSIBILITY_EVENTS:
+ case content::PermissionType::CAMERA_PAN_TILT_ZOOM:
return ProfileAdapter::UnsupportedPermission;
case content::PermissionType::FLASH:
case content::PermissionType::MIDI_SYSEX:
@@ -86,8 +87,10 @@ static ProfileAdapter::PermissionType toQt(content::PermissionType type)
case content::PermissionType::AR:
case content::PermissionType::VR:
case content::PermissionType::STORAGE_ACCESS_GRANT:
+ case content::PermissionType::WINDOW_PLACEMENT:
+ case content::PermissionType::FONT_ACCESS:
case content::PermissionType::NUM:
- LOG(INFO) << "Unsupported permission type: " << static_cast<int>(type);
+ LOG(INFO) << "Unexpected unsupported permission type: " << static_cast<int>(type);
break;
}
return ProfileAdapter::UnsupportedPermission;
diff --git a/src/core/pref_service_adapter.cpp b/src/core/pref_service_adapter.cpp
index 65dfb73ee..ff653c066 100644
--- a/src/core/pref_service_adapter.cpp
+++ b/src/core/pref_service_adapter.cpp
@@ -101,7 +101,7 @@ void PrefServiceAdapter::setup(const ProfileAdapter &profileAdapter)
registry->RegisterStringPref(language::prefs::kAcceptLanguages, std::string());
registry->RegisterListPref(spellcheck::prefs::kSpellCheckDictionaries);
registry->RegisterListPref(spellcheck::prefs::kSpellCheckForcedDictionaries);
- registry->RegisterListPref(spellcheck::prefs::kSpellCheckBlacklistedDictionaries);
+ registry->RegisterListPref(spellcheck::prefs::kSpellCheckBlocklistedDictionaries);
registry->RegisterStringPref(spellcheck::prefs::kSpellCheckDictionary, std::string());
registry->RegisterBooleanPref(spellcheck::prefs::kSpellCheckEnable, false);
registry->RegisterBooleanPref(spellcheck::prefs::kSpellCheckUseSpellingService, false);
@@ -120,8 +120,8 @@ void PrefServiceAdapter::setup(const ProfileAdapter &profileAdapter)
registry->RegisterBooleanPref(extensions::pref_names::kStorageGarbageCollect, false);
registry->RegisterListPref(extensions::pref_names::kAllowedInstallSites);
registry->RegisterStringPref(extensions::pref_names::kLastChromeVersion, std::string());
- registry->RegisterListPref(extensions::pref_names::kNativeMessagingBlacklist);
- registry->RegisterListPref(extensions::pref_names::kNativeMessagingWhitelist);
+ registry->RegisterListPref(extensions::pref_names::kNativeMessagingBlocklist);
+ registry->RegisterListPref(extensions::pref_names::kNativeMessagingAllowlist);
registry->RegisterBooleanPref(extensions::pref_names::kNativeMessagingUserLevelHosts, true);
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
diff --git a/src/core/printing/print_view_manager_base_qt.cpp b/src/core/printing/print_view_manager_base_qt.cpp
index a6c478037..ad35209f1 100644
--- a/src/core/printing/print_view_manager_base_qt.cpp
+++ b/src/core/printing/print_view_manager_base_qt.cpp
@@ -48,10 +48,9 @@
#include "web_engine_context.h"
#include "base/memory/ref_counted_memory.h"
-#include "base/message_loop/message_loop.h"
-#include "base/message_loop/message_loop_current.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
+#include "base/task/current_thread.h"
#include "base/task/post_task.h"
#include "base/timer/timer.h"
#include "base/values.h"
@@ -59,10 +58,13 @@
#include "chrome/browser/printing/print_job.h"
#include "chrome/browser/printing/print_job_manager.h"
#include "chrome/browser/printing/printer_query.h"
+#include "components/printing/browser/print_manager_utils.h"
+#include "components/printing/common/print.mojom.h"
#include "components/printing/common/print_messages.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_frame_host.h"
+#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
@@ -72,12 +74,71 @@
namespace QtWebEngineCore {
+namespace {
+
+// Runs |callback| with |params| to reply to
+// mojom::PrintManagerHost::GetDefaultPrintSettings.
+void GetDefaultPrintSettingsReply(printing::mojom::PrintManagerHost::GetDefaultPrintSettingsCallback callback,
+ printing::mojom::PrintParamsPtr params)
+{
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ std::move(callback).Run(std::move(params));
+}
+
+void GetDefaultPrintSettingsReplyOnIO(scoped_refptr<printing::PrintQueriesQueue> queue,
+ std::unique_ptr<printing::PrinterQuery> printer_query,
+ printing::mojom::PrintManagerHost::GetDefaultPrintSettingsCallback callback)
+{
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+ printing::mojom::PrintParamsPtr params = printing::mojom::PrintParams::New();
+ if (printer_query && printer_query->last_status() == printing::PrintingContext::OK) {
+ RenderParamsFromPrintSettings(printer_query->settings(), params.get());
+ params->document_cookie = printer_query->cookie();
+ }
+
+ content::GetUIThreadTaskRunner({})->PostTask(
+ FROM_HERE,
+ base::BindOnce(&GetDefaultPrintSettingsReply,
+ std::move(callback), std::move(params)));
+
+ // If printing was enabled.
+ if (printer_query) {
+ // If user hasn't cancelled.
+ if (printer_query->cookie() && printer_query->settings().dpi()) {
+ queue->QueuePrinterQuery(std::move(printer_query));
+ } else {
+ printer_query->StopWorker();
+ }
+ }
+}
+
+void GetDefaultPrintSettingsOnIO(printing::mojom::PrintManagerHost::GetDefaultPrintSettingsCallback callback,
+ scoped_refptr<printing::PrintQueriesQueue> queue,
+ int process_id, int routing_id)
+{
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+
+ std::unique_ptr<printing::PrinterQuery> printer_query = queue->PopPrinterQuery(0);
+ if (!printer_query)
+ printer_query = queue->CreatePrinterQuery(process_id, routing_id);
+
+ // Loads default settings. This is asynchronous, only the mojo message sender
+ // will hang until the settings are retrieved.
+ auto *printer_query_ptr = printer_query.get();
+ printer_query_ptr->GetSettings(
+ printing::PrinterQuery::GetSettingsAskParam::DEFAULTS, 0, false,
+ printing::mojom::MarginType::kDefaultMargins, false, false,
+ base::BindOnce(&GetDefaultPrintSettingsReplyOnIO, queue,
+ std::move(printer_query), std::move(callback)));
+}
+
+} // namespace
+
PrintViewManagerBaseQt::PrintViewManagerBaseQt(content::WebContents *contents)
: printing::PrintManager(contents)
- , m_isInsideInnerMessageLoop(false)
+ , m_printingRFH(nullptr)
, m_didPrintingSucceed(false)
, m_printerQueriesQueue(WebEngineContext::current()->getPrintJobManager()->queue())
- , m_printingRFH(nullptr)
{
// FIXME: Check if this needs to be executed async:
// TODO: Add isEnabled to profile
@@ -119,8 +180,7 @@ base::string16 PrintViewManagerBaseQt::RenderSourceName()
return toString16(QLatin1String(""));
}
-void PrintViewManagerBaseQt::PrintDocument(printing::PrintedDocument *document,
- const scoped_refptr<base::RefCountedMemory> &print_data,
+void PrintViewManagerBaseQt::PrintDocument(scoped_refptr<base::RefCountedMemory> print_data,
const gfx::Size &page_size,
const gfx::Rect &content_area,
const gfx::Point &offsets)
@@ -130,34 +190,37 @@ void PrintViewManagerBaseQt::PrintDocument(printing::PrintedDocument *document,
CHECK(metafile->InitFromData(*print_data));
// Update the rendered document. It will send notifications to the listener.
- document->SetDocument(std::move(metafile), page_size, content_area);
+ printing::PrintedDocument* document = m_printJob->document();
+ document->SetDocument(std::move(metafile));
ShouldQuitFromInnerMessageLoop();
}
-printing::PrintedDocument *PrintViewManagerBaseQt::GetDocument(int cookie)
+void PrintViewManagerBaseQt::DidGetPrintedPagesCount(int32_t cookie, uint32_t number_pages)
+{
+ PrintManager::DidGetPrintedPagesCount(cookie, number_pages);
+ OpportunisticallyCreatePrintJob(cookie);
+}
+
+bool PrintViewManagerBaseQt::PrintJobHasDocument(int cookie)
{
if (!OpportunisticallyCreatePrintJob(cookie))
- return nullptr;
+ return false;
+ // These checks may fail since we are completely asynchronous. Old spurious
+ // messages can be received if one of the processes is overloaded.
printing::PrintedDocument* document = m_printJob->document();
- if (!document || cookie != document->cookie()) {
- // Out of sync. It may happen since we are completely asynchronous. Old
- // spurious messages can be received if one of the processes is overloaded.
- return nullptr;
- }
- return document;
+ return document && document->cookie() == cookie;
}
// IPC handlers
void PrintViewManagerBaseQt::OnDidPrintDocument(content::RenderFrameHost* /*render_frame_host*/,
- const PrintHostMsg_DidPrintDocument_Params &params,
+ const printing::mojom::DidPrintDocumentParams &params,
std::unique_ptr<DelayedFrameDispatchHelper> helper)
{
- printing::PrintedDocument *document = GetDocument(params.document_cookie);
- if (!document)
+ if (!PrintJobHasDocument(params.document_cookie))
return;
- const PrintHostMsg_DidPrintContent_Params &content = params.content;
+ const printing::mojom::DidPrintContentParams &content = *params.content;
if (!content.metafile_data_region.IsValid()) {
NOTREACHED() << "invalid memory handle";
web_contents()->Stop();
@@ -171,26 +234,44 @@ void PrintViewManagerBaseQt::OnDidPrintDocument(content::RenderFrameHost* /*rend
return;
}
- PrintDocument(document, data, params.page_size, params.content_area,
+ PrintDocument(data, params.page_size, params.content_area,
params.physical_offsets);
if (helper)
helper->SendCompleted();
}
-void PrintViewManagerBaseQt::OnGetDefaultPrintSettings(content::RenderFrameHost *render_frame_host,
- IPC::Message *reply_msg)
+void PrintViewManagerBaseQt::GetDefaultPrintSettings(GetDefaultPrintSettingsCallback callback)
{
- NOTREACHED() << "should be handled by printing::PrintingMessageFilter";
+ content::RenderFrameHost* render_frame_host =
+ print_manager_host_receivers_.GetCurrentTargetFrame();
+
+ content::GetIOThreadTaskRunner({})->PostTask(
+ FROM_HERE,
+ base::BindOnce(&GetDefaultPrintSettingsOnIO, std::move(callback), m_printerQueriesQueue,
+ render_frame_host->GetProcess()->GetID(),
+ render_frame_host->GetRoutingID()));
+}
+
+void PrintViewManagerBaseQt::PrintingFailed(int32_t cookie)
+{
+ PrintManager::PrintingFailed(cookie);
+
+ ReleasePrinterQuery();
+
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_PRINT_JOB_RELEASED,
+ content::Source<content::WebContents>(web_contents()),
+ content::NotificationService::NoDetails());
}
void PrintViewManagerBaseQt::OnScriptedPrint(content::RenderFrameHost *render_frame_host,
- const PrintHostMsg_ScriptedPrint_Params &params,
+ const printing::mojom::ScriptedPrintParams &params,
IPC::Message *reply_msg)
{
NOTREACHED() << "should be handled by printing::PrintingMessageFilter";
}
-void PrintViewManagerBaseQt::OnShowInvalidPrinterSettingsError()
+void PrintViewManagerBaseQt::ShowInvalidPrinterSettingsError()
{
}
@@ -203,6 +284,8 @@ void PrintViewManagerBaseQt::DidStartLoading()
// so m_printingRFH is never set and used at the moment.
void PrintViewManagerBaseQt::RenderFrameDeleted(content::RenderFrameHost *render_frame_host)
{
+ PrintManager::RenderFrameDeleted(render_frame_host);
+
// Terminates or cancels the print job if one was pending.
if (render_frame_host != m_printingRFH)
return;
@@ -216,7 +299,7 @@ void PrintViewManagerBaseQt::RenderFrameDeleted(content::RenderFrameHost *render
return;
scoped_refptr<printing::PrintedDocument> document(m_printJob->document());
- if (document.get()) {
+ if (document) {
// If IsComplete() returns false, the document isn't completely rendered.
// Since our renderer is gone, there's nothing to do, cancel it. Otherwise,
// the print job may finish without problem.
@@ -224,18 +307,6 @@ void PrintViewManagerBaseQt::RenderFrameDeleted(content::RenderFrameHost *render
}
}
-bool PrintViewManagerBaseQt::OnMessageReceived(const IPC::Message& message,
- content::RenderFrameHost* render_frame_host)
-{
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(PrintViewManagerBaseQt, message)
- IPC_MESSAGE_HANDLER(PrintHostMsg_ShowInvalidPrinterSettingsError,
- OnShowInvalidPrinterSettingsError);
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- return handled || PrintManager::OnMessageReceived(message, render_frame_host);
-}
-
void PrintViewManagerBaseQt::Observe(int type,
const content::NotificationSource& /*source*/,
const content::NotificationDetails& details)
@@ -333,28 +404,21 @@ bool PrintViewManagerBaseQt::RenderAllMissingPagesNow()
return true;
}
-// Quits the current message loop if these conditions hold true: a document is
-// loaded and is complete and waiting_for_pages_to_be_rendered_ is true. This
-// function is called in DidPrintPage() or on ALL_PAGES_REQUESTED
-// notification. The inner message loop is created was created by
-// RenderAllMissingPagesNow().
void PrintViewManagerBaseQt::ShouldQuitFromInnerMessageLoop()
{
// Look at the reason.
DCHECK(m_printJob->document());
- if (m_printJob->document() &&
- m_printJob->document()->IsComplete() &&
- m_isInsideInnerMessageLoop) {
- // We are in a message loop created by RenderAllMissingPagesNow. Quit from
- // it.
- base::RunLoop::QuitCurrentWhenIdleDeprecated();
- m_isInsideInnerMessageLoop = false;
+ if (m_printJob->document() && m_printJob->document()->IsComplete() && m_quitInnerLoop) {
+ // We are in a message loop created by RenderAllMissingPagesNow. Quit from
+ // it.
+ std::move(m_quitInnerLoop).Run();
}
}
bool PrintViewManagerBaseQt::CreateNewPrintJob(std::unique_ptr<printing::PrinterQuery> query)
{
- DCHECK(!m_isInsideInnerMessageLoop);
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ DCHECK(!m_quitInnerLoop);
DCHECK(query);
// Disconnect the current |m_printJob|.
@@ -405,9 +469,9 @@ void PrintViewManagerBaseQt::TerminatePrintJob(bool cancel)
if (cancel) {
// We don't need the metafile data anymore because the printing is canceled.
m_printJob->Cancel();
- m_isInsideInnerMessageLoop = false;
+ m_quitInnerLoop.Reset();
} else {
- DCHECK(!m_isInsideInnerMessageLoop);
+ DCHECK(!m_quitInnerLoop);
DCHECK(!m_printJob->document() || m_printJob->document()->IsComplete());
// WebContents is either dying or navigating elsewhere. We need to render
@@ -435,7 +499,8 @@ void PrintViewManagerBaseQt::ReleasePrintJob()
m_printJob = nullptr;
}
-bool PrintViewManagerBaseQt::RunInnerMessageLoop() {
+bool PrintViewManagerBaseQt::RunInnerMessageLoop()
+{
// This value may actually be too low:
//
// - If we're looping because of printer settings initialization, the premise
@@ -454,20 +519,16 @@ bool PrintViewManagerBaseQt::RunInnerMessageLoop() {
base::TimeDelta::FromMilliseconds(kPrinterSettingsTimeout),
run_loop.QuitWhenIdleClosure());
- m_isInsideInnerMessageLoop = true;
+ m_quitInnerLoop = run_loop.QuitClosure();
// Need to enable recursive task.
{
- base::MessageLoopCurrent::ScopedNestableTaskAllower allow;
+ base::CurrentThread::ScopedNestableTaskAllower allow;
run_loop.Run();
}
- bool success = true;
- if (m_isInsideInnerMessageLoop) {
- // Ok we timed out. That's sad.
- m_isInsideInnerMessageLoop = false;
- success = false;
- }
+ bool success = !m_quitInnerLoop;
+ m_quitInnerLoop.Reset();
return success;
}
diff --git a/src/core/printing/print_view_manager_base_qt.h b/src/core/printing/print_view_manager_base_qt.h
index 1217e8c11..3086d5d3a 100644
--- a/src/core/printing/print_view_manager_base_qt.h
+++ b/src/core/printing/print_view_manager_base_qt.h
@@ -48,27 +48,22 @@
#include "base/strings/string16.h"
#include "components/prefs/pref_member.h"
#include "components/printing/browser/print_manager.h"
+#include "components/printing/common/print.mojom-forward.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
-struct PrintHostMsg_DidPrintDocument_Params;
-
namespace base {
class RefCountedBytes;
}
namespace content {
class RenderFrameHost;
-class RenderViewHost;
}
namespace printing {
class JobEventDetails;
-class MetafilePlayer;
class PrintJob;
-class PrintJobWorkerOwner;
class PrintQueriesQueue;
-class PrintedDocument;
class PrinterQuery;
}
@@ -82,62 +77,70 @@ public:
// Whether printing is enabled or not.
void UpdatePrintingEnabled();
- virtual base::string16 RenderSourceName();
+ base::string16 RenderSourceName();
+
+ // mojom::PrintManagerHost:
+ void DidGetPrintedPagesCount(int32_t cookie, uint32_t number_pages) override;
+ void GetDefaultPrintSettings(GetDefaultPrintSettingsCallback callback) override;
+ void ShowInvalidPrinterSettingsError() override;
+ void PrintingFailed(int32_t cookie) override;
protected:
explicit PrintViewManagerBaseQt(content::WebContents*);
void SetPrintingRFH(content::RenderFrameHost* rfh);
- // content::WebContentsObserver implementation.
// Cancels the print job.
void NavigationStopped() override;
// content::WebContentsObserver implementation.
void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
- bool OnMessageReceived(const IPC::Message& message,
- content::RenderFrameHost* render_frame_host) override;
- // printing::PrintManager implementation:
- void OnDidPrintDocument(content::RenderFrameHost *render_frame_host,
- const PrintHostMsg_DidPrintDocument_Params &params,
- std::unique_ptr<DelayedFrameDispatchHelper> helper) override;
- void OnGetDefaultPrintSettings(content::RenderFrameHost* render_frame_host,
- IPC::Message* reply_msg) override;
- void OnScriptedPrint(content::RenderFrameHost* render_frame_host,
- const PrintHostMsg_ScriptedPrint_Params& params,
- IPC::Message* reply_msg) override;
+ // Creates a new empty print job. It has no settings loaded. If there is
+ // currently a print job, safely disconnect from it. Returns false if it is
+ // impossible to safely disconnect from the current print job or it is
+ // impossible to create a new print job.
+ virtual bool CreateNewPrintJob(std::unique_ptr<printing::PrinterQuery> query);
- void OnShowInvalidPrinterSettingsError();
+ // Makes sure the current print_job_ has all its data before continuing, and
+ // disconnect from it.
+ void DisconnectFromCurrentPrintJob();
- // Processes a NOTIFY_PRINT_JOB_EVENT notification.
- void OnNotifyPrintJobEvent(const printing::JobEventDetails& event_details);
+ void StopWorker(int documentCookie);
+private:
// content::NotificationObserver implementation.
void Observe(int,
const content::NotificationSource&,
const content::NotificationDetails&) override;
- void StopWorker(int document_cookie);
- // In the case of Scripted Printing, where the renderer is controlling the
- // control flow, print_job_ is initialized whenever possible. No-op is
- // print_job_ is initialized.
- bool OpportunisticallyCreatePrintJob(int cookie);
+ // content::WebContentsObserver implementation.
+ void DidStartLoading() override;
+
+ // printing::PrintManager:
+ void OnDidPrintDocument(
+ content::RenderFrameHost *render_frame_host,
+ const printing::mojom::DidPrintDocumentParams &params,
+ std::unique_ptr<DelayedFrameDispatchHelper> helper) override;
+ void OnScriptedPrint(content::RenderFrameHost *render_frame_host,
+ const printing::mojom::ScriptedPrintParams &params,
+ IPC::Message *reply_msg) override;
+
+ // Processes a NOTIFY_PRINT_JOB_EVENT notification.
+ void OnNotifyPrintJobEvent(const printing::JobEventDetails &event_details);
// Requests the RenderView to render all the missing pages for the print job.
// No-op if no print job is pending. Returns true if at least one page has
// been requested to the renderer.
bool RenderAllMissingPagesNow();
- // Checks that synchronization is correct and a print query exists for
- // |cookie|. If so, returns the document associated with the cookie.
- printing::PrintedDocument* GetDocument(int cookie);
+ // Checks that synchronization is correct with |print_job_| based on |cookie|.
+ bool PrintJobHasDocument(int cookie);
- // Starts printing a document with data given in |print_data|. |print_data|
- // must successfully initialize a metafile. |document| is the printed
- // document associated with the print job. Returns true if successful.
- void PrintDocument(printing::PrintedDocument *document,
- const scoped_refptr<base::RefCountedMemory> &print_data,
+ // Starts printing the |document| in |print_job_| with the given |print_data|.
+ // This method assumes PrintJobHasDocument() has been called, and |print_data|
+ // contains valid data.
+ void PrintDocument(scoped_refptr<base::RefCountedMemory> print_data,
const gfx::Size &page_size,
const gfx::Rect &content_area,
const gfx::Point &offsets);
@@ -149,29 +152,43 @@ protected:
// RenderAllMissingPagesNow().
void ShouldQuitFromInnerMessageLoop();
- bool RunInnerMessageLoop();
-
+ // Terminates the print job. No-op if no print job has been created. If
+ // |cancel| is true, cancel it instead of waiting for the job to finish. Will
+ // call ReleasePrintJob().
void TerminatePrintJob(bool cancel);
- void DisconnectFromCurrentPrintJob();
- bool CreateNewPrintJob(std::unique_ptr<printing::PrinterQuery> query);
+ // Releases print_job_. Correctly deregisters from notifications. No-op if
+ // no print job has been created.
void ReleasePrintJob();
+
+ // Runs an inner message loop. It will set inside_inner_message_loop_ to true
+ // while the blocking inner message loop is running. This is useful in cases
+ // where the RenderView is about to be destroyed while a printing job isn't
+ // finished.
+ bool RunInnerMessageLoop();
+
+ // In the case of Scripted Printing, where the renderer is controlling the
+ // control flow, print_job_ is initialized whenever possible. No-op is
+ // print_job_ is initialized.
+ bool OpportunisticallyCreatePrintJob(int cookie);
+
+ // Release the PrinterQuery associated with our |cookie_|.
void ReleasePrinterQuery();
-private:
// Helper method for UpdatePrintingEnabled().
void SendPrintingEnabled(bool enabled, content::RenderFrameHost* rfh);
- // content::WebContentsObserver implementation.
- void DidStartLoading() override;
private:
content::NotificationRegistrar m_registrar;
scoped_refptr<printing::PrintJob> m_printJob;
- bool m_isInsideInnerMessageLoop;
+ content::RenderFrameHost *m_printingRFH;
bool m_didPrintingSucceed;
+ // Set while running an inner message loop inside RenderAllMissingPagesNow().
+ // This means we are _blocking_ until all the necessary pages have been
+ // rendered or the print settings are being loaded.
+ base::OnceClosure m_quitInnerLoop;
scoped_refptr<printing::PrintQueriesQueue> m_printerQueriesQueue;
- // The current RFH that is printing with a system printing dialog.
- content::RenderFrameHost *m_printingRFH;
+
DISALLOW_COPY_AND_ASSIGN(PrintViewManagerBaseQt);
};
diff --git a/src/core/printing/print_view_manager_qt.cpp b/src/core/printing/print_view_manager_qt.cpp
index df7fcc0fc..de1b81fb9 100644
--- a/src/core/printing/print_view_manager_qt.cpp
+++ b/src/core/printing/print_view_manager_qt.cpp
@@ -37,6 +37,7 @@
**
****************************************************************************/
+// Loosely based on print_view_manager.cc and print_preview_message_handler.cc
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE.Chromium file.
@@ -56,13 +57,13 @@
#include "base/task/post_task.h"
#include "chrome/browser/printing/print_job_manager.h"
#include "chrome/browser/printing/printer_query.h"
+#include "components/printing/common/print.mojom.h"
#include "components/printing/common/print_messages.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_frame_host.h"
-#include "content/public/common/web_preferences.h"
#include "printing/metafile_skia.h"
#include "printing/print_job_constants.h"
#include "printing/units.h"
@@ -121,12 +122,12 @@ static base::DictionaryValue *createPrintSettings()
printSettings->SetInteger(printing::kPreviewRequestID, internalRequestId);
// The following are standard settings that Chromium expects to be set.
- printSettings->SetInteger(printing::kSettingPrinterType, printing::kPdfPrinter);
+ printSettings->SetInteger(printing::kSettingPrinterType, static_cast<int>(printing::PrinterType::kPdf));
printSettings->SetInteger(printing::kSettingDpiHorizontal, printing::kPointsPerInch);
printSettings->SetInteger(printing::kSettingDpiVertical, printing::kPointsPerInch);
- printSettings->SetInteger(printing::kSettingDuplexMode, printing::SIMPLEX);
+ printSettings->SetInteger(printing::kSettingDuplexMode, static_cast<int>(printing::mojom::DuplexMode::kSimplex));
printSettings->SetInteger(printing::kSettingCopies, 1);
printSettings->SetInteger(printing::kSettingPagesPerSheet, 1);
printSettings->SetBoolean(printing::kSettingCollate, false);
@@ -162,14 +163,14 @@ static base::DictionaryValue *createPrintSettingsFromQPageLayout(const QPageLayo
marginsDict->SetInteger(printing::kSettingMarginRight, pageMarginsInPoints.right());
printSettings->Set(printing::kSettingMarginsCustom, std::move(marginsDict));
- printSettings->SetInteger(printing::kSettingMarginsType, printing::CUSTOM_MARGINS);
+ printSettings->SetInteger(printing::kSettingMarginsType, (int)printing::mojom::MarginType::kCustomMargins);
// pageSizeInMillimeter is in portrait orientation. Transpose it if necessary.
printSettings->SetBoolean(printing::kSettingLandscape, pageLayout.orientation() == QPageLayout::Landscape);
} else {
// QPrinter will handle margins
pageSizeInMillimeter = pageLayout.paintRect(QPageLayout::Millimeter);
- printSettings->SetInteger(printing::kSettingMarginsType, printing::NO_MARGINS);
+ printSettings->SetInteger(printing::kSettingMarginsType, (int)printing::mojom::MarginType::kNoMargins);
// pageSizeInMillimeter already contains the orientation.
printSettings->SetBoolean(printing::kSettingLandscape, false);
@@ -261,12 +262,11 @@ bool PrintViewManagerQt::PrintToPDFInternal(const QPageLayout &pageLayout,
m_printSettings.reset(createPrintSettingsFromQPageLayout(pageLayout, useCustomMargins));
m_printSettings->SetBoolean(printing::kSettingShouldPrintBackgrounds,
- web_contents()->GetRenderViewHost()->
- GetWebkitPreferences().should_print_backgrounds);
+ web_contents()->GetOrCreateWebPreferences().should_print_backgrounds);
m_printSettings->SetInteger(printing::kSettingColor,
- printInColor ? printing::COLOR : printing::GRAYSCALE);
+ int(printInColor ? printing::mojom::ColorModel::kColor : printing::mojom::ColorModel::kGrayscale));
- if (web_contents()->ShowingInterstitialPage() || web_contents()->IsCrashed())
+ if (web_contents()->IsCrashed())
return false;
content::RenderFrameHost* rfh = web_contents()->GetMainFrame();
@@ -277,12 +277,6 @@ bool PrintViewManagerQt::PrintToPDFInternal(const QPageLayout &pageLayout,
return true;
}
-// PrintedPagesSource implementation.
-base::string16 PrintViewManagerQt::RenderSourceName()
-{
- return base::string16();
-}
-
PrintViewManagerQt::PrintViewManagerQt(content::WebContents *contents)
: PrintViewManagerBaseQt(contents)
, m_printPreviewRfh(nullptr)
@@ -297,7 +291,6 @@ bool PrintViewManagerQt::OnMessageReceived(const IPC::Message& message,
FrameDispatchHelper helper = {this, render_frame_host};
bool handled = true;
IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(PrintViewManagerQt, message, render_frame_host);
- IPC_MESSAGE_HANDLER(PrintHostMsg_DidShowPrintDialog, OnDidShowPrintDialog)
IPC_MESSAGE_HANDLER(PrintHostMsg_RequestPrintPreview, OnRequestPrintPreview)
IPC_MESSAGE_HANDLER(PrintHostMsg_MetafileReadyForPrinting, OnMetafileReadyForPrinting);
IPC_MESSAGE_HANDLER(PrintHostMsg_DidPreviewPage, OnDidPreviewPage)
@@ -356,8 +349,8 @@ void PrintViewManagerQt::OnRequestPrintPreview(
}
void PrintViewManagerQt::OnMetafileReadyForPrinting(content::RenderFrameHost* rfh,
- const PrintHostMsg_DidPreviewDocument_Params& params,
- const PrintHostMsg_PreviewIds &ids)
+ const printing::mojom::DidPreviewDocumentParams& params,
+ const printing::mojom::PreviewIds &ids)
{
StopWorker(params.document_cookie);
@@ -369,20 +362,16 @@ void PrintViewManagerQt::OnMetafileReadyForPrinting(content::RenderFrameHost* rf
resetPdfState();
if (!pdf_print_callback.is_null()) {
- QSharedPointer<QByteArray> data_array = GetStdVectorFromHandle(params.content.metafile_data_region);
+ QSharedPointer<QByteArray> data_array = GetStdVectorFromHandle(params.content->metafile_data_region);
base::PostTask(FROM_HERE, {content::BrowserThread::UI},
base::BindOnce(pdf_print_callback, data_array));
} else {
- scoped_refptr<base::RefCountedBytes> data_bytes = GetBytesFromHandle(params.content.metafile_data_region);
+ scoped_refptr<base::RefCountedBytes> data_bytes = GetBytesFromHandle(params.content->metafile_data_region);
base::PostTask(FROM_HERE, {base::ThreadPool(), base::MayBlock()},
base::BindOnce(&SavePdfFile, data_bytes, pdfOutputPath, pdf_save_callback));
}
}
-void PrintViewManagerQt::OnDidShowPrintDialog()
-{
-}
-
// content::WebContentsObserver implementation.
void PrintViewManagerQt::DidStartLoading()
{
@@ -411,8 +400,8 @@ void PrintViewManagerQt::RenderProcessGone(base::TerminationStatus status)
}
void PrintViewManagerQt::OnDidPreviewPage(content::RenderFrameHost* rfh,
- const PrintHostMsg_DidPreviewPage_Params& params,
- const PrintHostMsg_PreviewIds& ids)
+ const printing::mojom::DidPreviewPageParams &params,
+ const printing::mojom::PreviewIds& ids)
{
// just consume the message, this is just for sending 'page-preview-ready' for webui
}
diff --git a/src/core/printing/print_view_manager_qt.h b/src/core/printing/print_view_manager_qt.h
index 06c2f47ea..ecb3d6053 100644
--- a/src/core/printing/print_view_manager_qt.h
+++ b/src/core/printing/print_view_manager_qt.h
@@ -51,31 +51,13 @@
#include "base/memory/ref_counted.h"
#include "base/strings/string16.h"
#include "components/prefs/pref_member.h"
-#include "components/printing/browser/print_manager.h"
#include "components/printing/common/print.mojom.h"
#include "components/printing/common/print_messages.h"
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_contents_user_data.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include <QSharedPointer>
-struct PrintHostMsg_RequestPrintPreview_Params;
-struct PrintHostMsg_DidPreviewDocument_Params;
-
-namespace content {
-class RenderViewHost;
-}
-
-namespace printing {
-class JobEventDetails;
-class MetafilePlayer;
-class PrintJob;
-class PrintJobWorkerOwner;
-class PrintQueriesQueue;
-}
-
QT_BEGIN_NAMESPACE
class QPageLayout;
class QString;
@@ -101,8 +83,6 @@ public:
bool useCustomMargins,
const PrintToPDFCallback &callback);
- base::string16 RenderSourceName() override;
-
protected:
explicit PrintViewManagerQt(content::WebContents*);
@@ -119,16 +99,15 @@ protected:
void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
// IPC handlers
- void OnDidShowPrintDialog();
void OnRequestPrintPreview(const PrintHostMsg_RequestPrintPreview_Params&);
void OnMetafileReadyForPrinting(content::RenderFrameHost* rfh,
- const PrintHostMsg_DidPreviewDocument_Params& params,
- const PrintHostMsg_PreviewIds &ids);
+ const printing::mojom::DidPreviewDocumentParams& params,
+ const printing::mojom::PreviewIds &ids);
void OnSetupScriptedPrintPreview(content::RenderFrameHost* rfh,
IPC::Message* reply_msg);
void OnDidPreviewPage(content::RenderFrameHost* rfh,
- const PrintHostMsg_DidPreviewPage_Params& params,
- const PrintHostMsg_PreviewIds& ids);
+ const printing::mojom::DidPreviewPageParams& params,
+ const printing::mojom::PreviewIds& ids);
void OnShowScriptedPrintPreview(content::RenderFrameHost* rfh,
bool source_is_modifiable);
bool PrintToPDFInternal(const QPageLayout &, bool printInColor, bool useCustomMargins = true);
diff --git a/src/core/printing/printing_message_filter_qt.cpp b/src/core/printing/printing_message_filter_qt.cpp
index 5b9228d20..8d6833dce 100644
--- a/src/core/printing/printing_message_filter_qt.cpp
+++ b/src/core/printing/printing_message_filter_qt.cpp
@@ -46,20 +46,14 @@
#include "web_engine_context.h"
-#include <string>
-
#include "base/bind.h"
#include "chrome/browser/printing/print_job_manager.h"
#include "chrome/browser/printing/printer_query.h"
#include "components/printing/browser/print_manager_utils.h"
#include "components/printing/common/print_messages.h"
#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/render_view_host.h"
-#include "content/public/browser/web_contents.h"
#include "content/public/common/child_process_host.h"
-using content::BrowserThread;
-
namespace QtWebEngineCore {
PrintingMessageFilterQt::PrintingMessageFilterQt(int render_process_id)
@@ -72,15 +66,14 @@ PrintingMessageFilterQt::PrintingMessageFilterQt(int render_process_id)
PrintingMessageFilterQt::~PrintingMessageFilterQt() {
}
-void PrintingMessageFilterQt::OverrideThreadForMessage(
- const IPC::Message& message, BrowserThread::ID* thread) {
+void PrintingMessageFilterQt::OnDestruct() const
+{
+ content::BrowserThread::DeleteOnUIThread::Destruct(this);
}
bool PrintingMessageFilterQt::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(PrintingMessageFilterQt, message)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_GetDefaultPrintSettings,
- OnGetDefaultPrintSettings)
IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_ScriptedPrint, OnScriptedPrint)
IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_UpdatePrintSettings,
OnUpdatePrintSettings)
@@ -90,57 +83,8 @@ bool PrintingMessageFilterQt::OnMessageReceived(const IPC::Message& message) {
return handled;
}
-void PrintingMessageFilterQt::OnGetDefaultPrintSettings(IPC::Message* reply_msg) {
- DCHECK_CURRENTLY_ON(BrowserThread::IO);
- std::unique_ptr<printing::PrinterQuery> printer_query;
-
- printer_query = queue_->PopPrinterQuery(0);
- if (!printer_query) {
- printer_query =
- queue_->CreatePrinterQuery(render_process_id_, reply_msg->routing_id());
- }
-
- // Loads default settings. This is asynchronous, only the IPC message sender
- // will hang until the settings are retrieved.
- printer_query->GetSettings(
- printing::PrinterQuery::GetSettingsAskParam::DEFAULTS,
- 0,
- false,
- printing::DEFAULT_MARGINS,
- false,
- false,
- base::BindOnce(&PrintingMessageFilterQt::OnGetDefaultPrintSettingsReply,
- this,
- std::move(printer_query),
- reply_msg));
-}
-
-void PrintingMessageFilterQt::OnGetDefaultPrintSettingsReply(
- std::unique_ptr<printing::PrinterQuery> printer_query,
- IPC::Message* reply_msg) {
- PrintMsg_Print_Params params;
- if (!printer_query.get() ||
- printer_query->last_status() != printing::PrintingContext::OK) {
- params.Reset();
- } else {
- RenderParamsFromPrintSettings(printer_query->settings(), &params);
- params.document_cookie = printer_query->cookie();
- }
- PrintHostMsg_GetDefaultPrintSettings::WriteReplyParams(reply_msg, params);
- Send(reply_msg);
- // If printing was enabled.
- if (printer_query.get()) {
- // If user hasn't cancelled.
- if (printer_query->cookie() && printer_query->settings().dpi()) {
- queue_->QueuePrinterQuery(std::move(printer_query));
- } else {
- printer_query->StopWorker();
- }
- }
-}
-
void PrintingMessageFilterQt::OnScriptedPrint(
- const PrintHostMsg_ScriptedPrint_Params& params,
+ const printing::mojom::ScriptedPrintParams& params,
IPC::Message* reply_msg) {
std::unique_ptr<printing::PrinterQuery> printer_query =
queue_->PopPrinterQuery(params.cookie);
@@ -164,19 +108,19 @@ void PrintingMessageFilterQt::OnScriptedPrint(
void PrintingMessageFilterQt::OnScriptedPrintReply(
std::unique_ptr<printing::PrinterQuery> printer_query,
IPC::Message* reply_msg) {
- PrintMsg_PrintPages_Params params;
-
+ printing::mojom::PrintPagesParams params;
+ params.params = printing::mojom::PrintParams::New();
if (printer_query->last_status() != printing::PrintingContext::OK ||
!printer_query->settings().dpi()) {
- params.Reset();
+ params.params.reset();
} else {
- RenderParamsFromPrintSettings(printer_query->settings(), &params.params);
- params.params.document_cookie = printer_query->cookie();
+ RenderParamsFromPrintSettings(printer_query->settings(), params.params.get());
+ params.params->document_cookie = printer_query->cookie();
params.pages = printing::PageRange::GetPages(printer_query->settings().ranges());
}
PrintHostMsg_ScriptedPrint::WriteReplyParams(reply_msg, params);
Send(reply_msg);
- if (!params.params.dpi.IsEmpty() && params.params.document_cookie) {
+ if (!params.params->dpi.IsEmpty() && params.params->document_cookie) {
queue_->QueuePrinterQuery(std::move(printer_query));
} else {
printer_query->StopWorker();
@@ -186,13 +130,21 @@ void PrintingMessageFilterQt::OnScriptedPrintReply(
void PrintingMessageFilterQt::OnUpdatePrintSettings(int document_cookie,
base::Value job_settings,
IPC::Message* reply_msg) {
- std::unique_ptr<printing::PrinterQuery> printer_query;
- printer_query = queue_->PopPrinterQuery(document_cookie);
+ if (!job_settings.is_dict() ||
+ !job_settings.FindIntKey(printing::kSettingPrinterType)) {
+ // Reply with null query.
+ OnUpdatePrintSettingsReply(nullptr, reply_msg);
+ return;
+ }
+
+ std::unique_ptr<printing::PrinterQuery> printer_query =
+ queue_->PopPrinterQuery(document_cookie);
if (!printer_query.get()) {
printer_query = queue_->CreatePrinterQuery(
content::ChildProcessHost::kInvalidUniqueID, MSG_ROUTING_NONE);
}
- printer_query->SetSettings(
+ auto* printer_query_ptr = printer_query.get();
+ printer_query_ptr->SetSettings(
std::move(job_settings),
base::BindOnce(&PrintingMessageFilterQt::OnUpdatePrintSettingsReply, this,
std::move(printer_query), reply_msg));
@@ -200,13 +152,14 @@ void PrintingMessageFilterQt::OnUpdatePrintSettings(int document_cookie,
void PrintingMessageFilterQt::OnUpdatePrintSettingsReply(std::unique_ptr<printing::PrinterQuery> printer_query,
IPC::Message* reply_msg) {
- PrintMsg_PrintPages_Params params;
+ printing::mojom::PrintPagesParams params;
+ params.params = printing::mojom::PrintParams::New();
if (!printer_query.get() ||
printer_query->last_status() != printing::PrintingContext::OK) {
- params.Reset();
+ params.params.reset();
} else {
- RenderParamsFromPrintSettings(printer_query->settings(), &params.params);
- params.params.document_cookie = printer_query->cookie();
+ RenderParamsFromPrintSettings(printer_query->settings(), params.params.get());
+ params.params->document_cookie = printer_query->cookie();
params.pages = printing::PageRange::GetPages(printer_query->settings().ranges());
}
@@ -226,7 +179,7 @@ void PrintingMessageFilterQt::OnUpdatePrintSettingsReply(std::unique_ptr<printin
}
}
-void PrintingMessageFilterQt::OnCheckForCancel(const PrintHostMsg_PreviewIds& ids,
+void PrintingMessageFilterQt::OnCheckForCancel(const printing::mojom::PreviewIds& ids,
bool* cancel) {
*cancel = false;
}
diff --git a/src/core/printing/printing_message_filter_qt.h b/src/core/printing/printing_message_filter_qt.h
index 89e473dcf..3a449af70 100644
--- a/src/core/printing/printing_message_filter_qt.h
+++ b/src/core/printing/printing_message_filter_qt.h
@@ -46,24 +46,13 @@
#include <string>
-#include "base/compiler_specific.h"
-#include "components/prefs/pref_member.h"
#include "content/public/browser/browser_message_filter.h"
-struct PrintHostMsg_PreviewIds;
-struct PrintHostMsg_ScriptedPrint_Params;
-
-namespace base {
-class DictionaryValue;
-class FilePath;
-}
-
-namespace content {
-class WebContents;
-}
-
namespace printing {
-class PrintJobManager;
+namespace mojom {
+class ScriptedPrintParams;
+class PreviewIds;
+}
class PrintQueriesQueue;
class PrinterQuery;
}
@@ -76,28 +65,20 @@ class PrintingMessageFilterQt : public content::BrowserMessageFilter {
PrintingMessageFilterQt(int render_process_id);
// content::BrowserMessageFilter methods.
- void OverrideThreadForMessage(const IPC::Message& message,
- content::BrowserThread::ID* thread) override;
bool OnMessageReceived(const IPC::Message& message) override;
private:
- ~PrintingMessageFilterQt() override;
+ friend class base::DeleteHelper<PrintingMessageFilterQt>;
+ friend class content::BrowserThread;
- // GetPrintSettingsForRenderView must be called via PostTask and
- // base::Bind. Collapse the settings-specific params into a
- // struct to avoid running into issues with too many params
- // to base::Bind.
- struct GetPrintSettingsForRenderViewParams;
+ ~PrintingMessageFilterQt() override;
- // Get the default print setting.
- void OnGetDefaultPrintSettings(IPC::Message* reply_msg);
- void OnGetDefaultPrintSettingsReply(std::unique_ptr<printing::PrinterQuery> printer_query,
- IPC::Message* reply_msg);
+ void OnDestruct() const override;
// The renderer host have to show to the user the print dialog and returns
// the selected print settings. The task is handled by the print worker
// thread and the UI thread. The reply occurs on the IO thread.
- void OnScriptedPrint(const PrintHostMsg_ScriptedPrint_Params& params,
+ void OnScriptedPrint(const printing::mojom::ScriptedPrintParams& params,
IPC::Message* reply_msg);
void OnScriptedPrintReply(std::unique_ptr<printing::PrinterQuery> printer_query,
IPC::Message* reply_msg);
@@ -112,7 +93,7 @@ class PrintingMessageFilterQt : public content::BrowserMessageFilter {
IPC::Message* reply_msg);
// Check to see if print preview has been cancelled.
- void OnCheckForCancel(const PrintHostMsg_PreviewIds& ids, bool* cancel);
+ void OnCheckForCancel(const printing::mojom::PreviewIds& ids, bool* cancel);
const int render_process_id_;
diff --git a/src/core/process_main.cpp b/src/core/process_main.cpp
index ade0f6e99..827e31037 100644
--- a/src/core/process_main.cpp
+++ b/src/core/process_main.cpp
@@ -44,7 +44,7 @@
#if defined(OS_WIN)
#include "sandbox/win/src/sandbox_types.h"
#include "content/public/app/sandbox_helper_win.h"
-#elif defined(OS_MACOSX)
+#elif defined(OS_MAC)
#include "base/logging.h"
#include "sandbox/mac/seatbelt_exec.h"
#endif
@@ -74,13 +74,13 @@ int processMain(int argc, const char **argv)
params.argc = argc;
params.argv = argv;
#endif // OS_WIN
-#if defined(OS_MACOSX)
+#if defined(OS_MAC)
sandbox::SeatbeltExecServer::CreateFromArgumentsResult seatbelt =
sandbox::SeatbeltExecServer::CreateFromArguments(argv[0], argc, const_cast<char**>(argv));
if (seatbelt.sandbox_required) {
CHECK(seatbelt.server->InitializeSandbox());
}
-#endif // defined(OS_MACOSX)
+#endif // defined(OS_MAC)
return content::ContentMain(params);
}
diff --git a/src/core/profile_adapter.cpp b/src/core/profile_adapter.cpp
index d996ff09b..577d0f6c8 100644
--- a/src/core/profile_adapter.cpp
+++ b/src/core/profile_adapter.cpp
@@ -99,7 +99,6 @@ ProfileAdapter::ProfileAdapter(const QString &storageName):
WebEngineContext::current()->addProfileAdapter(this);
// creation of profile requires webengine context
m_profile.reset(new ProfileQt(this));
- content::BrowserContext::Initialize(m_profile.data(), toFilePath(dataPath()));
// fixme: this should not be here
m_profile->m_profileIOData->initializeOnUIThread();
m_customUrlSchemeHandlers.insert(QByteArrayLiteral("qrc"), &m_qrcHandler);
diff --git a/src/core/profile_io_data_qt.cpp b/src/core/profile_io_data_qt.cpp
index 91adbc57d..68e674f01 100644
--- a/src/core/profile_io_data_qt.cpp
+++ b/src/core/profile_io_data_qt.cpp
@@ -160,7 +160,7 @@ BrowsingDataRemoverObserverQt::BrowsingDataRemoverObserverQt(ProfileIODataQt *pr
{
}
-void BrowsingDataRemoverObserverQt::OnBrowsingDataRemoverDone()
+void BrowsingDataRemoverObserverQt::OnBrowsingDataRemoverDone(uint64_t)
{
Q_ASSERT(m_profileIOData->m_clearHttpCacheInProgress);
m_profileIOData->removeBrowsingDataRemoverObserver();
@@ -177,7 +177,6 @@ void ProfileIODataQt::setFullConfiguration()
m_httpCacheType = m_profileAdapter->httpCacheType();
m_httpCachePath = m_profileAdapter->httpCachePath();
m_httpCacheMaxSize = m_profileAdapter->httpCacheMaxSize();
- m_useForGlobalCertificateVerification = m_profileAdapter->isUsedForGlobalCertificateVerification();
m_dataPath = m_profileAdapter->dataPath();
m_storageName = m_profileAdapter->storageName();
m_inMemoryOnly = m_profileAdapter->isOffTheRecord() || m_storageName.isEmpty();
@@ -216,12 +215,14 @@ std::unique_ptr<net::ClientCertStore> ProfileIODataQt::CreateClientCertStore()
#endif
}
-network::mojom::NetworkContextParamsPtr ProfileIODataQt::CreateNetworkContextParams()
+void ProfileIODataQt::ConfigureNetworkContextParams(bool in_memory,
+ const base::FilePath &relative_partition_path,
+ network::mojom::NetworkContextParams *network_context_params,
+ network::mojom::CertVerifierCreationParams *cert_verifier_creation_params)
{
setFullConfiguration();
- network::mojom::NetworkContextParamsPtr network_context_params =
- SystemNetworkContextManager::GetInstance()->CreateDefaultNetworkContextParams();
+ SystemNetworkContextManager::GetInstance()->ConfigureDefaultNetworkContextParams(network_context_params);
network_context_params->context_name = m_storageName.toStdString();
network_context_params->user_agent = m_httpUserAgent.toStdString();
@@ -233,10 +234,10 @@ network::mojom::NetworkContextParamsPtr ProfileIODataQt::CreateNetworkContextPar
network_context_params->http_cache_enabled = m_httpCacheType != ProfileAdapter::NoCache;
network_context_params->http_cache_max_size = m_httpCacheMaxSize;
- if (m_httpCacheType == ProfileAdapter::DiskHttpCache && !m_httpCachePath.isEmpty())
+ if (m_httpCacheType == ProfileAdapter::DiskHttpCache && !m_httpCachePath.isEmpty() && !m_inMemoryOnly && !in_memory)
network_context_params->http_cache_path = toFilePath(m_httpCachePath);
- if (m_persistentCookiesPolicy != ProfileAdapter::NoPersistentCookies && !m_inMemoryOnly) {
+ if (m_persistentCookiesPolicy != ProfileAdapter::NoPersistentCookies && !m_inMemoryOnly && !in_memory) {
base::FilePath cookie_path = toFilePath(m_dataPath);
cookie_path = cookie_path.AppendASCII("Cookies");
network_context_params->cookie_path = cookie_path;
@@ -244,7 +245,7 @@ network::mojom::NetworkContextParamsPtr ProfileIODataQt::CreateNetworkContextPar
network_context_params->restore_old_session_cookies = m_persistentCookiesPolicy == ProfileAdapter::ForcePersistentCookies;
network_context_params->persist_session_cookies = m_persistentCookiesPolicy != ProfileAdapter::NoPersistentCookies;
}
- if (!m_inMemoryOnly) {
+ if (!m_inMemoryOnly && !in_memory) {
network_context_params->http_server_properties_path = toFilePath(m_dataPath).AppendASCII("Network Persistent State");
network_context_params->transport_security_persister_path = toFilePath(m_dataPath);
}
@@ -253,18 +254,13 @@ network::mojom::NetworkContextParamsPtr ProfileIODataQt::CreateNetworkContextPar
network_context_params->enable_ftp_url_support = true;
#endif // !BUILDFLAG(DISABLE_FTP_SUPPORT)
-// network_context_params->enable_certificate_reporting = true;
-// network_context_params->enable_expect_ct_reporting = true;
network_context_params->enforce_chrome_ct_policy = false;
- network_context_params->primary_network_context = m_useForGlobalCertificateVerification;
// Should be initialized with existing per-profile CORS access lists.
network_context_params->cors_origin_access_list =
m_profile->GetSharedCorsOriginAccessList()->GetOriginAccessList().CreateCorsOriginAccessPatternsList();
- m_proxyConfigMonitor->AddToNetworkContextParams(network_context_params.get());
-
- return network_context_params;
+ m_proxyConfigMonitor->AddToNetworkContextParams(network_context_params);
}
// static
diff --git a/src/core/profile_io_data_qt.h b/src/core/profile_io_data_qt.h
index 00d2c392c..f2a6a7822 100644
--- a/src/core/profile_io_data_qt.h
+++ b/src/core/profile_io_data_qt.h
@@ -70,7 +70,7 @@ class BrowsingDataRemoverObserverQt : public content::BrowsingDataRemover::Obser
public:
BrowsingDataRemoverObserverQt(ProfileIODataQt *profileIOData);
- void OnBrowsingDataRemoverDone() override;
+ void OnBrowsingDataRemoverDone(uint64_t) override;
private:
ProfileIODataQt *m_profileIOData;
@@ -103,7 +103,10 @@ public:
void clearHttpCache(); // runs on ui thread
bool isClearHttpCacheInProgress() { return m_clearHttpCacheInProgress; }
- network::mojom::NetworkContextParamsPtr CreateNetworkContextParams();
+ void ConfigureNetworkContextParams(bool in_memory,
+ const base::FilePath &relative_partition_path,
+ network::mojom::NetworkContextParams *network_context_params,
+ network::mojom::CertVerifierCreationParams *cert_verifier_creation_params);
#if QT_CONFIG(ssl)
ClientCertificateStoreData *clientCertificateStoreData();
@@ -142,7 +145,6 @@ private:
QRecursiveMutex m_mutex;
#endif
int m_httpCacheMaxSize = 0;
- bool m_useForGlobalCertificateVerification = false;
BrowsingDataRemoverObserverQt m_removerObserver;
QString m_dataPath;
bool m_clearHttpCacheInProgress = false;
diff --git a/src/core/qtwebengine.gni b/src/core/qtwebengine.gni
index 9afdc0e76..11352a3e8 100644
--- a/src/core/qtwebengine.gni
+++ b/src/core/qtwebengine.gni
@@ -31,7 +31,7 @@ deps = [
"//components/spellcheck:buildflags",
"//components/proxy_config",
"//components/user_prefs",
- "//content/public/app:browser",
+ "//content/public/app",
"//content",
"//media:media_buildflags",
"//net",
diff --git a/src/core/qtwebengine_sources.gni b/src/core/qtwebengine_sources.gni
index a329da5ab..56bf51d8d 100644
--- a/src/core/qtwebengine_sources.gni
+++ b/src/core/qtwebengine_sources.gni
@@ -112,8 +112,10 @@ source_set("qtwebengine_sources") {
deps += [
":qtwebengine_extensions_features",
"//chrome/app:generated_resources",
+ "//chrome/browser/extensions/api:api_registration",
"//chrome/browser/resources:component_extension_resources_grit",
"//chrome/common/extensions/api",
+ "//chrome/common/extensions/api:api",
"//chrome/common/extensions/api:extensions_features",
"//components/crx_file",
"//components/crx_file:crx_creator",
@@ -128,8 +130,12 @@ source_set("qtwebengine_sources") {
"//extensions/renderer",
"//extensions:extensions_resources",
"//extensions/strings",
+ "//qtwebengine/browser/extensions/api:api_registration",
+ "//qtwebengine/common/extensions/api:api",
]
sources += [
+ "//chrome/browser/extensions/api/enterprise_hardware_platform/enterprise_hardware_platform_api.cc",
+ "//chrome/browser/extensions/api/enterprise_hardware_platform/enterprise_hardware_platform_api.h",
"//chrome/common/extensions/permissions/chrome_api_permissions.cc",
"//chrome/common/extensions/permissions/chrome_api_permissions.h",
"//chrome/common/extensions/permissions/chrome_permission_message_provider.cc",
@@ -192,6 +198,7 @@ source_set("qtwebengine_sources") {
deps += [
"//pdf",
"//pdf:buildflags",
+ "//pdf:pdf_ppapi",
"//components/pdf/browser:browser",
"//components/pdf/renderer:renderer",
"//components/printing/browser",
diff --git a/src/core/quota_permission_context_qt.cpp b/src/core/quota_permission_context_qt.cpp
index c7f1e856c..549414d33 100644
--- a/src/core/quota_permission_context_qt.cpp
+++ b/src/core/quota_permission_context_qt.cpp
@@ -61,7 +61,7 @@ void QuotaPermissionContextQt::RequestQuotaPermission(const StorageQuotaParams &
if (params.storage_type != blink::mojom::StorageType::kPersistent) {
// For now we only support requesting quota with this interface
// for Persistent storage type.
- std::move(callback).Run(QUOTA_PERMISSION_RESPONSE_DISALLOW);
+ dispatchCallbackOnIOThread(std::move(callback), QUOTA_PERMISSION_RESPONSE_DISALLOW);
return;
}
@@ -74,16 +74,26 @@ void QuotaPermissionContextQt::RequestQuotaPermission(const StorageQuotaParams &
}
RenderFrameHost *renderFrameHost = RenderFrameHost::FromID(render_process_id, params.render_frame_id);
- if (!renderFrameHost)
+ if (!renderFrameHost) {
+ LOG(WARNING) << "Attempt to request quota from frameless renderer: "
+ << render_process_id << "," << params.render_frame_id;
+ dispatchCallbackOnIOThread(std::move(callback), QUOTA_PERMISSION_RESPONSE_CANCELLED);
return;
+ }
WebContents *webContents = WebContents::FromRenderFrameHost(renderFrameHost);
- if (!webContents)
+ if (!webContents) {
+ LOG(ERROR) << "Attempt to request quota from frame missing webcontents";
+ dispatchCallbackOnIOThread(std::move(callback), QUOTA_PERMISSION_RESPONSE_CANCELLED);
return;
+ }
WebContentsAdapterClient *client = WebContentsViewQt::from(static_cast<content::WebContentsImpl *>(webContents)->GetView())->client();
- if (!client)
+ if (!client) {
+ LOG(ERROR) << "Attempt to request quota from content missing webcontents client";
+ dispatchCallbackOnIOThread(std::move(callback), QUOTA_PERMISSION_RESPONSE_CANCELLED);
return;
+ }
QWebEngineQuotaRequest request(
QSharedPointer<QuotaRequestControllerImpl>::create(this, params, std::move(callback)));
diff --git a/src/core/quota_permission_context_qt.h b/src/core/quota_permission_context_qt.h
index 6d678c92a..528928c1a 100644
--- a/src/core/quota_permission_context_qt.h
+++ b/src/core/quota_permission_context_qt.h
@@ -42,8 +42,6 @@
#include "content/public/browser/quota_permission_context.h"
-#include <QtCore/qcompilerdetection.h> // Needed for override
-
namespace QtWebEngineCore {
class QuotaPermissionContextQt : public content::QuotaPermissionContext {
diff --git a/src/core/quota_request_controller_impl.cpp b/src/core/quota_request_controller_impl.cpp
index 514b85954..ea2526d45 100644
--- a/src/core/quota_request_controller_impl.cpp
+++ b/src/core/quota_request_controller_impl.cpp
@@ -55,17 +55,18 @@ QuotaRequestControllerImpl::QuotaRequestControllerImpl(QuotaPermissionContextQt
QuotaRequestControllerImpl::~QuotaRequestControllerImpl()
{
- reject();
+ if (m_callback)
+ m_context->dispatchCallbackOnIOThread(std::move(m_callback), content::QuotaPermissionContext::QUOTA_PERMISSION_RESPONSE_CANCELLED);
}
void QuotaRequestControllerImpl::accepted()
{
- m_context->dispatchCallbackOnIOThread(std::move(m_callback), QuotaPermissionContextQt::QUOTA_PERMISSION_RESPONSE_ALLOW);
+ m_context->dispatchCallbackOnIOThread(std::move(m_callback), content::QuotaPermissionContext::QUOTA_PERMISSION_RESPONSE_ALLOW);
}
void QuotaRequestControllerImpl::rejected()
{
- m_context->dispatchCallbackOnIOThread(std::move(m_callback), QuotaPermissionContextQt::QUOTA_PERMISSION_RESPONSE_DISALLOW);
+ m_context->dispatchCallbackOnIOThread(std::move(m_callback), content::QuotaPermissionContext::QUOTA_PERMISSION_RESPONSE_DISALLOW);
}
} // namespace QtWebEngineCore
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index d298511ac..2846e71ef 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -57,15 +57,15 @@
#include "components/viz/common/surfaces/frame_sink_id_allocator.h"
#include "components/viz/host/host_frame_sink_manager.h"
#include "content/browser/compositor/image_transport_factory.h"
-#include "content/browser/frame_host/frame_tree.h"
-#include "content/browser/frame_host/render_frame_host_impl.h"
+#include "content/browser/renderer_host/frame_tree.h"
+#include "content/browser/renderer_host/frame_tree_node.h"
#include "content/browser/renderer_host/input/synthetic_gesture_target.h"
+#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/browser/renderer_host/render_view_host_delegate.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_input_event_router.h"
#include "content/browser/renderer_host/ui_events_helper.h"
#include "content/common/content_switches_internal.h"
-#include "content/browser/renderer_host/ui_events_helper.h"
#include "content/common/cursors/webcursor.h"
#include "content/common/input_messages.h"
#include "third_party/skia/include/core/SkColor.h"
@@ -188,6 +188,7 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost *widget
config.enable_longpress_drag_selection = false;
m_touchSelectionController.reset(new ui::TouchSelectionController(m_touchSelectionControllerClient.get(), config));
+ host()->render_frame_metadata_provider()->AddObserver(this);
host()->render_frame_metadata_provider()->ReportAllFrameSubmissionsForTesting(true);
host()->SetView(this);
@@ -242,6 +243,9 @@ void RenderWidgetHostViewQt::InitAsFullscreen(content::RenderWidgetHostView*)
void RenderWidgetHostViewQt::SetSize(const gfx::Size &sizeInDips)
{
+ if (!m_delegate)
+ return;
+
m_delegate->resize(sizeInDips.width(), sizeInDips.height());
}
@@ -582,7 +586,7 @@ void RenderWidgetHostViewQt::DisplayTooltipText(const base::string16 &tooltip_te
m_adapterClient->setToolTip(toQt(tooltip_text));
}
-void RenderWidgetHostViewQt::GetScreenInfo(content::ScreenInfo *results)
+void RenderWidgetHostViewQt::GetScreenInfo(blink::ScreenInfo *results)
{
*results = m_screenInfo;
}
@@ -598,7 +602,7 @@ void RenderWidgetHostViewQt::OnUpdateTextInputStateCalled(content::TextInputMana
Q_UNUSED(updated_view);
Q_UNUSED(did_update_state);
- const content::TextInputState *state = text_input_manager_->GetTextInputState();
+ const ui::mojom::TextInputState *state = text_input_manager_->GetTextInputState();
if (!state) {
m_delegate->inputMethodStateChanged(false /*editorVisible*/, false /*passwordInput*/);
m_delegate->setInputMethodHints(Qt::ImhNone);
@@ -613,16 +617,16 @@ void RenderWidgetHostViewQt::OnUpdateTextInputStateCalled(content::TextInputMana
#endif
QString surroundingText = toQt(state->value);
// Remove IME composition text from the surrounding text
- if (state->composition_start != -1 && state->composition_end != -1)
- surroundingText.remove(state->composition_start,
- state->composition_end - state->composition_start);
+ if (state->composition.has_value())
+ surroundingText.remove(state->composition->start(),
+ state->composition->end() - state->composition->start());
delegateClient()->setSurroundingText(surroundingText);
// In case of text selection, the update is expected in RenderWidgetHostViewQt::selectionChanged().
if (GetSelectedText().empty()) {
// At this point it is unknown whether the text input state has been updated due to a text selection.
// Keep the cursor position updated for cursor movements too.
- delegateClient()->setCursorPosition(state->selection_start);
+ delegateClient()->setCursorPosition(state->selection.start());
m_delegate->inputMethodStateChanged(type != ui::TEXT_INPUT_TYPE_NONE, type == ui::TEXT_INPUT_TYPE_PASSWORD);
}
@@ -632,7 +636,7 @@ void RenderWidgetHostViewQt::OnUpdateTextInputStateCalled(content::TextInputMana
}
// Ignore selection change triggered by ime composition unless it clears an actual text selection
- if (state->composition_start != -1 && delegateClient()->isPreviousSelectionEmpty()) {
+ if (state->composition.has_value() && delegateClient()->isPreviousSelectionEmpty()) {
m_imState = 0;
return;
}
@@ -691,16 +695,16 @@ void RenderWidgetHostViewQt::OnGestureEvent(const ui::GestureEventData& gesture)
if (m_touchSelectionController && m_touchSelectionControllerClient) {
switch (event.GetType()) {
- case blink::WebInputEvent::kGestureLongPress:
+ case blink::WebInputEvent::Type::kGestureLongPress:
m_touchSelectionController->HandleLongPressEvent(event.TimeStamp(), event.PositionInWidget());
break;
- case blink::WebInputEvent::kGestureTap:
+ case blink::WebInputEvent::Type::kGestureTap:
m_touchSelectionController->HandleTapEvent(event.PositionInWidget(), event.data.tap.tap_count);
break;
- case blink::WebInputEvent::kGestureScrollBegin:
+ case blink::WebInputEvent::Type::kGestureScrollBegin:
m_touchSelectionControllerClient->onScrollBegin();
break;
- case blink::WebInputEvent::kGestureScrollEnd:
+ case blink::WebInputEvent::Type::kGestureScrollEnd:
m_touchSelectionControllerClient->onScrollEnd();
break;
default:
@@ -726,7 +730,7 @@ viz::ScopedSurfaceIdAllocator RenderWidgetHostViewQt::DidUpdateVisualProperties(
void RenderWidgetHostViewQt::OnDidUpdateVisualPropertiesComplete(const cc::RenderFrameMetadata &metadata)
{
- synchronizeVisualProperties(metadata.local_surface_id_allocation);
+ synchronizeVisualProperties(metadata.local_surface_id);
}
void RenderWidgetHostViewQt::OnDidFirstVisuallyNonEmptyPaint()
@@ -742,17 +746,18 @@ Compositor::Id RenderWidgetHostViewQt::compositorId()
void RenderWidgetHostViewQt::notifyShown()
{
// Handle possible frame eviction:
- if (!m_dfhLocalSurfaceIdAllocator.HasValidLocalSurfaceIdAllocation())
+ if (!m_dfhLocalSurfaceIdAllocator.HasValidLocalSurfaceId())
m_dfhLocalSurfaceIdAllocator.GenerateId();
if (m_visible)
return;
m_visible = true;
- host()->WasShown(base::nullopt);
+ host()->WasShown(nullptr);
m_delegatedFrameHost->AttachToCompositor(m_uiCompositor.get());
- m_delegatedFrameHost->WasShown(GetLocalSurfaceIdAllocation().local_surface_id(),
- toGfx(delegateClient()->viewRectInDips().size()), base::nullopt);
+ m_delegatedFrameHost->WasShown(GetLocalSurfaceId(),
+ toGfx(delegateClient()->viewRectInDips().size()),
+ nullptr);
}
void RenderWidgetHostViewQt::notifyHidden()
@@ -765,10 +770,10 @@ void RenderWidgetHostViewQt::notifyHidden()
m_delegatedFrameHost->DetachFromCompositor();
}
-void RenderWidgetHostViewQt::ProcessAckedTouchEvent(const content::TouchEventWithLatencyInfo &touch, content::InputEventAckState ack_result) {
+void RenderWidgetHostViewQt::ProcessAckedTouchEvent(const content::TouchEventWithLatencyInfo &touch, blink::mojom::InputEventResultState ack_result) {
Q_UNUSED(touch);
- const bool eventConsumed = ack_result == content::INPUT_EVENT_ACK_STATE_CONSUMED;
- const bool isSetNonBlocking = content::InputEventAckStateIsSetNonBlocking(ack_result);
+ const bool eventConsumed = ack_result == blink::mojom::InputEventResultState::kConsumed;
+ const bool isSetNonBlocking = content::InputEventResultStateIsSetNonBlocking(ack_result);
m_gestureProvider.OnTouchEventAck(touch.event.unique_touch_event_id, eventConsumed, isSetNonBlocking);
}
@@ -791,7 +796,7 @@ bool RenderWidgetHostViewQt::isPopup() const
bool RenderWidgetHostViewQt::updateScreenInfo()
{
- content::ScreenInfo oldScreenInfo = m_screenInfo;
+ blink::ScreenInfo oldScreenInfo = m_screenInfo;
QScreen *screen = m_delegate->window() ? m_delegate->window()->screen() : nullptr;
if (screen) {
@@ -826,7 +831,7 @@ void RenderWidgetHostViewQt::handleWheelEvent(QWheelEvent *event)
m_pendingWheelEvents.append(WebEventFactory::toWebWheelEvent(event));
}
-void RenderWidgetHostViewQt::WheelEventAck(const blink::WebMouseWheelEvent &event, content::InputEventAckState /*ack_result*/)
+void RenderWidgetHostViewQt::WheelEventAck(const blink::WebMouseWheelEvent &event, blink::mojom::InputEventResultState /*ack_result*/)
{
if (event.phase == blink::WebMouseWheelEvent::kPhaseEnded)
return;
@@ -840,14 +845,14 @@ void RenderWidgetHostViewQt::WheelEventAck(const blink::WebMouseWheelEvent &even
}
}
-void RenderWidgetHostViewQt::GestureEventAck(const blink::WebGestureEvent &event, content::InputEventAckState ack_result)
+void RenderWidgetHostViewQt::GestureEventAck(const blink::WebGestureEvent &event, blink::mojom::InputEventResultState ack_result)
{
// Forward unhandled scroll events back as wheel events
- if (event.GetType() != blink::WebInputEvent::kGestureScrollUpdate)
+ if (event.GetType() != blink::WebInputEvent::Type::kGestureScrollUpdate)
return;
switch (ack_result) {
- case content::INPUT_EVENT_ACK_STATE_NOT_CONSUMED:
- case content::INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS:
+ case blink::mojom::InputEventResultState::kNotConsumed:
+ case blink::mojom::InputEventResultState::kNoConsumerExists:
WebEventFactory::sendUnhandledWheelEvent(event, delegate());
break;
default:
@@ -860,26 +865,13 @@ content::MouseWheelPhaseHandler *RenderWidgetHostViewQt::GetMouseWheelPhaseHandl
return &m_mouseWheelPhaseHandler;
}
-content::RenderFrameHost *RenderWidgetHostViewQt::getFocusedFrameHost()
+blink::mojom::FrameWidgetInputHandler *RenderWidgetHostViewQt::getFrameWidgetInputHandler()
{
- content::RenderViewHostImpl *viewHost = content::RenderViewHostImpl::From(host());
- if (!viewHost)
+ auto *focused_widget = GetFocusedWidget();
+ if (!focused_widget)
return nullptr;
- content::FrameTreeNode *focusedFrame = viewHost->GetDelegate()->GetFrameTree()->GetFocusedFrame();
- if (!focusedFrame)
- return nullptr;
-
- return focusedFrame->current_frame_host();
-}
-
-content::mojom::FrameInputHandler *RenderWidgetHostViewQt::getFrameInputHandler()
-{
- content::RenderFrameHostImpl *frameHost = static_cast<content::RenderFrameHostImpl *>(getFocusedFrameHost());
- if (!frameHost)
- return nullptr;
-
- return frameHost->GetFrameInputHandler();
+ return focused_widget->GetFrameWidgetInputHandler();
}
ui::TextInputType RenderWidgetHostViewQt::getTextInputType() const
@@ -900,9 +892,9 @@ const viz::FrameSinkId &RenderWidgetHostViewQt::GetFrameSinkId() const
return m_delegatedFrameHost->frame_sink_id();
}
-const viz::LocalSurfaceIdAllocation &RenderWidgetHostViewQt::GetLocalSurfaceIdAllocation() const
+const viz::LocalSurfaceId &RenderWidgetHostViewQt::GetLocalSurfaceId() const
{
- return m_dfhLocalSurfaceIdAllocator.GetCurrentLocalSurfaceIdAllocation();
+ return m_dfhLocalSurfaceIdAllocator.GetCurrentLocalSurfaceId();
}
void RenderWidgetHostViewQt::TakeFallbackContentFrom(content::RenderWidgetHostView *view)
@@ -932,8 +924,6 @@ void RenderWidgetHostViewQt::ResetFallbackToFirstNavigationSurface()
void RenderWidgetHostViewQt::OnRenderFrameMetadataChangedAfterActivation()
{
- content::RenderWidgetHostViewBase::OnRenderFrameMetadataChangedAfterActivation();
-
const cc::RenderFrameMetadata &metadata = host()->render_frame_metadata_provider()->LastRenderFrameMetadata();
if (metadata.selection.start != m_selectionStart || metadata.selection.end != m_selectionEnd) {
m_selectionStart = metadata.selection.start;
@@ -951,7 +941,7 @@ void RenderWidgetHostViewQt::OnRenderFrameMetadataChangedAfterActivation()
m_adapterClient->updateContentsSize(toQt(m_lastContentsSize));
}
-void RenderWidgetHostViewQt::synchronizeVisualProperties(const base::Optional<viz::LocalSurfaceIdAllocation> &childSurfaceId)
+void RenderWidgetHostViewQt::synchronizeVisualProperties(const base::Optional<viz::LocalSurfaceId> &childSurfaceId)
{
if (childSurfaceId)
m_dfhLocalSurfaceIdAllocator.UpdateFromChild(*childSurfaceId);
@@ -965,9 +955,9 @@ void RenderWidgetHostViewQt::synchronizeVisualProperties(const base::Optional<vi
m_uiCompositor->SetScaleAndSize(
m_screenInfo.device_scale_factor,
viewSizeInPixels,
- m_uiCompositorLocalSurfaceIdAllocator.GetCurrentLocalSurfaceIdAllocation());
+ m_uiCompositorLocalSurfaceIdAllocator.GetCurrentLocalSurfaceId());
m_delegatedFrameHost->EmbedSurface(
- m_dfhLocalSurfaceIdAllocator.GetCurrentLocalSurfaceIdAllocation().local_surface_id(),
+ m_dfhLocalSurfaceIdAllocator.GetCurrentLocalSurfaceId(),
viewSizeInDips,
cc::DeadlinePolicy::UseDefaultDeadline());
diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h
index 2bc90a558..fed831551 100644
--- a/src/core/render_widget_host_view_qt.h
+++ b/src/core/render_widget_host_view_qt.h
@@ -59,9 +59,6 @@ QT_FORWARD_DECLARE_CLASS(QAccessibleInterface)
namespace content {
class RenderFrameHost;
class RenderWidgetHostImpl;
-namespace mojom {
-class FrameInputHandler;
-}
}
namespace ui {
@@ -79,6 +76,7 @@ class RenderWidgetHostViewQt
, public ui::GestureProviderClient
, public base::SupportsWeakPtr<RenderWidgetHostViewQt>
, public content::TextInputManager::Observer
+ , public content::RenderFrameMetadataProvider::Observer
{
public:
RenderWidgetHostViewQt(content::RenderWidgetHost* widget);
@@ -121,18 +119,22 @@ public:
void Destroy() override;
void SetTooltipText(const base::string16 &tooltip_text) override;
void DisplayTooltipText(const base::string16& tooltip_text) override;
- void WheelEventAck(const blink::WebMouseWheelEvent &event, content::InputEventAckState ack_result) override;
- void GestureEventAck(const blink::WebGestureEvent &event, content::InputEventAckState ack_result) override;
+ void WheelEventAck(const blink::WebMouseWheelEvent &event,
+ blink::mojom::InputEventResultState ack_result) override;
+ void GestureEventAck(const blink::WebGestureEvent &event,
+ blink::mojom::InputEventResultState ack_result) override;
content::MouseWheelPhaseHandler *GetMouseWheelPhaseHandler() override;
viz::ScopedSurfaceIdAllocator DidUpdateVisualProperties(const cc::RenderFrameMetadata &metadata) override;
void OnDidUpdateVisualPropertiesComplete(const cc::RenderFrameMetadata &metadata);
- void GetScreenInfo(content::ScreenInfo *results) override;
+ void GetScreenInfo(blink::ScreenInfo *results) override;
gfx::Rect GetBoundsInRootWindow() override;
- void ProcessAckedTouchEvent(const content::TouchEventWithLatencyInfo &touch, content::InputEventAckState ack_result) override;
+ void ProcessAckedTouchEvent(const content::TouchEventWithLatencyInfo &touch,
+ blink::mojom::InputEventResultState ack_result) override;
viz::SurfaceId GetCurrentSurfaceId() const override;
const viz::FrameSinkId &GetFrameSinkId() const override;
- const viz::LocalSurfaceIdAllocation &GetLocalSurfaceIdAllocation() const override;
+ const viz::LocalSurfaceId &GetLocalSurfaceId() const;
+
void TakeFallbackContentFrom(content::RenderWidgetHostView *view) override;
void EnsureSurfaceSynchronizedForWebTest() override;
uint32_t GetCaptureSequenceNumber() const override;
@@ -140,11 +142,12 @@ public:
void DidStopFlinging() override;
std::unique_ptr<content::SyntheticGestureTarget> CreateSyntheticGestureTarget() override;
ui::Compositor *GetCompositor() override;
-#if defined(OS_MACOSX)
+#if defined(OS_MAC)
void SetActive(bool active) override { QT_NOT_YET_IMPLEMENTED }
void SpeakSelection() override { QT_NOT_YET_IMPLEMENTED }
void ShowDefinitionForSelection() override { QT_NOT_YET_IMPLEMENTED }
-#endif // defined(OS_MACOSX)
+ void SetWindowFrameInScreen(const gfx::Rect&) override { QT_NOT_YET_IMPLEMENTED }
+#endif // defined(OS_MAC)
// Overridden from ui::GestureProviderClient.
void OnGestureEvent(const ui::GestureEventData& gesture) override;
@@ -159,6 +162,9 @@ public:
// Overridden from content::RenderFrameMetadataProvider::Observer
void OnRenderFrameMetadataChangedAfterActivation() override;
+ void OnRenderFrameMetadataChangedBeforeActivation(const cc::RenderFrameMetadata &) override {}
+ void OnRenderFrameSubmission() override {}
+ void OnLocalSurfaceIdChanged(const cc::RenderFrameMetadata &) override {}
// Called from RenderWidgetHostViewQtDelegateClient.
Compositor::Id compositorId();
@@ -176,20 +182,18 @@ public:
gfx::SizeF lastContentsSize() const { return m_lastContentsSize; }
gfx::Vector2dF lastScrollOffset() const { return m_lastScrollOffset; }
- ui::TextInputType getTextInputType() const;
- content::mojom::FrameInputHandler *getFrameInputHandler();
-
ui::TouchSelectionController *getTouchSelectionController() const { return m_touchSelectionController.get(); }
TouchSelectionControllerClientQt *getTouchSelectionControllerClient() const { return m_touchSelectionControllerClient.get(); }
+ blink::mojom::FrameWidgetInputHandler *getFrameWidgetInputHandler();
+ ui::TextInputType getTextInputType() const;
void synchronizeVisualProperties(
- const base::Optional<viz::LocalSurfaceIdAllocation> &childSurfaceId);
+ const base::Optional<viz::LocalSurfaceId> &childSurfaceId);
private:
friend class DelegatedFrameHostClientQt;
bool isPopup() const;
- content::RenderFrameHost *getFocusedFrameHost();
scoped_refptr<base::SingleThreadTaskRunner> m_taskRunner;
ui::FilteredGestureProvider m_gestureProvider;
@@ -207,7 +211,7 @@ private:
DelegatedFrameHostClientQt m_delegatedFrameHostClient { this };
// VIZ
- content::ScreenInfo m_screenInfo;
+ blink::ScreenInfo m_screenInfo;
std::unique_ptr<content::DelegatedFrameHost> m_delegatedFrameHost;
std::unique_ptr<ui::Layer> m_rootLayer;
std::unique_ptr<ui::Compositor> m_uiCompositor;
diff --git a/src/core/render_widget_host_view_qt_delegate_client.cpp b/src/core/render_widget_host_view_qt_delegate_client.cpp
index f4933d560..ef2d8ba25 100644
--- a/src/core/render_widget_host_view_qt_delegate_client.cpp
+++ b/src/core/render_widget_host_view_qt_delegate_client.cpp
@@ -428,8 +428,8 @@ void RenderWidgetHostViewQtDelegateClient::handlePointerEvent(T *event)
// Currently WebMouseEvent is a subclass of WebPointerProperties, so basically
// tablet events are mouse events with extra properties.
blink::WebMouseEvent webEvent = WebEventFactory::toWebMouseEvent(event);
- if ((webEvent.GetType() == blink::WebInputEvent::kMouseDown
- || webEvent.GetType() == blink::WebInputEvent::kMouseUp)
+ if ((webEvent.GetType() == blink::WebInputEvent::Type::kMouseDown
+ || webEvent.GetType() == blink::WebInputEvent::Type::kMouseUp)
&& webEvent.button == blink::WebMouseEvent::Button::kNoButton) {
// Blink can only handle the 5 main mouse-buttons and may assert when processing mouse-down
// for no button.
@@ -437,7 +437,7 @@ void RenderWidgetHostViewQtDelegateClient::handlePointerEvent(T *event)
return;
}
- if (webEvent.GetType() == blink::WebInputEvent::kMouseDown) {
+ if (webEvent.GetType() == blink::WebInputEvent::Type::kMouseDown) {
if (event->button() != m_clickHelper.lastPressButton
|| (event->timestamp() - m_clickHelper.lastPressTimestamp
> static_cast<ulong>(qGuiApp->styleHints()->mouseDoubleClickInterval()))
@@ -452,7 +452,7 @@ void RenderWidgetHostViewQtDelegateClient::handlePointerEvent(T *event)
m_clickHelper.lastPressPosition = event->position().toPoint();
}
- if (webEvent.GetType() == blink::WebInputEvent::kMouseUp)
+ if (webEvent.GetType() == blink::WebInputEvent::Type::kMouseUp)
webEvent.click_count = m_clickHelper.clickCounter;
webEvent.movement_x = event->globalPosition().x() - m_previousMousePosition.x();
@@ -463,7 +463,7 @@ void RenderWidgetHostViewQtDelegateClient::handlePointerEvent(T *event)
else
m_previousMousePosition = event->globalPosition().toPoint();
- if (m_imeInProgress && webEvent.GetType() == blink::WebInputEvent::kMouseDown) {
+ if (m_imeInProgress && webEvent.GetType() == blink::WebInputEvent::Type::kMouseDown) {
m_imeInProgress = false;
// Tell input method to commit the pre-edit string entered so far, and finish the
// composition operation.
@@ -529,18 +529,18 @@ void RenderWidgetHostViewQtDelegateClient::handleKeyEvent(QKeyEvent *event)
return;
content::NativeWebKeyboardEvent webEvent = WebEventFactory::toWebKeyboardEvent(event);
- if (webEvent.GetType() == blink::WebInputEvent::kRawKeyDown && !m_editCommand.empty()) {
+ if (webEvent.GetType() == blink::WebInputEvent::Type::kRawKeyDown && !m_editCommand.empty()) {
ui::LatencyInfo latency;
latency.set_source_event_type(ui::SourceEventType::KEY_PRESS);
- content::EditCommands commands;
- commands.emplace_back(m_editCommand, "");
+ std::vector<blink::mojom::EditCommandPtr> commands;
+ commands.emplace_back(blink::mojom::EditCommand::New(m_editCommand, ""));
m_editCommand.clear();
- m_rwhv->host()->ForwardKeyboardEventWithCommands(webEvent, latency, &commands, nullptr);
+ m_rwhv->host()->ForwardKeyboardEventWithCommands(webEvent, latency, std::move(commands), nullptr);
return;
}
bool keyDownTextInsertion =
- webEvent.GetType() == blink::WebInputEvent::kRawKeyDown && webEvent.text[0];
+ webEvent.GetType() == blink::WebInputEvent::Type::kRawKeyDown && webEvent.text[0];
webEvent.skip_in_browser = keyDownTextInsertion;
m_rwhv->host()->ForwardKeyboardEvent(webEvent);
@@ -549,7 +549,7 @@ void RenderWidgetHostViewQtDelegateClient::handleKeyEvent(QKeyEvent *event)
// The RawKeyDown is skipped on the way back (see above).
// The same os_event will be set on both NativeWebKeyboardEvents.
webEvent.skip_in_browser = false;
- webEvent.SetType(blink::WebInputEvent::kChar);
+ webEvent.SetType(blink::WebInputEvent::Type::kChar);
m_rwhv->host()->ForwardKeyboardEvent(webEvent);
}
}
@@ -843,10 +843,8 @@ void RenderWidgetHostViewQtDelegateClient::handleInputMethodEvent(QInputMethodEv
}
if (hasSelection) {
- content::mojom::FrameInputHandler *frameInputHandler = m_rwhv->getFrameInputHandler();
- if (frameInputHandler)
- frameInputHandler->SetEditableSelectionOffsets(selectionRange.start(),
- selectionRange.end());
+ if (auto *frameWidgetInputHandler = m_rwhv->getFrameWidgetInputHandler())
+ frameWidgetInputHandler->SetEditableSelectionOffsets(selectionRange.start(), selectionRange.end());
}
int replacementLength = event->replacementLength();
@@ -951,7 +949,7 @@ void RenderWidgetHostViewQtDelegateClient::selectionChanged()
// position if the selection is cleared because TextInputState changes before the
// TextSelection change.
Q_ASSERT(text_input_manager->GetTextInputState());
- m_cursorPosition = text_input_manager->GetTextInputState()->selection_start;
+ m_cursorPosition = text_input_manager->GetTextInputState()->selection.start();
m_rwhv->delegate()->inputMethodStateChanged(true /*editorVisible*/,
type == ui::TEXT_INPUT_TYPE_PASSWORD);
diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp
index 154cb36b4..0cff31ff5 100644
--- a/src/core/renderer/content_renderer_client_qt.cpp
+++ b/src/core/renderer/content_renderer_client_qt.cpp
@@ -50,7 +50,6 @@
#include "components/cdm/renderer/external_clear_key_key_system_properties.h"
#include "components/cdm/renderer/widevine_key_system_properties.h"
#include "components/error_page/common/error.h"
-#include "components/error_page/common/error_page_params.h"
#include "components/error_page/common/localized_error.h"
#include "components/network_hints/renderer/web_prescient_networking_impl.h"
#if QT_CONFIG(webengine_printing_and_pdf)
@@ -72,10 +71,8 @@
#include "third_party/blink/public/platform/web_url_error.h"
#include "third_party/blink/public/platform/web_url_request.h"
#include "third_party/blink/public/web/web_security_policy.h"
-#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/webui/jstemplate_builder.h"
-#include "content/public/common/web_preferences.h"
#if QT_CONFIG(webengine_printing_and_pdf)
#include "renderer/print_web_view_helper_delegate_qt.h"
@@ -103,7 +100,6 @@
#include "services/service_manager/public/cpp/binder_registry.h"
#include "services/service_manager/public/cpp/connector.h"
-#include "services/service_manager/public/cpp/service_binding.h"
#include "components/grit/components_resources.h"
@@ -148,7 +144,7 @@ void ContentRendererClientQt::RenderThreadStarted()
// Allow XMLHttpRequests from qrc to file.
// ### consider removing for Qt6
- blink::WebURL qrc(blink::KURL("qrc:"));
+ blink::WebURL qrc(GURL("qrc:"));
blink::WebString file(blink::WebString::FromASCII("file"));
blink::WebSecurityPolicy::AddOriginAccessAllowListEntry(
qrc, file, blink::WebString(), 0, network::mojom::CorsDomainMatchMode::kAllowSubdomains,
@@ -157,7 +153,7 @@ void ContentRendererClientQt::RenderThreadStarted()
#if BUILDFLAG(ENABLE_EXTENSIONS)
// Allow the pdf viewer extension to access chrome resources
- blink::WebURL pdfViewerExtension(blink::KURL("chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai"));
+ blink::WebURL pdfViewerExtension(GURL("chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai"));
blink::WebString chromeResources(blink::WebString::FromASCII("chrome"));
blink::WebSecurityPolicy::AddOriginAccessAllowListEntry(
pdfViewerExtension, chromeResources, blink::WebString(), 0,
@@ -256,11 +252,6 @@ bool ContentRendererClientQt::HasErrorPage(int httpStatusCode)
return true;
}
-bool ContentRendererClientQt::ShouldSuppressErrorPage(content::RenderFrame *frame, const GURL &)
-{
- return !(frame->GetWebkitPreferences().enable_error_page);
-}
-
// To tap into the chromium localized strings. Ripped from the chrome layer (highly simplified).
void ContentRendererClientQt::PrepareErrorPage(content::RenderFrame *renderFrame,
const blink::WebURLError &web_error,
@@ -304,8 +295,7 @@ void ContentRendererClientQt::GetNavigationErrorStringsInternal(content::RenderF
error_page::LocalizedError::GetPageState(
error.reason(), error.domain(), error.url(), isPost, false,
error.stale_copy_in_cache(), false,
- RenderConfiguration::is_incognito_process(), false, false, false, locale,
- std::unique_ptr<error_page::ErrorPageParams>());
+ RenderConfiguration::is_incognito_process(), false, false, false, locale);
resourceId = IDR_NET_ERROR_HTML;
@@ -376,26 +366,6 @@ blink::WebPlugin* ContentRendererClientQt::CreatePlugin(content::RenderFrame* re
}
#endif //BUILDFLAG(ENABLE_PLUGINS)
-content::BrowserPluginDelegate *ContentRendererClientQt::CreateBrowserPluginDelegate(content::RenderFrame *render_frame,
- const content::WebPluginInfo &info,
- const std::string &mime_type,
- const GURL &original_url)
-{
-#if BUILDFLAG(ENABLE_EXTENSIONS)
- return ExtensionsRendererClientQt::GetInstance()->CreateBrowserPluginDelegate(render_frame, info, mime_type,
- original_url);
-#else
- return nullptr;
-#endif
-}
-
-void ContentRendererClientQt::BindReceiverOnMainThread(mojo::GenericPendingReceiver receiver)
-{
- std::string interface_name = *receiver.interface_name();
- auto pipe = receiver.PassPipe();
- m_registry.TryBindInterface(interface_name, &pipe);
-}
-
void ContentRendererClientQt::GetInterface(const std::string &interface_name, mojo::ScopedMessagePipeHandle interface_pipe)
{
content::RenderThread::Get()->BindHostReceiver(mojo::GenericPendingReceiver(interface_name, std::move(interface_pipe)));
diff --git a/src/core/renderer/content_renderer_client_qt.h b/src/core/renderer/content_renderer_client_qt.h
index 91bce972f..82d8af514 100644
--- a/src/core/renderer/content_renderer_client_qt.h
+++ b/src/core/renderer/content_renderer_client_qt.h
@@ -89,7 +89,6 @@ public:
void RenderThreadStarted() override;
void ExposeInterfacesToBrowser(mojo::BinderMap* binders) override;
void RenderFrameCreated(content::RenderFrame *render_frame) override;
- bool ShouldSuppressErrorPage(content::RenderFrame *, const GURL &) override;
bool HasErrorPage(int http_status_code) override;
void PrepareErrorPage(content::RenderFrame *render_frame,
@@ -114,10 +113,6 @@ public:
const blink::WebPluginParams &params,
blink::WebPlugin **plugin) override;
bool IsOriginIsolatedPepperPlugin(const base::FilePath& plugin_path) override;
- content::BrowserPluginDelegate *CreateBrowserPluginDelegate(content::RenderFrame *render_frame,
- const content::WebPluginInfo &info,
- const std::string &mime_type,
- const GURL &original_url) override;
void WillSendRequest(blink::WebLocalFrame *frame,
ui::PageTransition transition_type,
@@ -127,7 +122,6 @@ public:
GURL *new_url,
bool *attach_same_site_cookies) override;
- void BindReceiverOnMainThread(mojo::GenericPendingReceiver receiver) override;
bool RequiresWebComponentsV0(const GURL &url) override;
#if BUILDFLAG(ENABLE_PLUGINS)
@@ -154,8 +148,6 @@ private:
QScopedPointer<SpellCheck> m_spellCheck;
#endif
- service_manager::BinderRegistry m_registry;
-
DISALLOW_COPY_AND_ASSIGN(ContentRendererClientQt);
};
diff --git a/src/core/renderer/content_settings_observer_qt.cpp b/src/core/renderer/content_settings_observer_qt.cpp
index df9b77037..18d52b50a 100644
--- a/src/core/renderer/content_settings_observer_qt.cpp
+++ b/src/core/renderer/content_settings_observer_qt.cpp
@@ -82,21 +82,20 @@ bool ContentSettingsObserverQt::OnMessageReceived(const IPC::Message &message)
{
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(ContentSettingsObserverQt, message)
- IPC_MESSAGE_HANDLER(QtWebEngineMsg_RequestFileSystemAccessAsyncResponse, OnRequestFileSystemAccessAsyncResponse)
+ IPC_MESSAGE_HANDLER(QtWebEngineMsg_RequestStorageAccessAsyncResponse, OnRequestStorageAccessAsyncResponse)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
-void ContentSettingsObserverQt::DidCommitProvisionalLoad(bool is_same_document_navigation, ui::PageTransition /*transition*/)
+void ContentSettingsObserverQt::DidCommitProvisionalLoad(ui::PageTransition /*transition*/)
{
blink::WebLocalFrame *frame = render_frame()->GetWebFrame();
if (frame->Parent())
return; // Not a top-level navigation.
- if (!is_same_document_navigation)
- ClearBlockedContentSettings();
+ ClearBlockedContentSettings();
GURL url = frame->GetDocument().Url();
// If we start failing this DCHECK, please makes sure we don't regress
@@ -109,68 +108,51 @@ void ContentSettingsObserverQt::OnDestruct()
delete this;
}
-bool ContentSettingsObserverQt::AllowDatabase()
-{
- blink::WebFrame *frame = render_frame()->GetWebFrame();
- if (IsUniqueFrame(frame))
- return false;
-
- bool result = false;
- Send(new QtWebEngineHostMsg_AllowDatabase(routing_id(), url::Origin(frame->GetSecurityOrigin()).GetURL(),
- url::Origin(frame->Top()->GetSecurityOrigin()).GetURL(), &result));
- return result;
-}
-
-void ContentSettingsObserverQt::RequestFileSystemAccessAsync(base::OnceCallback<void(bool)> callback)
+void ContentSettingsObserverQt::AllowStorageAccess(StorageType storage_type,
+ base::OnceCallback<void(bool)> callback)
{
blink::WebFrame *frame = render_frame()->GetWebFrame();
if (IsUniqueFrame(frame)) {
std::move(callback).Run(false);
return;
}
+
++m_currentRequestId;
bool inserted = m_permissionRequests.insert(std::make_pair(m_currentRequestId, std::move(callback))).second;
// Verify there are no duplicate insertions.
DCHECK(inserted);
- Send(new QtWebEngineHostMsg_RequestFileSystemAccessAsync(routing_id(), m_currentRequestId,
- url::Origin(frame->GetSecurityOrigin()).GetURL(),
- url::Origin(frame->Top()->GetSecurityOrigin()).GetURL()));
+ Send(new QtWebEngineHostMsg_RequestStorageAccessAsync(routing_id(), m_currentRequestId,
+ url::Origin(frame->GetSecurityOrigin()).GetURL(),
+ url::Origin(frame->Top()->GetSecurityOrigin()).GetURL(),
+ int(storage_type)));
}
-bool ContentSettingsObserverQt::AllowIndexedDB()
-{
- blink::WebFrame *frame = render_frame()->GetWebFrame();
- if (IsUniqueFrame(frame))
- return false;
-
- bool result = false;
- Send(new QtWebEngineHostMsg_AllowIndexedDB(routing_id(),
- url::Origin(frame->GetSecurityOrigin()).GetURL(),
- url::Origin(frame->Top()->GetSecurityOrigin()).GetURL(), &result));
- return result;
-}
-
-bool ContentSettingsObserverQt::AllowStorage(bool local)
+bool ContentSettingsObserverQt::AllowStorageAccessSync(StorageType storage_type)
{
blink::WebLocalFrame *frame = render_frame()->GetWebFrame();
if (IsUniqueFrame(frame))
return false;
- StoragePermissionsKey key(url::Origin(frame->GetDocument().GetSecurityOrigin()).GetURL(), local);
- const auto permissions = m_cachedStoragePermissions.find(key);
- if (permissions != m_cachedStoragePermissions.end())
- return permissions->second;
+ bool sameOrigin = url::Origin(frame->Top()->GetSecurityOrigin()).IsSameOriginWith(url::Origin(frame->GetSecurityOrigin()));
+ StoragePermissionsKey key(url::Origin(frame->GetSecurityOrigin()).GetURL(), int(storage_type));
+ if (sameOrigin) {
+ const auto permissions = m_cachedStoragePermissions.find(key);
+ if (permissions != m_cachedStoragePermissions.end())
+ return permissions->second;
+ }
bool result = false;
- Send(new QtWebEngineHostMsg_AllowDOMStorage(routing_id(), url::Origin(frame->GetSecurityOrigin()).GetURL(),
- url::Origin(frame->Top()->GetSecurityOrigin()).GetURL(), local, &result));
- m_cachedStoragePermissions[key] = result;
+ Send(new QtWebEngineHostMsg_AllowStorageAccess(routing_id(), url::Origin(frame->GetSecurityOrigin()).GetURL(),
+ url::Origin(frame->Top()->GetSecurityOrigin()).GetURL(),
+ int(storage_type), &result));
+ if (sameOrigin)
+ m_cachedStoragePermissions[key] = result;
return result;
}
-void ContentSettingsObserverQt::OnRequestFileSystemAccessAsyncResponse(int request_id, bool allowed)
+void ContentSettingsObserverQt::OnRequestStorageAccessAsyncResponse(int request_id, bool allowed)
{
auto it = m_permissionRequests.find(request_id);
if (it == m_permissionRequests.end())
diff --git a/src/core/renderer/content_settings_observer_qt.h b/src/core/renderer/content_settings_observer_qt.h
index 0c69d289c..9268b4982 100644
--- a/src/core/renderer/content_settings_observer_qt.h
+++ b/src/core/renderer/content_settings_observer_qt.h
@@ -67,25 +67,24 @@ public:
~ContentSettingsObserverQt() override;
// blink::WebContentSettingsClient:
- bool AllowDatabase() override;
- void RequestFileSystemAccessAsync(base::OnceCallback<void(bool)> callback) override;
- bool AllowIndexedDB() override;
- bool AllowStorage(bool local) override;
+ void AllowStorageAccess(StorageType storage_type,
+ base::OnceCallback<void(bool)> callback) override;
+ bool AllowStorageAccessSync(StorageType storage_type) override;
private:
// RenderFrameObserver implementation:
bool OnMessageReceived(const IPC::Message &message) override;
- void DidCommitProvisionalLoad(bool is_same_document_navigation, ui::PageTransition transition) override;
+ void DidCommitProvisionalLoad(ui::PageTransition transition) override;
void OnDestruct() override;
// Message handlers.
- void OnRequestFileSystemAccessAsyncResponse(int request_id, bool allowed);
+ void OnRequestStorageAccessAsyncResponse(int request_id, bool allowed);
// Clears m_cachedStoragePermissions
void ClearBlockedContentSettings();
// Caches the result of AllowStorage.
- using StoragePermissionsKey = std::pair<GURL, bool>;
+ using StoragePermissionsKey = std::pair<GURL, int>;
base::flat_map<StoragePermissionsKey, bool> m_cachedStoragePermissions;
int m_currentRequestId;
diff --git a/src/core/renderer/extensions/extensions_dispatcher_delegate_qt.cpp b/src/core/renderer/extensions/extensions_dispatcher_delegate_qt.cpp
index 418429330..d49845f55 100644
--- a/src/core/renderer/extensions/extensions_dispatcher_delegate_qt.cpp
+++ b/src/core/renderer/extensions/extensions_dispatcher_delegate_qt.cpp
@@ -39,6 +39,9 @@
#include "extensions_dispatcher_delegate_qt.h"
+#include "chrome/grit/renderer_resources.h"
+#include "extensions/renderer/resource_bundle_source_map.h"
+
namespace QtWebEngineCore {
ExtensionsDispatcherDelegateQt::ExtensionsDispatcherDelegateQt()
@@ -49,4 +52,10 @@ ExtensionsDispatcherDelegateQt::~ExtensionsDispatcherDelegateQt()
{
}
+void ExtensionsDispatcherDelegateQt::PopulateSourceMap(extensions::ResourceBundleSourceMap *source_map)
+{
+ // Custom binding for hangout services extension.
+ source_map->RegisterSource("webrtcDesktopCapturePrivate", IDR_WEBRTC_DESKTOP_CAPTURE_PRIVATE_CUSTOM_BINDINGS_JS);
+}
+
} //namespace QtWebEngineCore
diff --git a/src/core/renderer/extensions/extensions_dispatcher_delegate_qt.h b/src/core/renderer/extensions/extensions_dispatcher_delegate_qt.h
index 25aa18e71..1a19bcbbb 100644
--- a/src/core/renderer/extensions/extensions_dispatcher_delegate_qt.h
+++ b/src/core/renderer/extensions/extensions_dispatcher_delegate_qt.h
@@ -52,6 +52,9 @@ public:
~ExtensionsDispatcherDelegateQt() override;
private:
+ // extensions::DispatcherDelegate implementation.
+ void PopulateSourceMap(extensions::ResourceBundleSourceMap *source_map) override;
+
DISALLOW_COPY_AND_ASSIGN(ExtensionsDispatcherDelegateQt);
};
diff --git a/src/core/renderer/extensions/extensions_renderer_client_qt.cpp b/src/core/renderer/extensions/extensions_renderer_client_qt.cpp
index fd928df12..f72113018 100644
--- a/src/core/renderer/extensions/extensions_renderer_client_qt.cpp
+++ b/src/core/renderer/extensions/extensions_renderer_client_qt.cpp
@@ -147,8 +147,6 @@ bool ExtensionsRendererClientQt::ExtensionAPIEnabledForServiceWorkerScript(const
void ExtensionsRendererClientQt::RenderThreadStarted()
{
content::RenderThread *thread = content::RenderThread::Get();
- // ChromeRenderViewTest::SetUp() creates its own ExtensionDispatcher and
- // injects it using SetExtensionDispatcher(). Don't overwrite it.
if (!extension_dispatcher_)
extension_dispatcher_.reset(new extensions::Dispatcher(std::make_unique<ExtensionsDispatcherDelegateQt>()));
extension_dispatcher_->OnRenderThreadStarted(thread);
@@ -200,16 +198,6 @@ bool ExtensionsRendererClientQt::ShouldFork(blink::WebLocalFrame *frame,
return false; // TODO: Fix this to a sensible value
}
-content::BrowserPluginDelegate *ExtensionsRendererClientQt::CreateBrowserPluginDelegate(content::RenderFrame *render_frame,
- const content::WebPluginInfo &info,
- const std::string &mime_type,
- const GURL &original_url)
-{
- if (mime_type == content::kBrowserPluginMimeType)
- return new extensions::ExtensionsGuestViewContainer(render_frame);
- return new extensions::MimeHandlerViewContainer(render_frame, info, mime_type, original_url);
-}
-
void ExtensionsRendererClientQt::RunScriptsAtDocumentStart(content::RenderFrame *render_frame)
{
extension_dispatcher_->RunScriptsAtDocumentStart(render_frame);
diff --git a/src/core/renderer/extensions/extensions_renderer_client_qt.h b/src/core/renderer/extensions/extensions_renderer_client_qt.h
index 87e324213..85cc7bf2d 100644
--- a/src/core/renderer/extensions/extensions_renderer_client_qt.h
+++ b/src/core/renderer/extensions/extensions_renderer_client_qt.h
@@ -108,10 +108,6 @@ public:
bool is_initial_navigation,
bool is_server_redirect,
bool *send_referrer);
- static content::BrowserPluginDelegate *CreateBrowserPluginDelegate(content::RenderFrame *render_frame,
- const content::WebPluginInfo &info,
- const std::string &mime_type,
- const GURL &original_url);
bool ExtensionAPIEnabledForServiceWorkerScript(const GURL &scope, const GURL &script_url) const override;
diff --git a/src/core/renderer/render_frame_observer_qt.cpp b/src/core/renderer/render_frame_observer_qt.cpp
index cc01acec6..fd900c292 100644
--- a/src/core/renderer/render_frame_observer_qt.cpp
+++ b/src/core/renderer/render_frame_observer_qt.cpp
@@ -77,7 +77,7 @@ void RenderFrameObserverQt::DidCreatePepperPlugin(content::RendererPpapiHost *ho
}
#endif
-void RenderFrameObserverQt::FrameDetached()
+void RenderFrameObserverQt::WillDetach()
{
m_isFrameDetached = true;
}
diff --git a/src/core/renderer/render_frame_observer_qt.h b/src/core/renderer/render_frame_observer_qt.h
index 6bdf4ad23..237185f8c 100644
--- a/src/core/renderer/render_frame_observer_qt.h
+++ b/src/core/renderer/render_frame_observer_qt.h
@@ -68,7 +68,7 @@ public:
void DidCreatePepperPlugin(content::RendererPpapiHost *host) override;
#endif
void OnDestruct() override;
- void FrameDetached() override;
+ void WillDetach() override;
bool isFrameDetached() const;
diff --git a/src/core/renderer/user_resource_controller.cpp b/src/core/renderer/user_resource_controller.cpp
index e17498302..af1f234ac 100644
--- a/src/core/renderer/user_resource_controller.cpp
+++ b/src/core/renderer/user_resource_controller.cpp
@@ -150,10 +150,10 @@ public:
private:
// RenderFrameObserver implementation.
- void DidCommitProvisionalLoad(bool is_same_document_navigation, ui::PageTransition transition) override;
+ void DidCommitProvisionalLoad(ui::PageTransition transition) override;
void DidFinishDocumentLoad() override;
void DidFinishLoad() override;
- void FrameDetached() override;
+ void WillDetach() override;
void OnDestruct() override;
void AddScript(const QtWebEngineCore::UserScriptData &data) override;
void RemoveScript(const QtWebEngineCore::UserScriptData &data) override;
@@ -198,7 +198,7 @@ void UserResourceController::runScripts(QtWebEngineCore::UserScriptData::Injecti
return;
const bool isMainFrame = renderFrame->IsMainFrame();
- QList<uint64_t> scriptsToRun = m_frameUserScriptMap.value(0).values();
+ QList<uint64_t> scriptsToRun = m_frameUserScriptMap.value(globalScriptsIndex).values();
scriptsToRun.append(m_frameUserScriptMap.value(renderFrame).values());
for (uint64_t id : qAsConst(scriptsToRun)) {
@@ -239,12 +239,8 @@ void UserResourceController::RenderFrameObserverHelper::BindReceiver(
m_binding.Bind(std::move(receiver));
}
-void UserResourceController::RenderFrameObserverHelper::DidCommitProvisionalLoad(bool is_same_document_navigation,
- ui::PageTransition /*transitionbool*/)
+void UserResourceController::RenderFrameObserverHelper::DidCommitProvisionalLoad(ui::PageTransition /*transition*/)
{
- if (is_same_document_navigation)
- return;
-
// We are almost ready to run scripts. We still have to wait until the host
// process has been notified of the DidCommitProvisionalLoad event to ensure
// that the WebChannelTransportHost is ready to receive messages.
@@ -278,7 +274,7 @@ void UserResourceController::RenderFrameObserverHelper::DidFinishLoad()
QtWebEngineCore::UserScriptData::AfterLoad));
}
-void UserResourceController::RenderFrameObserverHelper::FrameDetached()
+void UserResourceController::RenderFrameObserverHelper::WillDetach()
{
m_runner.reset();
}
diff --git a/src/core/renderer_host/pepper/pepper_flash_browser_host_qt.cpp b/src/core/renderer_host/pepper/pepper_flash_browser_host_qt.cpp
index d54a9cdf2..af547fcf2 100644
--- a/src/core/renderer_host/pepper/pepper_flash_browser_host_qt.cpp
+++ b/src/core/renderer_host/pepper/pepper_flash_browser_host_qt.cpp
@@ -61,7 +61,7 @@
#if defined(OS_WIN)
#include <windows.h>
-#elif defined(OS_MACOSX)
+#elif defined(OS_MAC)
#include <CoreServices/CoreServices.h>
#endif
@@ -109,7 +109,7 @@ int32_t PepperFlashBrowserHostQt::OnUpdateActivity(ppapi::host::HostMessageConte
int value = 0;
if (SystemParametersInfo(SPI_GETSCREENSAVETIMEOUT, 0, &value, 0))
SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, value, NULL, 0);
-#elif defined(OS_MACOSX)
+#elif defined(OS_MAC)
UpdateSystemActivity(OverallAct);
#endif
return PP_OK;
diff --git a/src/core/resource_bundle_qt.cpp b/src/core/resource_bundle_qt.cpp
index 22b40a7ba..22622f216 100644
--- a/src/core/resource_bundle_qt.cpp
+++ b/src/core/resource_bundle_qt.cpp
@@ -38,9 +38,12 @@
****************************************************************************/
#include "base/command_line.h"
+#include "base/files/file_util.h"
+#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
+#include "base/notreached.h"
#include "content/public/common/content_switches.h"
-#include "services/service_manager/sandbox/switches.h"
+#include "sandbox/policy/switches.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/data_pack.h"
#include "ui/base/resource/resource_bundle.h"
@@ -75,7 +78,7 @@ bool ResourceBundle::LocaleDataPakExists(const std::string& locale)
#if defined(OS_LINUX)
base::CommandLine *parsed_command_line = base::CommandLine::ForCurrentProcess();
std::string process_type = parsed_command_line->GetSwitchValueASCII(switches::kProcessType);
- bool no_sandbox = parsed_command_line->HasSwitch(service_manager::switches::kNoSandbox);
+ bool no_sandbox = parsed_command_line->HasSwitch(sandbox::policy::switches::kNoSandbox);
if (process_type == switches::kRendererProcess && !no_sandbox) {
// The Renderer Process is sandboxed thus only one locale is available in it.
// The particular one is passed by the --lang command line option.
@@ -87,10 +90,11 @@ bool ResourceBundle::LocaleDataPakExists(const std::string& locale)
}
#endif
- return !GetLocaleFilePath(locale).empty();
+ const auto path = GetLocaleFilePath(locale);
+ return !path.empty() && base::PathExists(path);
}
-std::string ResourceBundle::LoadLocaleResources(const std::string& pref_locale)
+std::string ResourceBundle::LoadLocaleResources(const std::string &pref_locale, bool /*crash_on_failure*/)
{
DCHECK(!locale_resources_data_.get()) << "locale.pak already loaded";
diff --git a/src/core/touch_selection_controller_client_qt.cpp b/src/core/touch_selection_controller_client_qt.cpp
index 0f44210d1..ef7b22ecc 100644
--- a/src/core/touch_selection_controller_client_qt.cpp
+++ b/src/core/touch_selection_controller_client_qt.cpp
@@ -45,7 +45,7 @@
#include "web_contents_adapter.h"
#include "web_contents_adapter_client.h"
-#include "content/browser/frame_host/render_frame_host_impl.h"
+#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "ui/gfx/geometry/size_conversions.h"
@@ -229,29 +229,29 @@ void TouchSelectionControllerClientQt::SetNeedsAnimate()
void TouchSelectionControllerClientQt::MoveCaret(const gfx::PointF& position)
{
- content::mojom::FrameInputHandler *frameInputHandler = m_rwhv->getFrameInputHandler();
- if (!frameInputHandler)
+ auto *frameWidgetInputHandler = m_rwhv->getFrameWidgetInputHandler();
+ if (!frameWidgetInputHandler)
return;
- frameInputHandler->MoveCaret(gfx::ToRoundedPoint(position));
+ frameWidgetInputHandler->MoveCaret(gfx::ToRoundedPoint(position));
}
void TouchSelectionControllerClientQt::MoveRangeSelectionExtent(const gfx::PointF& extent)
{
- content::mojom::FrameInputHandler *frameInputHandler = m_rwhv->getFrameInputHandler();
- if (!frameInputHandler)
+ auto *frameWidgetInputHandler = m_rwhv->getFrameWidgetInputHandler();
+ if (!frameWidgetInputHandler)
return;
- frameInputHandler->MoveRangeSelectionExtent(gfx::ToRoundedPoint(extent));
+ frameWidgetInputHandler->MoveRangeSelectionExtent(gfx::ToRoundedPoint(extent));
}
void TouchSelectionControllerClientQt::SelectBetweenCoordinates(const gfx::PointF& base, const gfx::PointF& extent)
{
- content::mojom::FrameInputHandler *frameInputHandler = m_rwhv->getFrameInputHandler();
- if (!frameInputHandler)
+ auto *frameWidgetInputHandler = m_rwhv->getFrameWidgetInputHandler();
+ if (!frameWidgetInputHandler)
return;
- frameInputHandler->SelectRange(gfx::ToRoundedPoint(base), gfx::ToRoundedPoint(extent));
+ frameWidgetInputHandler->SelectRange(gfx::ToRoundedPoint(base), gfx::ToRoundedPoint(extent));
}
void TouchSelectionControllerClientQt::OnSelectionEvent(ui::SelectionEventType event)
diff --git a/src/core/type_conversion.cpp b/src/core/type_conversion.cpp
index bf2656de4..a4cc57b76 100644
--- a/src/core/type_conversion.cpp
+++ b/src/core/type_conversion.cpp
@@ -133,6 +133,21 @@ QImage toQImage(const SkBitmap &bitmap)
break;
}
break;
+ case kBGR_101010x_SkColorType:
+ case kBGRA_1010102_SkColorType:
+ switch (bitmap.alphaType()) {
+ case kUnknown_SkAlphaType:
+ break;
+ case kUnpremul_SkAlphaType:
+ // not supported - treat as opaque
+ case kOpaque_SkAlphaType:
+ image = toQImage(bitmap, QImage::Format_BGR30);
+ break;
+ case kPremul_SkAlphaType:
+ image = toQImage(bitmap, QImage::Format_A2BGR30_Premultiplied);
+ break;
+ }
+ break;
case kGray_8_SkColorType:
image = toQImage(bitmap, QImage::Format_Grayscale8);
break;
diff --git a/src/core/type_conversion.h b/src/core/type_conversion.h
index 565d8330a..85fd763b4 100644
--- a/src/core/type_conversion.h
+++ b/src/core/type_conversion.h
@@ -52,7 +52,6 @@
#include <base/strings/nullable_string16.h>
#include "base/files/file_path.h"
#include "base/time/time.h"
-#include "content/public/common/file_chooser_file_info.h"
#include "favicon_manager.h"
#include "net/cookies/canonical_cookie.h"
#include "third_party/blink/public/mojom/favicon/favicon_url.mojom-forward.h"
@@ -87,6 +86,17 @@ inline QString toQt(const base::string16 &string)
#endif
}
+inline QString toQt(const base::Optional<base::string16> &string)
+{
+ if (!string.has_value())
+ return QString();
+#if defined(OS_WIN)
+ return QString::fromStdWString(string->data());
+#else
+ return QString::fromUtf16(string->data());
+#endif
+}
+
inline QString toQString(const std::string &string)
{
return QString::fromStdString(string);
@@ -117,6 +127,13 @@ inline base::NullableString16 toNullableString16(const QString &qString)
return base::NullableString16(toString16(qString), qString.isNull());
}
+inline base::Optional<base::string16> toOptionalString16(const QString &qString)
+{
+ if (qString.isNull())
+ return base::nullopt;
+ return base::make_optional(toString16(qString));
+}
+
inline QUrl toQt(const GURL &url)
{
if (url.is_valid())
@@ -244,43 +261,6 @@ inline base::FilePath toFilePath(const QString &str)
return base::FilePath(toFilePathString(str));
}
-template <typename T>
-inline T fileListingHelper(const QString &)
-// Clang is still picky about this though it should be supported eventually.
-// See http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#941
-#ifndef Q_CC_CLANG
-= delete;
-#else
-{ return T(); }
-#endif
-
-template <>
-inline content::FileChooserFileInfo fileListingHelper<content::FileChooserFileInfo>(const QString &file)
-{
- content::FileChooserFileInfo choose_file;
- base::FilePath fp(toFilePath(file));
- choose_file.file_path = fp;
- choose_file.display_name = fp.BaseName().value();
- return choose_file;
-}
-
-template <>
-inline base::FilePath fileListingHelper<base::FilePath>(const QString &file)
-{
- return base::FilePath(toFilePathString(file));
-}
-
-
-template <typename T>
-inline std::vector<T> toVector(const QStringList &fileList)
-{
- std::vector<T> selectedFiles;
- selectedFiles.reserve(fileList.size());
- for (const QString &file : fileList)
- selectedFiles.push_back(fileListingHelper<T>(file));
- return selectedFiles;
-}
-
int flagsFromModifiers(Qt::KeyboardModifiers modifiers);
inline QStringList fromVector(const std::vector<base::string16> &vector)
diff --git a/src/core/user_script.cpp b/src/core/user_script.cpp
index c0fcd0aea..1c8a78cd3 100644
--- a/src/core/user_script.cpp
+++ b/src/core/user_script.cpp
@@ -201,10 +201,10 @@ void UserScript::parseMetadataHeader()
line = base::StringPiece(script_text.data() + line_start, line_end - line_start);
if (!in_metadata) {
- if (line.starts_with(kUserScriptBegin))
+ if (base::StartsWith(line, kUserScriptBegin))
in_metadata = true;
} else {
- if (line.starts_with(kUserScriptEnd))
+ if (base::StartsWith(line, kUserScriptEnd))
break;
std::string value;
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index 7ba65f2bb..61c6368f6 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -62,12 +62,12 @@
#include "base/command_line.h"
#include "base/run_loop.h"
+#include "base/task/current_thread.h"
#include "base/task/post_task.h"
#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,10 +86,10 @@
#include "content/public/common/page_state.h"
#include "content/public/common/page_zoom.h"
#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/page/page_zoom.h"
#include "third_party/blink/public/common/peerconnection/webrtc_ip_handling_policy.h"
+#include "third_party/blink/public/common/web_preferences/web_preferences.h"
#include "third_party/blink/public/mojom/frame/media_player_action.mojom.h"
#include "printing/buildflags/buildflags.h"
#include "ui/base/clipboard/clipboard.h"
@@ -373,7 +373,9 @@ static void deserializeNavigationHistory(QDataStream &input, int *currentIndex,
}
}
-static void Navigate(WebContentsAdapter *adapter, const content::NavigationController::LoadURLParams &params)
+namespace {
+
+void Navigate(WebContentsAdapter *adapter, const content::NavigationController::LoadURLParams &params)
{
Q_ASSERT(adapter);
adapter->webContents()->GetController().LoadURLWithParams(params);
@@ -381,7 +383,7 @@ static void Navigate(WebContentsAdapter *adapter, const content::NavigationContr
adapter->resetSelection();
}
-static void NavigateTask(QWeakPointer<WebContentsAdapter> weakAdapter, const content::NavigationController::LoadURLParams &params)
+void NavigateTask(QWeakPointer<WebContentsAdapter> weakAdapter, const content::NavigationController::LoadURLParams &params)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
const auto adapter = weakAdapter.toStrongRef();
@@ -390,7 +392,6 @@ static void NavigateTask(QWeakPointer<WebContentsAdapter> weakAdapter, const con
Navigate(adapter.get(), params);
}
-namespace {
static QList<WebContentsAdapter *> recursive_guard_loading_adapters;
class LoadRecursionGuard {
@@ -451,7 +452,7 @@ WebContentsAdapter::WebContentsAdapter()
#endif
, m_adapterClient(nullptr)
, m_nextRequestId(CallbackDirectory::ReservedCallbackIdsEnd)
- , m_currentDropAction(blink::kWebDragOperationNone)
+ , m_currentDropAction(blink::kDragOperationNone)
, m_devToolsFrontend(nullptr)
{
// This has to be the first thing we create, and the last we destroy.
@@ -467,7 +468,7 @@ WebContentsAdapter::WebContentsAdapter(std::unique_ptr<content::WebContents> web
#endif
, m_adapterClient(nullptr)
, m_nextRequestId(CallbackDirectory::ReservedCallbackIdsEnd)
- , m_currentDropAction(blink::kWebDragOperationNone)
+ , m_currentDropAction(blink::kDragOperationNone)
, m_devToolsFrontend(nullptr)
{
// This has to be the first thing we create, and the last we destroy.
@@ -528,9 +529,6 @@ 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
@@ -542,7 +540,8 @@ void WebContentsAdapter::initialize(content::SiteInstance *site)
content::RenderViewHost *rvh = m_webContents->GetRenderViewHost();
Q_ASSERT(rvh);
if (!rvh->IsRenderViewLive())
- static_cast<content::WebContentsImpl*>(m_webContents.get())->CreateRenderViewForRenderManager(rvh, MSG_ROUTING_NONE, MSG_ROUTING_NONE, base::UnguessableToken::Create(), content::FrameReplicationState());
+ static_cast<content::WebContentsImpl*>(m_webContents.get())->CreateRenderViewForRenderManager(
+ rvh, base::nullopt, MSG_ROUTING_NONE);
m_webContentsDelegate->RenderViewHostChanged(nullptr, rvh);
@@ -1053,13 +1052,10 @@ void WebContentsAdapter::runJavaScript(const QString &javaScript, quint32 worldI
content::RenderViewHost *rvh = m_webContents->GetRenderViewHost();
Q_ASSERT(rvh);
// static_cast<content::RenderFrameHostImpl *>(rvh->GetMainFrame())->NotifyUserActivation();
- if (worldId == 0) {
+ if (worldId == 0)
rvh->GetMainFrame()->ExecuteJavaScript(toString16(javaScript), base::NullCallback());
- return;
- }
-
- content::RenderFrameHost::JavaScriptResultCallback callback = base::BindOnce(&callbackOnEvaluateJS, m_adapterClient, CallbackDirectory::NoCallbackId);
- rvh->GetMainFrame()->ExecuteJavaScriptInIsolatedWorld(toString16(javaScript), std::move(callback), worldId);
+ else
+ rvh->GetMainFrame()->ExecuteJavaScriptInIsolatedWorld(toString16(javaScript), base::NullCallback(), worldId);
}
quint64 WebContentsAdapter::runJavaScriptCallbackResult(const QString &javaScript, quint32 worldId)
@@ -1090,10 +1086,10 @@ quint64 WebContentsAdapter::fetchDocumentInnerText()
return m_nextRequestId++;
}
-void WebContentsAdapter::updateWebPreferences(const content::WebPreferences & webPreferences)
+void WebContentsAdapter::updateWebPreferences(const blink::web_pref::WebPreferences &webPreferences)
{
CHECK_INITIALIZED();
- m_webContents->GetRenderViewHost()->UpdateWebkitPreferences(webPreferences);
+ m_webContents->SetWebPreferences(webPreferences);
// In case of updating preferences during navigation, there might be a pending RVH what will
// be active on successful navigation.
@@ -1101,7 +1097,7 @@ void WebContentsAdapter::updateWebPreferences(const content::WebPreferences & we
if (pendingRFH) {
content::RenderViewHost *pendingRVH = pendingRFH->GetRenderViewHost();
Q_ASSERT(pendingRVH);
- pendingRVH->UpdateWebkitPreferences(webPreferences);
+ static_cast<content::RenderViewHostImpl*>(pendingRVH)->SendWebPreferencesToRenderer();
}
}
@@ -1463,10 +1459,10 @@ void WebContentsAdapter::setWebChannel(QWebChannel *channel, uint worldId)
static QMimeData *mimeDataFromDropData(const content::DropData &dropData)
{
QMimeData *mimeData = new QMimeData();
- if (!dropData.text.is_null())
- mimeData->setText(toQt(dropData.text.string()));
- if (!dropData.html.is_null())
- mimeData->setHtml(toQt(dropData.html.string()));
+ if (dropData.text.has_value())
+ mimeData->setText(toQt(*dropData.text));
+ if (dropData.html.has_value())
+ mimeData->setHtml(toQt(*dropData.html));
if (dropData.url.is_valid())
mimeData->setUrls(QList<QUrl>() << toQt(dropData.url));
if (!dropData.custom_data.empty()) {
@@ -1477,16 +1473,16 @@ static QMimeData *mimeDataFromDropData(const content::DropData &dropData)
return mimeData;
}
-static blink::WebDragOperationsMask toWeb(const Qt::DropActions action)
+static blink::DragOperationsMask toWeb(const Qt::DropActions action)
{
- int result = blink::kWebDragOperationNone;
+ int result = blink::kDragOperationNone;
if (action & Qt::CopyAction)
- result |= blink::kWebDragOperationCopy;
+ result |= blink::kDragOperationCopy;
if (action & Qt::LinkAction)
- result |= blink::kWebDragOperationLink;
+ result |= blink::kDragOperationLink;
if (action & Qt::MoveAction)
- result |= blink::kWebDragOperationMove;
- return static_cast<blink::WebDragOperationsMask>(result);
+ result |= blink::kDragOperationMove;
+ return static_cast<blink::DragOperationsMask>(result);
}
void WebContentsAdapter::startDragging(QObject *dragSource, const content::DropData &dropData,
@@ -1505,7 +1501,7 @@ void WebContentsAdapter::startDragging(QObject *dragSource, const content::DropD
m_currentDropData->file_contents.clear();
m_currentDropData->file_contents_content_disposition.clear();
- m_currentDropAction = blink::kWebDragOperationNone;
+ m_currentDropAction = blink::kDragOperationNone;
QDrag *drag = new QDrag(dragSource); // will be deleted by Qt's DnD implementation
bool dValid = true;
QMetaObject::Connection onDestroyed = QObject::connect(dragSource, &QObject::destroyed, [&dValid](){
@@ -1523,7 +1519,7 @@ void WebContentsAdapter::startDragging(QObject *dragSource, const content::DropD
}
{
- base::MessageLoopCurrent::ScopedNestableTaskAllower allow;
+ base::CurrentThread::ScopedNestableTaskAllower allow;
drag->exec(allowedActions);
}
@@ -1534,7 +1530,7 @@ void WebContentsAdapter::startDragging(QObject *dragSource, const content::DropD
if (rvh) {
rvh->GetWidget()->DragSourceEndedAt(gfx::PointF(m_lastDragClientPos.x(), m_lastDragClientPos.y()),
gfx::PointF(m_lastDragScreenPos.x(), m_lastDragScreenPos.y()),
- blink::WebDragOperation(m_currentDropAction));
+ blink::DragOperation(m_currentDropAction));
rvh->GetWidget()->DragSourceSystemDragEnded();
}
}
@@ -1586,22 +1582,22 @@ static void fillDropDataFromMimeData(content::DropData *dropData, const QMimeDat
if (!dropData->filenames.empty())
return;
if (mimeData->hasHtml())
- dropData->html = toNullableString16(mimeData->html());
+ dropData->html = toOptionalString16(mimeData->html());
if (mimeData->hasText())
- dropData->text = toNullableString16(mimeData->text());
+ dropData->text = toOptionalString16(mimeData->text());
if (mimeData->hasFormat(QLatin1String(ui::kMimeTypeWebCustomData))) {
QByteArray customData = mimeData->data(QLatin1String(ui::kMimeTypeWebCustomData));
ui::ReadCustomDataIntoMap(customData.constData(), customData.length(), &dropData->custom_data);
}
}
-Qt::DropAction toQt(blink::WebDragOperation op)
+Qt::DropAction toQt(blink::DragOperation op)
{
- if (op & blink::kWebDragOperationCopy)
+ if (op & blink::kDragOperationCopy)
return Qt::CopyAction;
- if (op & blink::kWebDragOperationLink)
+ if (op & blink::kDragOperationLink)
return Qt::LinkAction;
- if (op & blink::kWebDragOperationMove || op & blink::kWebDragOperationDelete)
+ if (op & blink::kDragOperationMove || op & blink::kDragOperationDelete)
return Qt::MoveAction;
return Qt::IgnoreAction;
}
@@ -1658,7 +1654,7 @@ Qt::DropAction WebContentsAdapter::updateDragPosition(QDragMoveEvent *e, const Q
rvh->GetWidget()->DragTargetDragOver(toGfx(m_lastDragClientPos), toGfx(m_lastDragScreenPos), toWeb(e->possibleActions()),
toWeb(e->buttons()) | toWeb(e->modifiers()));
waitForUpdateDragActionCalled();
- return toQt(blink::WebDragOperation(m_currentDropAction));
+ return toQt(blink::DragOperation(m_currentDropAction));
}
void WebContentsAdapter::waitForUpdateDragActionCalled()
@@ -1667,7 +1663,7 @@ void WebContentsAdapter::waitForUpdateDragActionCalled()
const qint64 timeout = 3000;
QElapsedTimer t;
t.start();
- auto seqMan = base::MessageLoopCurrent::GetCurrentSequenceManagerImpl();
+ auto seqMan = base::CurrentThread::GetCurrentSequenceManagerImpl();
base::MessagePump::Delegate *delegate =
static_cast<base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl *>(
seqMan->controller_.get());
@@ -1691,7 +1687,7 @@ void WebContentsAdapter::updateDragAction(int action)
{
CHECK_INITIALIZED();
m_updateDragActionCalled = true;
- m_currentDropAction = static_cast<blink::WebDragOperation>(action);
+ m_currentDropAction = static_cast<blink::DragOperation>(action);
}
void WebContentsAdapter::endDragging(QDropEvent *e, const QPointF &screenPos)
@@ -2010,9 +2006,6 @@ 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()
@@ -2024,9 +2017,7 @@ void WebContentsAdapter::undiscard()
Q_ASSERT(rvh);
if (!rvh->IsRenderViewLive())
static_cast<content::WebContentsImpl *>(m_webContents.get())
- ->CreateRenderViewForRenderManager(rvh, MSG_ROUTING_NONE, MSG_ROUTING_NONE,
- base::UnguessableToken::Create(),
- content::FrameReplicationState());
+ ->CreateRenderViewForRenderManager(rvh, base::nullopt, MSG_ROUTING_NONE);
m_webContentsDelegate->RenderViewHostChanged(nullptr, rvh);
m_adapterClient->initializationFinished();
m_adapterClient->selectionChanged();
@@ -2052,6 +2043,6 @@ ASSERT_ENUMS_MATCH(ReferrerPolicy::OriginWhenCrossOrigin, network::mojom::Referr
//ASSERT_ENUMS_MATCH(ReferrerPolicy::NoReferrerWhenDowngradeOriginWhenCrossOrigin, network::mojom::ReferrerPolicy::kNoReferrerWhenDowngradeOriginWhenCrossOrigin)
ASSERT_ENUMS_MATCH(ReferrerPolicy::SameOrigin, network::mojom::ReferrerPolicy::kSameOrigin)
ASSERT_ENUMS_MATCH(ReferrerPolicy::StrictOrigin, network::mojom::ReferrerPolicy::kStrictOrigin)
-ASSERT_ENUMS_MATCH(ReferrerPolicy::Last, network::mojom::ReferrerPolicy::kLast)
+ASSERT_ENUMS_MATCH(ReferrerPolicy::Last, network::mojom::ReferrerPolicy::kMaxValue)
} // namespace QtWebEngineCore
diff --git a/src/core/web_contents_adapter.h b/src/core/web_contents_adapter.h
index 941a815c0..ef710579b 100644
--- a/src/core/web_contents_adapter.h
+++ b/src/core/web_contents_adapter.h
@@ -64,9 +64,14 @@
#include <QUrl>
#include <QPointer>
+namespace blink {
+namespace web_pref {
+struct WebPreferences;
+}
+}
+
namespace content {
class WebContents;
-struct WebPreferences;
struct OpenURLParams;
class SiteInstance;
}
@@ -162,7 +167,7 @@ public:
quint64 runJavaScriptCallbackResult(const QString &javaScript, quint32 worldId);
quint64 fetchDocumentMarkup();
quint64 fetchDocumentInnerText();
- void updateWebPreferences(const content::WebPreferences &webPreferences);
+ void updateWebPreferences(const blink::web_pref::WebPreferences &webPreferences);
void download(const QUrl &url, const QString &suggestedFileName,
const QUrl &referrerUrl = QUrl(),
ReferrerPolicy referrerPolicy = ReferrerPolicy::Default);
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index e2ab94610..a749e532d 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -65,7 +65,7 @@
#include "components/error_page/common/error.h"
#include "components/error_page/common/localized_error.h"
#include "components/web_cache/browser/web_cache_manager.h"
-#include "content/browser/frame_host/render_frame_host_impl.h"
+#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/browser_context.h"
@@ -79,7 +79,6 @@
#include "content/public/browser/web_contents.h"
#include "content/public/common/frame_navigate_params.h"
#include "content/public/common/url_constants.h"
-#include "content/public/common/web_preferences.h"
#include "net/base/data_url.h"
#include "net/base/url_util.h"
@@ -233,10 +232,11 @@ QUrl WebContentsDelegateQt::url(content::WebContents* source) const {
m_pendingUrlUpdate = false;
return newUrl;
}
-void WebContentsDelegateQt::AddNewContents(content::WebContents* source, std::unique_ptr<content::WebContents> new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture, bool* was_blocked)
+void WebContentsDelegateQt::AddNewContents(content::WebContents* source, std::unique_ptr<content::WebContents> new_contents, const GURL &target_url,
+ WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture, bool* was_blocked)
{
Q_UNUSED(source)
- QSharedPointer<WebContentsAdapter> newAdapter = createWindow(std::move(new_contents), disposition, initial_pos, m_initialTargetUrl, user_gesture);
+ QSharedPointer<WebContentsAdapter> newAdapter = createWindow(std::move(new_contents), disposition, initial_pos, toQt(target_url), user_gesture);
// Chromium can forget to pass user-agent override settings to new windows (see QTBUG-61774 and QTBUG-76249),
// so set it here. Note the actual value doesn't really matter here. Only the second value does, but we try
// to give the correct user-agent anyway.
@@ -322,7 +322,7 @@ void WebContentsDelegateQt::RenderFrameHostChanged(content::RenderFrameHost *old
m_frameFocusedObserver.addNode(new_node);
// Is this a main frame?
- if (new_host->GetFrameOwnerElementType() == blink::FrameOwnerElementType::kNone) {
+ if (new_host->GetFrameOwnerElementType() == blink::mojom::FrameOwnerElementType::kNone) {
content::RenderProcessHost *renderProcessHost = new_host->GetProcess();
const base::Process &process = renderProcessHost->GetProcess();
if (process.IsValid())
@@ -377,6 +377,9 @@ void WebContentsDelegateQt::EmitLoadStarted(const QUrl &url, bool isErrorPage)
void WebContentsDelegateQt::DidStartNavigation(content::NavigationHandle *navigation_handle)
{
+ if (!webEngineSettings()->testAttribute(QWebEngineSettings::ErrorPageEnabled))
+ navigation_handle->SetSilentlyIgnoreErrors();
+
if (!navigation_handle->IsInMainFrame())
return;
@@ -544,12 +547,11 @@ void WebContentsDelegateQt::DidFinishLoad(content::RenderFrameHost* render_frame
m_viewClient->iconChanged(QUrl());
content::NavigationEntry *entry = web_contents()->GetController().GetActiveEntry();
- int http_statuscode = entry ? http_statuscode = entry->GetHttpStatusCode() : 0;
+ int http_statuscode = entry ? entry->GetHttpStatusCode() : 0;
EmitLoadFinished(http_statuscode < 400, toQt(validated_url), false /* isErrorPage */, http_statuscode);
}
-void WebContentsDelegateQt::DidUpdateFaviconURL(const std::vector<blink::mojom::FaviconURLPtr> &candidates)
-
+void WebContentsDelegateQt::DidUpdateFaviconURL(content::RenderFrameHost *render_frame_host, const std::vector<blink::mojom::FaviconURLPtr> &candidates)
{
QList<FaviconInfo> faviconCandidates;
faviconCandidates.reserve(static_cast<int>(candidates.size()));
@@ -567,9 +569,8 @@ void WebContentsDelegateQt::DidUpdateFaviconURL(const std::vector<blink::mojom::
void WebContentsDelegateQt::WebContentsCreated(content::WebContents * /*source_contents*/,
int /*opener_render_process_id*/, int /*opener_render_frame_id*/,
const std::string &/*frame_name*/,
- const GURL &target_url, content::WebContents *newContents)
+ const GURL &/*target_url*/, content::WebContents *newContents)
{
- m_initialTargetUrl = toQt(target_url);
if (auto *view = static_cast<content::WebContentsImpl *>(newContents)->GetView())
static_cast<WebContentsViewQt *>(view)->setFactoryClient(m_viewClient);
}
@@ -587,11 +588,11 @@ content::JavaScriptDialogManager *WebContentsDelegateQt::GetJavaScriptDialogMana
return JavaScriptDialogManagerQt::GetInstance();
}
-void WebContentsDelegateQt::EnterFullscreenModeForTab(content::WebContents *web_contents, const GURL& origin, const blink::mojom::FullscreenOptions &)
+void WebContentsDelegateQt::EnterFullscreenModeForTab(content::RenderFrameHost *requesting_frame, const blink::mojom::FullscreenOptions &options)
{
- Q_UNUSED(web_contents);
+ Q_UNUSED(options);
if (!m_viewClient->isFullScreenMode())
- m_viewClient->requestFullScreenMode(toQt(origin), true);
+ m_viewClient->requestFullScreenMode(toQt(requesting_frame->GetLastCommittedURL()), true);
}
void WebContentsDelegateQt::ExitFullscreenModeForTab(content::WebContents *web_contents)
@@ -611,8 +612,10 @@ ASSERT_ENUMS_MATCH(FilePickerController::OpenMultiple, blink::mojom::FileChooser
ASSERT_ENUMS_MATCH(FilePickerController::UploadFolder, blink::mojom::FileChooserParams::Mode::kUploadFolder)
ASSERT_ENUMS_MATCH(FilePickerController::Save, blink::mojom::FileChooserParams::Mode::kSave)
+extern FilePickerController *createFilePickerController(FilePickerController::FileChooserMode mode, scoped_refptr<content::FileSelectListener> listener, const QString &defaultFileName, const QStringList &acceptedMimeTypes, QObject *parent = nullptr);
+
void WebContentsDelegateQt::RunFileChooser(content::RenderFrameHost * /*frameHost*/,
- std::unique_ptr<content::FileSelectListener> listener,
+ scoped_refptr<content::FileSelectListener> listener,
const blink::mojom::FileChooserParams& params)
{
QStringList acceptedMimeTypes;
@@ -620,8 +623,8 @@ void WebContentsDelegateQt::RunFileChooser(content::RenderFrameHost * /*frameHos
for (std::vector<base::string16>::const_iterator it = params.accept_types.begin(); it < params.accept_types.end(); ++it)
acceptedMimeTypes.append(toQt(*it));
- m_filePickerController.reset(new FilePickerController(static_cast<FilePickerController::FileChooserMode>(params.mode),
- std::move(listener), toQt(params.default_file_name.value()), acceptedMimeTypes));
+ m_filePickerController.reset(createFilePickerController(static_cast<FilePickerController::FileChooserMode>(params.mode),
+ listener, toQt(params.default_file_name.value()), acceptedMimeTypes));
// Defer the call to not block base::MessageLoop::RunTask with modal dialogs.
QTimer::singleShot(0, [this] () {
@@ -644,7 +647,7 @@ void WebContentsDelegateQt::FindReply(content::WebContents *source, int request_
void WebContentsDelegateQt::RequestMediaAccessPermission(content::WebContents *web_contents, const content::MediaStreamRequest &request, content::MediaResponseCallback callback)
{
- MediaCaptureDevicesDispatcher::GetInstance()->processMediaAccessRequest(m_viewClient, web_contents, request, std::move(callback));
+ MediaCaptureDevicesDispatcher::GetInstance()->processMediaAccessRequest(web_contents, request, std::move(callback));
}
void WebContentsDelegateQt::SetContentsBounds(content::WebContents *source, const gfx::Rect &bounds)
@@ -699,7 +702,7 @@ void WebContentsDelegateQt::RequestToLockMouse(content::WebContents *web_content
m_viewClient->runMouseLockPermissionRequest(toQt(web_contents->GetLastCommittedURL().GetOrigin()));
}
-void WebContentsDelegateQt::overrideWebPreferences(content::WebContents *webContents, content::WebPreferences *webPreferences)
+void WebContentsDelegateQt::overrideWebPreferences(content::WebContents *webContents, blink::web_pref::WebPreferences *webPreferences)
{
WebEngineSettings::get(m_viewClient->webEngineSettings())->overrideWebPreferences(webContents, webPreferences);
}
@@ -808,9 +811,9 @@ bool WebContentsDelegateQt::CheckMediaAccessPermission(content::RenderFrameHost
}
}
-void WebContentsDelegateQt::RegisterProtocolHandler(content::WebContents *webContents, const std::string &protocol, const GURL &url, bool)
+void WebContentsDelegateQt::RegisterProtocolHandler(content::RenderFrameHost *frameHost, const std::string &protocol, const GURL &url, bool)
{
- content::BrowserContext *context = webContents->GetBrowserContext();
+ content::BrowserContext *context = frameHost->GetBrowserContext();
if (context->IsOffTheRecord())
return;
@@ -823,13 +826,13 @@ void WebContentsDelegateQt::RegisterProtocolHandler(content::WebContents *webCon
return;
QWebEngineRegisterProtocolHandlerRequest request(
- QSharedPointer<RegisterProtocolHandlerRequestControllerImpl>::create(webContents, handler));
+ QSharedPointer<RegisterProtocolHandlerRequestControllerImpl>::create(content::WebContents::FromRenderFrameHost(frameHost), handler));
m_viewClient->runRegisterProtocolHandlerRequest(std::move(request));
}
-void WebContentsDelegateQt::UnregisterProtocolHandler(content::WebContents *webContents, const std::string &protocol, const GURL &url, bool)
+void WebContentsDelegateQt::UnregisterProtocolHandler(content::RenderFrameHost *frameHost, const std::string &protocol, const GURL &url, bool)
{
- content::BrowserContext* context = webContents->GetBrowserContext();
+ content::BrowserContext* context = frameHost->GetBrowserContext();
if (context->IsOffTheRecord())
return;
diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h
index 1481c7904..800319d93 100644
--- a/src/core/web_contents_delegate_qt.h
+++ b/src/core/web_contents_delegate_qt.h
@@ -40,7 +40,7 @@
#ifndef WEB_CONTENTS_DELEGATE_QT_H
#define WEB_CONTENTS_DELEGATE_QT_H
-#include "content/browser/frame_host/frame_tree_node.h"
+#include "content/browser/renderer_host/frame_tree_node.h"
#include "content/public/browser/media_capture_devices.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_observer.h"
@@ -55,12 +55,17 @@
#include <QtCore/qlist.h>
#include <QWebEngineCertificateError>
+namespace blink {
+ namespace web_pref {
+ struct WebPreferences;
+ }
+}
+
namespace content {
class ColorChooser;
class SiteInstance;
class JavaScriptDialogManager;
class WebContents;
- struct WebPreferences;
struct ColorSuggestion;
}
@@ -117,7 +122,8 @@ public:
// WebContentsDelegate overrides
content::WebContents *OpenURLFromTab(content::WebContents *source, const content::OpenURLParams &params) override;
void NavigationStateChanged(content::WebContents* source, content::InvalidateTypes changed_flags) override;
- void AddNewContents(content::WebContents *source, std::unique_ptr<content::WebContents> new_contents, WindowOpenDisposition disposition, const gfx::Rect &initial_pos, bool user_gesture, bool *was_blocked) override;
+ void AddNewContents(content::WebContents *source, std::unique_ptr<content::WebContents> new_contents, const GURL &target_url,
+ WindowOpenDisposition disposition, const gfx::Rect &initial_pos, bool user_gesture, bool *was_blocked) override;
void CloseContents(content::WebContents *source) override;
void LoadProgressChanged(double progress) override;
bool HandleKeyboardEvent(content::WebContents *source, const content::NativeWebKeyboardEvent &event) override;
@@ -125,11 +131,11 @@ public:
void WebContentsCreated(content::WebContents *source_contents, int opener_render_process_id, int opener_render_frame_id,
const std::string &frame_name, const GURL &target_url, content::WebContents *new_contents) override;
content::JavaScriptDialogManager *GetJavaScriptDialogManager(content::WebContents *source) override;
- void EnterFullscreenModeForTab(content::WebContents *web_contents, const GURL &origin, const blink::mojom::FullscreenOptions &options) override;
+ void EnterFullscreenModeForTab(content::RenderFrameHost *requesting_frame, const blink::mojom::FullscreenOptions &options) override;
void ExitFullscreenModeForTab(content::WebContents*) override;
bool IsFullscreenForTabOrPending(const content::WebContents* web_contents) override;
void RunFileChooser(content::RenderFrameHost* render_frame_host,
- std::unique_ptr<content::FileSelectListener> listener,
+ scoped_refptr<content::FileSelectListener> listener,
const blink::mojom::FileChooserParams& params) override;
bool DidAddMessageToConsole(content::WebContents *source, blink::mojom::ConsoleMessageLevel log_level,
const base::string16 &message, int32_t line_no, const base::string16 &source_id) override;
@@ -142,8 +148,8 @@ public:
void RequestToLockMouse(content::WebContents *web_contents, bool user_gesture, bool last_unlocked_by_target) override;
void BeforeUnloadFired(content::WebContents* tab, bool proceed, bool* proceed_to_fire_unload) override;
bool CheckMediaAccessPermission(content::RenderFrameHost* render_frame_host, const GURL& security_origin, blink::mojom::MediaStreamType type) override;
- void RegisterProtocolHandler(content::WebContents* web_contents, const std::string& protocol, const GURL& url, bool user_gesture) override;
- void UnregisterProtocolHandler(content::WebContents* web_contents, const std::string& protocol, const GURL& url, bool user_gesture) override;
+ void RegisterProtocolHandler(content::RenderFrameHost* frame_host, const std::string& protocol, const GURL& url, bool user_gesture) override;
+ void UnregisterProtocolHandler(content::RenderFrameHost* frame_host, const std::string& protocol, const GURL& url, bool user_gesture) override;
bool TakeFocus(content::WebContents *source, bool reverse) override;
void ContentsZoomChange(bool zoom_in) override;
@@ -161,14 +167,14 @@ public:
void DidFailLoad(content::RenderFrameHost* render_frame_host, const GURL& validated_url, int error_code) override;
void DidFinishLoad(content::RenderFrameHost *render_frame_host, const GURL &validated_url) override;
void BeforeUnloadFired(bool proceed, const base::TimeTicks& proceed_time) override;
- void DidUpdateFaviconURL(const std::vector<blink::mojom::FaviconURLPtr> &candidates) override;
+ void DidUpdateFaviconURL(content::RenderFrameHost *render_frame_host, const std::vector<blink::mojom::FaviconURLPtr> &candidates) override;
void OnVisibilityChanged(content::Visibility visibility) override;
void DidFirstVisuallyNonEmptyPaint() override;
void ActivateContents(content::WebContents* contents) override;
bool ShouldNavigateOnBackForwardMouseButtons() override;
void didFailLoad(const QUrl &url, int errorCode, const QString &errorDescription);
- void overrideWebPreferences(content::WebContents *, content::WebPreferences*);
+ void overrideWebPreferences(content::WebContents *, blink::web_pref::WebPreferences*);
void allowCertificateError(const QSharedPointer<CertificateErrorController> &);
void selectClientCert(const QSharedPointer<ClientCertSelectController> &);
void requestFeaturePermission(ProfileAdapter::PermissionType feature, const QUrl &requestingOrigin);
@@ -219,7 +225,6 @@ private:
QScopedPointer<FindTextHelper> m_findTextHelper;
SavePageInfo m_savePageInfo;
QSharedPointer<FilePickerController> m_filePickerController;
- QUrl m_initialTargetUrl;
LoadingState m_loadingState;
bool m_didStartLoadingSeen;
FrameFocusedObserver m_frameFocusedObserver;
diff --git a/src/core/web_contents_view_qt.cpp b/src/core/web_contents_view_qt.cpp
index 1ab09895f..e0070a375 100644
--- a/src/core/web_contents_view_qt.cpp
+++ b/src/core/web_contents_view_qt.cpp
@@ -51,6 +51,8 @@
#include "web_engine_context.h"
#include "web_contents_delegate_qt.h"
+#include "chrome/browser/tab_contents/form_interaction_tab_helper.h"
+#include "components/performance_manager/embedder/performance_manager_registry.h"
#include "components/spellcheck/spellcheck_buildflags.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
@@ -65,6 +67,18 @@
namespace QtWebEngineCore {
+WebContentsViewQt::WebContentsViewQt(content::WebContents *webContents)
+ : m_webContents(webContents)
+ , m_client(nullptr)
+ , m_factoryClient(nullptr)
+ , m_contextMenuRequest(
+ new QWebEngineContextMenuRequest(new QWebEngineContextMenuRequestPrivate()))
+{
+ FormInteractionTabHelper::CreateForWebContents(webContents);
+ if (auto *performance_manager_registry = performance_manager::PerformanceManagerRegistry::GetInstance())
+ performance_manager_registry->CreatePageNodeForWebContents(webContents);
+}
+
void WebContentsViewQt::setFactoryClient(WebContentsAdapterClient* client)
{
if (m_factoryClient)
@@ -122,12 +136,13 @@ gfx::NativeView WebContentsViewQt::GetNativeView() const
return nullptr;
}
-void WebContentsViewQt::GetContainerBounds(gfx::Rect* out) const
+gfx::Rect WebContentsViewQt::GetContainerBounds() const
{
if (m_client) {
const QRectF r(m_client->viewportRect());
- *out = gfx::Rect(r.x(), r.y(), r.width(), r.height());
+ return gfx::Rect(r.x(), r.y(), r.width(), r.height());
}
+ return gfx::Rect();
}
void WebContentsViewQt::Focus()
@@ -147,10 +162,6 @@ void WebContentsViewQt::SetInitialFocus()
void WebContentsViewQt::FocusThroughTabTraversal(bool reverse)
{
content::WebContentsImpl *web_contents = static_cast<content::WebContentsImpl*>(m_webContents);
- if (web_contents->ShowingInterstitialPage()) {
- web_contents->GetInterstitialPage()->FocusThroughTabTraversal(reverse);
- return;
- }
content::RenderWidgetHostView *fullscreen_view = web_contents->GetFullscreenRenderWidgetHostView();
if (fullscreen_view) {
fullscreen_view->Focus();
@@ -204,32 +215,23 @@ ASSERT_ENUMS_MATCH(QWebEngineContextMenuRequest::CanTranslate, blink::kCanTransl
ASSERT_ENUMS_MATCH(QWebEngineContextMenuRequest::CanEditRichly, blink::kCanEditRichly)
-WebContentsViewQt::WebContentsViewQt(content::WebContents* webContents)
-: m_webContents(webContents)
- , m_client(nullptr)
- , m_factoryClient(nullptr)
- , m_contextMenuRequest(
- new QWebEngineContextMenuRequest(new QWebEngineContextMenuRequestPrivate()))
-{ }
-
-
void WebContentsViewQt::update(QWebEngineContextMenuRequest *request,
const content::ContextMenuParams &params, bool spellcheckEnabled)
{
auto *re = request->d.data();
re->m_position = QPoint(params.x, params.y);
re->m_filteredLinkUrl = toQt(params.link_url);
- re->m_linkText = toQt(params.link_text.data());
- re->m_altText = toQt(params.alt_text.data());
- re->m_titleText = toQt(params.title_text.data());
+ re->m_linkText = toQt(params.link_text);
+ re->m_altText = toQt(params.alt_text);
+ re->m_titleText = toQt(params.title_text);
re->m_unfilteredLinkUrl = toQt(params.unfiltered_link_url);
- re->m_selectedText = toQt(params.selection_text.data());
+ re->m_selectedText = toQt(params.selection_text);
re->m_mediaUrl = toQt(params.src_url);
re->m_mediaType = (QWebEngineContextMenuRequest::MediaType)params.media_type;
re->m_hasImageContent = params.has_image_contents;
re->m_mediaFlags = (QWebEngineContextMenuRequest::MediaFlags)params.media_flags;
re->m_editFlags = (QWebEngineContextMenuRequest::EditFlags)params.edit_flags;
- re->m_suggestedFileName = toQt(params.suggested_filename.data());
+ re->m_suggestedFileName = toQt(params.suggested_filename);
re->m_isEditable = params.is_editable;
#if QT_CONFIG(webengine_spellchecker)
re->m_misspelledWord = toQt(params.misspelled_word);
@@ -263,23 +265,23 @@ void WebContentsViewQt::ShowContextMenu(content::RenderFrameHost *,
m_client->contextMenuRequested(m_contextMenuRequest.get());
}
-Qt::DropActions toQtDropActions(blink::WebDragOperationsMask ops)
+static Qt::DropActions toQtDropActions(blink::DragOperationsMask ops)
{
Qt::DropActions result;
- if (ops & blink::kWebDragOperationCopy)
+ if (ops & blink::kDragOperationCopy)
result |= Qt::CopyAction;
- if (ops & blink::kWebDragOperationLink)
+ if (ops & blink::kDragOperationLink)
result |= Qt::LinkAction;
- if (ops & blink::kWebDragOperationMove || ops & blink::kWebDragOperationDelete)
+ if (ops & blink::kDragOperationMove || ops & blink::kDragOperationDelete)
result |= Qt::MoveAction;
return result;
}
void WebContentsViewQt::StartDragging(const content::DropData &drop_data,
- blink::WebDragOperationsMask allowed_ops,
+ blink::DragOperationsMask allowed_ops,
const gfx::ImageSkia &image,
const gfx::Vector2d &image_offset,
- const content::DragEventSourceInfo &event_info,
+ const blink::mojom::DragEventSourceInfo &event_info,
content::RenderWidgetHostImpl* source_rwh)
{
#if QT_CONFIG(draganddrop)
@@ -304,7 +306,7 @@ void WebContentsViewQt::StartDragging(const content::DropData &drop_data,
#endif // QT_CONFIG(draganddrop)
}
-void WebContentsViewQt::UpdateDragCursor(blink::WebDragOperation dragOperation)
+void WebContentsViewQt::UpdateDragCursor(blink::DragOperation dragOperation)
{
#if QT_CONFIG(draganddrop)
m_client->webContentsAdapter()->updateDragAction(dragOperation);
diff --git a/src/core/web_contents_view_qt.h b/src/core/web_contents_view_qt.h
index acf4a1eba..07a78016d 100644
--- a/src/core/web_contents_view_qt.h
+++ b/src/core/web_contents_view_qt.h
@@ -62,6 +62,7 @@ public:
static inline WebContentsViewQt *from(WebContentsView *view) { return static_cast<WebContentsViewQt*>(view); }
WebContentsViewQt(content::WebContents* webContents);
+
void setFactoryClient(WebContentsAdapterClient* client);
void setClient(WebContentsAdapterClient* client);
WebContentsAdapterClient *client() { return m_client; }
@@ -87,9 +88,7 @@ public:
gfx::NativeWindow GetTopLevelNativeWindow() const override { return nullptr; }
- void GetContainerBounds(gfx::Rect* out) const override;
-
- void SizeContents(const gfx::Size& size) override { }
+ gfx::Rect GetContainerBounds() const override;
void Focus() override;
@@ -105,17 +104,17 @@ public:
void FocusThroughTabTraversal(bool reverse) override;
-#if defined(OS_MACOSX)
+#if defined(OS_MAC)
bool CloseTabAfterEventTrackingIfNeeded() override { QT_NOT_YET_IMPLEMENTED return false; }
-#endif // defined(OS_MACOSX)
+#endif // defined(OS_MAC)
// content::RenderViewHostDelegateView overrides:
- void StartDragging(const content::DropData& drop_data, blink::WebDragOperationsMask allowed_ops,
+ void StartDragging(const content::DropData& drop_data, blink::DragOperationsMask allowed_ops,
const gfx::ImageSkia& image, const gfx::Vector2d& image_offset,
- const content::DragEventSourceInfo& event_info,
- content::RenderWidgetHostImpl* source_rwh) override;
+ const blink::mojom::DragEventSourceInfo &event_info,
+ content::RenderWidgetHostImpl *source_rwh) override;
- void UpdateDragCursor(blink::WebDragOperation dragOperation) override;
+ void UpdateDragCursor(blink::DragOperation dragOperation) override;
void ShowContextMenu(content::RenderFrameHost *, const content::ContextMenuParams &params) override;
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index 012a36ae7..5abc305d6 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -59,7 +59,6 @@
#include "components/viz/host/host_frame_sink_manager.h"
#if QT_CONFIG(webengine_printing_and_pdf)
#include "chrome/browser/printing/print_job_manager.h"
-#include "components/printing/browser/features.h"
#endif
#include "components/discardable_memory/service/discardable_shared_memory_manager.h"
#include "components/viz/common/features.h"
@@ -89,10 +88,11 @@
#include "mojo/core/embedder/embedder.h"
#include "net/base/port_util.h"
#include "ppapi/buildflags/buildflags.h"
+#include "sandbox/policy/switches.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/network_switches.h"
#include "services/network/public/mojom/network_context.mojom.h"
-#include "services/service_manager/sandbox/switches.h"
+#include "services/service_manager/switches.h"
#include "services/tracing/public/cpp/trace_startup.h"
#include "services/tracing/public/cpp/tracing_features.h"
#include "third_party/blink/public/common/features.h"
@@ -615,7 +615,7 @@ WebEngineContext::WebEngineContext()
#endif
base::ThreadPoolInstance::Create("Browser");
- m_contentRunner.reset(content::ContentMainRunner::Create());
+ m_contentRunner = content::ContentMainRunner::Create();
m_browserRunner = content::BrowserMainRunner::Create();
#ifdef Q_OS_LINUX
@@ -660,10 +660,10 @@ WebEngineContext::WebEngineContext()
#endif
if (!disable_sandbox) {
#if defined(Q_OS_LINUX)
- parsedCommandLine->AppendSwitch(service_manager::switches::kDisableSetuidSandbox);
+ parsedCommandLine->AppendSwitch(sandbox::policy::switches::kDisableSetuidSandbox);
#endif
} else {
- parsedCommandLine->AppendSwitch(service_manager::switches::kNoSandbox);
+ parsedCommandLine->AppendSwitch(sandbox::policy::switches::kNoSandbox);
qInfo() << "Sandboxing disabled by user.";
}
@@ -708,9 +708,6 @@ WebEngineContext::WebEngineContext()
appendToFeatureList(disableFeatures, features::kWebUsb.name);
appendToFeatureList(disableFeatures, media::kPictureInPicture.name);
- // Breaks current colordialog tests.
- appendToFeatureList(disableFeatures, features::kFormControlsRefresh.name);
-
if (useEmbeddedSwitches) {
// embedded switches are based on the switches for Android, see content/browser/android/content_startup_flags.cc
appendToFeatureList(enableFeatures, features::kOverlayScrollbar.name);
diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp
index 528d25ffa..c5cede929 100644
--- a/src/core/web_engine_library_info.cpp
+++ b/src/core/web_engine_library_info.cpp
@@ -45,9 +45,10 @@
#include "base/files/file_util.h"
#include "components/spellcheck/spellcheck_buildflags.h"
#include "content/public/common/content_paths.h"
+#include "sandbox/policy/switches.h"
#include "ui/base/ui_base_paths.h"
#include "ui/base/ui_base_switches.h"
-#include "services/service_manager/sandbox/switches.h"
+
#include "type_conversion.h"
#include <QByteArray>
@@ -75,7 +76,7 @@ QString fallbackDir() {
return directory;
}
-#if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD)
+#if defined(OS_MAC) && defined(QT_MAC_FRAMEWORK_BUILD)
static inline CFBundleRef frameworkBundle()
{
return CFBundleGetBundleWithIdentifier(CFSTR("org.qt-project.Qt.QtWebEngineCore"));
@@ -118,7 +119,7 @@ static QString getResourcesPath(CFBundleRef frameworkBundle)
}
#endif
-#if defined(OS_MACOSX)
+#if defined(OS_MAC)
static QString getMainApplicationResourcesPath()
{
QString resourcesPath;
@@ -162,7 +163,7 @@ QString subProcessPath()
// Only search in QTWEBENGINEPROCESS_PATH if set
candidatePaths << fromEnv;
} else {
-#if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD)
+#if defined(OS_MAC) && defined(QT_MAC_FRAMEWORK_BUILD)
candidatePaths << getPath(frameworkBundle())
% QStringLiteral("/Helpers/" QTWEBENGINEPROCESS_NAME ".app/Contents/MacOS/" QTWEBENGINEPROCESS_NAME);
#else
@@ -184,7 +185,7 @@ QString subProcessPath()
#if defined(OS_WIN)
base::CommandLine *parsedCommandLine = base::CommandLine::ForCurrentProcess();
- if (!parsedCommandLine->HasSwitch(service_manager::switches::kNoSandbox)) {
+ if (!parsedCommandLine->HasSwitch(sandbox::policy::switches::kNoSandbox)) {
if (WebEngineLibraryInfo::isUNCPath(processPath) || WebEngineLibraryInfo::isRemoteDrivePath(processPath))
qCritical("Can not launch QtWebEngineProcess from network path if sandbox is enabled: %s.", processPath.toUtf8().constData());
}
@@ -200,7 +201,7 @@ QString localesPath()
{
static bool initialized = false;
static QString potentialLocalesPath =
-#if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD)
+#if defined(OS_MAC) && defined(QT_MAC_FRAMEWORK_BUILD)
getResourcesPath(frameworkBundle()) % QLatin1String("/qtwebengine_locales");
#else
QLibraryInfo::path(QLibraryInfo::TranslationsPath) % QDir::separator() % QLatin1String("qtwebengine_locales");
@@ -236,7 +237,7 @@ QString dictionariesPath()
candidatePaths << fromEnv;
} else {
// First try to find dictionaries near the application.
-#ifdef OS_MACOSX
+#ifdef OS_MAC
QString resourcesDictionariesPath = getMainApplicationResourcesPath()
% QDir::separator() % QLatin1String("qtwebengine_dictionaries");
candidatePaths << resourcesDictionariesPath;
@@ -246,7 +247,7 @@ QString dictionariesPath()
candidatePaths << applicationDictionariesPath;
// Then try to find dictionaries near the installed library.
-#if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD)
+#if defined(OS_MAC) && defined(QT_MAC_FRAMEWORK_BUILD)
QString frameworkDictionariesPath = getResourcesPath(frameworkBundle())
% QLatin1String("/qtwebengine_dictionaries");
candidatePaths << frameworkDictionariesPath;
@@ -273,9 +274,9 @@ QString resourcesDataPath()
{
static bool initialized = false;
static QString potentialResourcesPath =
-#if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD)
+#if defined(OS_MAC) && defined(QT_MAC_FRAMEWORK_BUILD)
getResourcesPath(frameworkBundle());
-#elif defined(OS_MACOSX)
+#elif defined(OS_MAC)
QLibraryInfo::location(QLibraryInfo::DataPath) % QLatin1String("/Resources");
#else
QLibraryInfo::path(QLibraryInfo::DataPath) % QLatin1String("/resources");
diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp
index 693c6f6fb..218053e47 100644
--- a/src/core/web_engine_settings.cpp
+++ b/src/core/web_engine_settings.cpp
@@ -49,9 +49,9 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_switches.h"
-#include "content/public/common/web_preferences.h"
#include "media/base/media_switches.h"
#include "third_party/blink/public/common/peerconnection/webrtc_ip_handling_policy.h"
+#include "third_party/blink/public/common/web_preferences/web_preferences.h"
#include "third_party/blink/public/mojom/renderer_preferences.mojom.h"
#include "ui/base/ui_base_switches.h"
#include "ui/events/event_switches.h"
@@ -116,7 +116,7 @@ WebEngineSettings::~WebEngineSettings()
settings->parentSettings = nullptr;
}
-void WebEngineSettings::overrideWebPreferences(content::WebContents *webContents, content::WebPreferences *prefs)
+void WebEngineSettings::overrideWebPreferences(content::WebContents *webContents, blink::web_pref::WebPreferences *prefs)
{
// Apply our settings on top of those.
applySettingsToWebPreferences(prefs);
@@ -124,7 +124,7 @@ void WebEngineSettings::overrideWebPreferences(content::WebContents *webContents
// as the host process already overides some of the default WebPreferences values
// before we get here (e.g. number_of_cpu_cores).
if (webPreferences.isNull())
- webPreferences.reset(new content::WebPreferences(*prefs));
+ webPreferences.reset(new blink::web_pref::WebPreferences(*prefs));
if (webContents
&& applySettingsToRendererPreferences(webContents->GetMutableRendererPrefs())) {
@@ -352,7 +352,7 @@ void WebEngineSettings::doApply()
m_adapter->webContents()->SyncRendererPrefs();
}
-void WebEngineSettings::applySettingsToWebPreferences(content::WebPreferences *prefs)
+void WebEngineSettings::applySettingsToWebPreferences(blink::web_pref::WebPreferences *prefs)
{
// Override for now
prefs->touch_event_feature_detection_enabled = isTouchEventsAPIEnabled();
@@ -396,26 +396,26 @@ void WebEngineSettings::applySettingsToWebPreferences(content::WebPreferences *p
prefs->hide_scrollbars = !testAttribute(QWebEngineSettings::ShowScrollBars);
if (isAttributeExplicitlySet(QWebEngineSettings::PlaybackRequiresUserGesture)) {
prefs->autoplay_policy = testAttribute(QWebEngineSettings::PlaybackRequiresUserGesture)
- ? content::AutoplayPolicy::kUserGestureRequired
- : content::AutoplayPolicy::kNoUserGestureRequired;
+ ? blink::web_pref::AutoplayPolicy::kUserGestureRequired
+ : blink::web_pref::AutoplayPolicy::kNoUserGestureRequired;
}
prefs->dom_paste_enabled = testAttribute(QWebEngineSettings::JavascriptCanPaste);
prefs->dns_prefetching_enabled = testAttribute(QWebEngineSettings::DnsPrefetchEnabled);
// Fonts settings.
- prefs->standard_font_family_map[content::kCommonScript] =
+ prefs->standard_font_family_map[blink::web_pref::kCommonScript] =
toString16(fontFamily(QWebEngineSettings::StandardFont));
- prefs->fixed_font_family_map[content::kCommonScript] =
+ prefs->fixed_font_family_map[blink::web_pref::kCommonScript] =
toString16(fontFamily(QWebEngineSettings::FixedFont));
- prefs->serif_font_family_map[content::kCommonScript] =
+ prefs->serif_font_family_map[blink::web_pref::kCommonScript] =
toString16(fontFamily(QWebEngineSettings::SerifFont));
- prefs->sans_serif_font_family_map[content::kCommonScript] =
+ prefs->sans_serif_font_family_map[blink::web_pref::kCommonScript] =
toString16(fontFamily(QWebEngineSettings::SansSerifFont));
- prefs->cursive_font_family_map[content::kCommonScript] =
+ prefs->cursive_font_family_map[blink::web_pref::kCommonScript] =
toString16(fontFamily(QWebEngineSettings::CursiveFont));
- prefs->fantasy_font_family_map[content::kCommonScript] =
+ prefs->fantasy_font_family_map[blink::web_pref::kCommonScript] =
toString16(fontFamily(QWebEngineSettings::FantasyFont));
- prefs->pictograph_font_family_map[content::kCommonScript] =
+ prefs->pictograph_font_family_map[blink::web_pref::kCommonScript] =
toString16(fontFamily(QWebEngineSettings::PictographFont));
prefs->default_font_size = fontSize(QWebEngineSettings::DefaultFontSize);
prefs->default_fixed_font_size = fontSize(QWebEngineSettings::DefaultFixedFontSize);
diff --git a/src/core/web_engine_settings.h b/src/core/web_engine_settings.h
index 5be72005a..8dc98aae4 100644
--- a/src/core/web_engine_settings.h
+++ b/src/core/web_engine_settings.h
@@ -61,12 +61,15 @@
namespace content {
class WebContents;
-struct WebPreferences;
}
+
namespace blink {
namespace mojom {
class RendererPreferences;
}
+namespace web_pref {
+struct WebPreferences;
+}
}
namespace QtWebEngineCore {
@@ -81,7 +84,7 @@ public:
void setParentSettings(WebEngineSettings *parentSettings);
- void overrideWebPreferences(content::WebContents *webContents, content::WebPreferences *prefs);
+ void overrideWebPreferences(content::WebContents *webContents, blink::web_pref::WebPreferences *prefs);
void setAttribute(QWebEngineSettings::WebAttribute, bool on);
bool testAttribute(QWebEngineSettings::WebAttribute) const;
@@ -111,7 +114,7 @@ public:
private:
void initDefaults();
void doApply();
- void applySettingsToWebPreferences(content::WebPreferences *);
+ void applySettingsToWebPreferences(blink::web_pref::WebPreferences *);
bool applySettingsToRendererPreferences(blink::mojom::RendererPreferences *);
void setWebContentsAdapter(WebContentsAdapter *adapter) { m_adapter = adapter; }
@@ -120,7 +123,7 @@ private:
QHash<QWebEngineSettings::FontFamily, QString> m_fontFamilies;
QHash<QWebEngineSettings::FontSize, int> m_fontSizes;
QString m_defaultEncoding;
- QScopedPointer<content::WebPreferences> webPreferences;
+ QScopedPointer<blink::web_pref::WebPreferences> webPreferences;
QTimer m_batchTimer;
WebEngineSettings *parentSettings;
diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp
index ca2f13a06..593acb5e5 100644
--- a/src/core/web_event_factory.cpp
+++ b/src/core/web_event_factory.cpp
@@ -1406,36 +1406,36 @@ static WebInputEvent::Type webEventTypeForEvent(const QEvent* event)
switch (event->type()) {
case QEvent::MouseButtonPress:
case QEvent::TabletPress:
- return WebInputEvent::kMouseDown;
+ return WebInputEvent::Type::kMouseDown;
case QEvent::MouseButtonRelease:
case QEvent::TabletRelease:
- return WebInputEvent::kMouseUp;
+ return WebInputEvent::Type::kMouseUp;
case QEvent::Enter:
- return WebInputEvent::kMouseEnter;
+ return WebInputEvent::Type::kMouseEnter;
case QEvent::Leave:
- return WebInputEvent::kMouseLeave;
+ return WebInputEvent::Type::kMouseLeave;
case QEvent::MouseMove:
case QEvent::TabletMove:
- return WebInputEvent::kMouseMove;
+ return WebInputEvent::Type::kMouseMove;
case QEvent::Wheel:
- return WebInputEvent::kMouseWheel;
+ return WebInputEvent::Type::kMouseWheel;
case QEvent::KeyPress:
- return WebInputEvent::kRawKeyDown;
+ return WebInputEvent::Type::kRawKeyDown;
case QEvent::KeyRelease:
- return WebInputEvent::kKeyUp;
+ return WebInputEvent::Type::kKeyUp;
case QEvent::HoverMove:
- return WebInputEvent::kMouseMove;
+ return WebInputEvent::Type::kMouseMove;
case QEvent::TouchBegin:
- return WebInputEvent::kTouchStart;
+ return WebInputEvent::Type::kTouchStart;
case QEvent::TouchUpdate:
- return WebInputEvent::kTouchMove;
+ return WebInputEvent::Type::kTouchMove;
case QEvent::TouchEnd:
- return WebInputEvent::kTouchEnd;
+ return WebInputEvent::Type::kTouchEnd;
case QEvent::TouchCancel:
- return WebInputEvent::kTouchCancel;
+ return WebInputEvent::Type::kTouchCancel;
default:
Q_ASSERT(false);
- return WebInputEvent::kMouseMove;
+ return WebInputEvent::Type::kMouseMove;
}
}
@@ -1514,7 +1514,7 @@ WebMouseEvent WebEventFactory::toWebMouseEvent(QEvent *ev)
WebMouseEvent webKitEvent;
webKitEvent.SetTimeStamp(base::TimeTicks::Now());
- webKitEvent.SetType(WebInputEvent::kMouseLeave);
+ webKitEvent.SetType(WebInputEvent::Type::kMouseLeave);
return webKitEvent;
}
@@ -1536,11 +1536,11 @@ WebGestureEvent WebEventFactory::toWebGestureEvent(QNativeGestureEvent *ev)
Qt::NativeGestureType gestureType = ev->gestureType();
switch (gestureType) {
case Qt::ZoomNativeGesture:
- webKitEvent.SetType(WebInputEvent::kGesturePinchUpdate);
+ webKitEvent.SetType(WebInputEvent::Type::kGesturePinchUpdate);
webKitEvent.data.pinch_update.scale = static_cast<float>(ev->value() + 1.0);
break;
case Qt::SmartZoomNativeGesture:
- webKitEvent.SetType(WebInputEvent::kGestureDoubleTap);
+ webKitEvent.SetType(WebInputEvent::Type::kGestureDoubleTap);
webKitEvent.data.tap.tap_count = 1;
break;
case Qt::BeginNativeGesture:
@@ -1549,7 +1549,7 @@ WebGestureEvent WebEventFactory::toWebGestureEvent(QNativeGestureEvent *ev)
case Qt::PanNativeGesture:
case Qt::SwipeNativeGesture:
// Not implemented by Chromium for now.
- webKitEvent.SetType(blink::WebInputEvent::kUndefined);
+ webKitEvent.SetType(blink::WebInputEvent::Type::kUndefined);
break;
}
@@ -1665,7 +1665,7 @@ static QPointF toQt(gfx::PointF p)
void WebEventFactory::sendUnhandledWheelEvent(const blink::WebGestureEvent &event,
RenderWidgetHostViewQtDelegate *delegate)
{
- Q_ASSERT(event.GetType() == blink::WebInputEvent::kGestureScrollUpdate);
+ Q_ASSERT(event.GetType() == blink::WebInputEvent::Type::kGestureScrollUpdate);
QWheelEvent ev(toQt(event.PositionInWidget()),
toQt(event.PositionInScreen()),