diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-05-09 17:25:22 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-06-26 08:17:30 +0000 |
commit | 7757ec1a562ae36b65a6cae93b3cd308247755ef (patch) | |
tree | 9da058ac021019317111dd1ad90c0a4a32529afe | |
parent | 57c49df9c6fcbaaffc66900e191312d4e0a0edfa (diff) |
Adaptations for Chromium 67
Change-Id: I13cedba56012f74651a044d6fa8f0957487bf3eb
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
76 files changed, 605 insertions, 548 deletions
diff --git a/mkspecs/features/platform.prf b/mkspecs/features/platform.prf index 33b71b231..41dbecd10 100644 --- a/mkspecs/features/platform.prf +++ b/mkspecs/features/platform.prf @@ -38,8 +38,9 @@ defineTest(isPlatformSupported) { return(false) } } else:osx { - lessThan(QMAKE_XCODE_VERSION, 7.3) { - skipBuild("Using Xcode version $$QMAKE_XCODE_VERSION, but at least version 7.3 is required to build Qt WebEngine.") + # FIXME: Try to get it back down to 8.2 for building on OS X 10.11 + lessThan(QMAKE_XCODE_VERSION, 9.0) { + skipBuild("Using Xcode version $$QMAKE_XCODE_VERSION, but at least version 9.0 is required to build Qt WebEngine.") return(false) } !clang|intel_icc { diff --git a/src/3rdparty b/src/3rdparty -Subproject 96f354df27c2f3c7c1b221b676c7a1af6b3da37 +Subproject ae30ba94d1c9ceb608dd699acf7e7f8a62d41df diff --git a/src/core/api/core_api.pro b/src/core/api/core_api.pro index bda6bf51c..1d66b47d0 100644 --- a/src/core/api/core_api.pro +++ b/src/core/api/core_api.pro @@ -22,7 +22,9 @@ DEFINES += \ NOMINMAX CHROMIUM_SRC_DIR = $$QTWEBENGINE_ROOT/$$getChromiumSrcDir() +CHROMIUM_GEN_DIR = $$OUT_PWD/../$$getConfigDir()/gen INCLUDEPATH += $$QTWEBENGINE_ROOT/src/core \ + $$CHROMIUM_GEN_DIR \ $$CHROMIUM_SRC_DIR linux-g++*: QMAKE_CXXFLAGS += -Wno-unused-parameter diff --git a/src/core/authentication_dialog_controller.cpp b/src/core/authentication_dialog_controller.cpp index 2f70ea923..bd23d1768 100644 --- a/src/core/authentication_dialog_controller.cpp +++ b/src/core/authentication_dialog_controller.cpp @@ -44,7 +44,7 @@ namespace QtWebEngineCore { -AuthenticationDialogControllerPrivate::AuthenticationDialogControllerPrivate(ResourceDispatcherHostLoginDelegateQt *loginDelegate) +AuthenticationDialogControllerPrivate::AuthenticationDialogControllerPrivate(LoginDelegateQt *loginDelegate) : loginDelegate(loginDelegate) { } @@ -53,7 +53,7 @@ void AuthenticationDialogControllerPrivate::dialogFinished(bool accepted, const { content::BrowserThread::PostTask( content::BrowserThread::IO, FROM_HERE, - base::Bind(&ResourceDispatcherHostLoginDelegateQt::sendAuthToRequester, loginDelegate, accepted, user, password)); + base::Bind(&LoginDelegateQt::sendAuthToRequester, loginDelegate, accepted, user, password)); } AuthenticationDialogController::AuthenticationDialogController(AuthenticationDialogControllerPrivate *dd) diff --git a/src/core/authentication_dialog_controller.h b/src/core/authentication_dialog_controller.h index 4771ffcd7..aec91aac5 100644 --- a/src/core/authentication_dialog_controller.h +++ b/src/core/authentication_dialog_controller.h @@ -77,7 +77,7 @@ private: AuthenticationDialogController(AuthenticationDialogControllerPrivate *); QScopedPointer<AuthenticationDialogControllerPrivate> d; - friend class ResourceDispatcherHostLoginDelegateQt; + friend class LoginDelegateQt; }; } // namespace QtWebEngineCore diff --git a/src/core/authentication_dialog_controller_p.h b/src/core/authentication_dialog_controller_p.h index af5d92530..16069b9b1 100644 --- a/src/core/authentication_dialog_controller_p.h +++ b/src/core/authentication_dialog_controller_p.h @@ -42,17 +42,17 @@ #include "base/memory/ref_counted.h" -#include "renderer_host/resource_dispatcher_host_delegate_qt.h" +#include "login_delegate_qt.h" namespace QtWebEngineCore { class AuthenticationDialogControllerPrivate { public: - AuthenticationDialogControllerPrivate(ResourceDispatcherHostLoginDelegateQt *loginDelegate); + AuthenticationDialogControllerPrivate(LoginDelegateQt *loginDelegate); void dialogFinished(bool accepted, const QString &user = QString(), const QString &password = QString()); - scoped_refptr<ResourceDispatcherHostLoginDelegateQt> loginDelegate; + scoped_refptr<LoginDelegateQt> loginDelegate; }; } // namespace QtWebEngineCore diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp index a73fa4fcd..5ec84affb 100644 --- a/src/core/browser_accessibility_qt.cpp +++ b/src/core/browser_accessibility_qt.cpp @@ -478,10 +478,6 @@ QAccessible::State BrowserAccessibilityQt::state() const {} // FIXME if (HasState(ax::mojom::State::kRichlyEditable)) {} // FIXME - if (HasState(ax::mojom::State::kSelectable)) - state.selectable = true; - if (HasState(ax::mojom::State::kSelected)) - state.selected = true; if (HasState(ax::mojom::State::kVertical)) {} // FIXME if (HasState(ax::mojom::State::kVisited)) @@ -493,6 +489,10 @@ QAccessible::State BrowserAccessibilityQt::state() const state.focused = true; if (GetBoolAttribute(ax::mojom::BoolAttribute::kBusy)) state.busy = true; + if (HasBoolAttribute(ax::mojom::BoolAttribute::kSelected)) { + state.selectable = true; + state.selected = GetBoolAttribute(ax::mojom::BoolAttribute::kSelected); + } if (HasIntAttribute(ax::mojom::IntAttribute::kCheckedState)) { const ax::mojom::CheckedState checkedState = static_cast<ax::mojom::CheckedState>(GetIntAttribute(ax::mojom::IntAttribute::kCheckedState)); diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp index 81e0b1a44..85e0a1bb1 100644 --- a/src/core/browser_context_adapter.cpp +++ b/src/core/browser_context_adapter.cpp @@ -293,7 +293,7 @@ void BrowserContextAdapter::setHttpUserAgent(const QString &userAgent) std::vector<content::WebContentsImpl *> list = content::WebContentsImpl::GetAllWebContents(); for (content::WebContentsImpl *web_contents : list) if (web_contents->GetBrowserContext() == m_browserContext.data()) - web_contents->SetUserAgentOverride(m_httpUserAgent.toStdString()); + web_contents->SetUserAgentOverride(m_httpUserAgent.toStdString(), true); if (m_browserContext->m_urlRequestContextGetter.get()) m_browserContext->m_profileIOData->updateUserAgent(); diff --git a/src/core/browser_message_filter_qt.cpp b/src/core/browser_message_filter_qt.cpp index 330bba3a9..d4fdc4122 100644 --- a/src/core/browser_message_filter_qt.cpp +++ b/src/core/browser_message_filter_qt.cpp @@ -71,39 +71,11 @@ bool BrowserMessageFilterQt::OnMessageReceived(const IPC::Message& message) IPC_MESSAGE_HANDLER(QtWebEngineHostMsg_RequestFileSystemAccessAsync, OnRequestFileSystemAccessAsync) IPC_MESSAGE_HANDLER(QtWebEngineHostMsg_AllowIndexedDB, OnAllowIndexedDB) -#if BUILDFLAG(ENABLE_LIBRARY_CDMS) - IPC_MESSAGE_HANDLER( - QtWebEngineHostMsg_IsInternalPluginAvailableForMimeType, - OnIsInternalPluginAvailableForMimeType) -#endif IPC_MESSAGE_UNHANDLED(return false) IPC_END_MESSAGE_MAP() return true; } -#if BUILDFLAG(ENABLE_LIBRARY_CDMS) -void BrowserMessageFilterQt::OnIsInternalPluginAvailableForMimeType( - const std::string& mime_type, - base::Optional<std::vector<content::WebPluginMimeType::Param>> *opt_additional_params) -{ - std::vector<content::WebPluginInfo> plugins; - content::PluginService::GetInstance()->GetInternalPlugins(&plugins); - - for (size_t i = 0; i < plugins.size(); ++i) { - const content::WebPluginInfo& plugin = plugins[i]; - const std::vector<content::WebPluginMimeType>& mime_types = plugin.mime_types; - for (size_t j = 0; j < mime_types.size(); ++j) { - if (mime_types[j].mime_type == mime_type) { - *opt_additional_params = base::make_optional(mime_types[j].additional_params); - return; - } - } - } -} - -#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) - - void BrowserMessageFilterQt::OnAllowDatabase(int /*render_frame_id*/, const GURL &origin_url, const GURL &top_origin_url, diff --git a/src/core/browser_message_filter_qt.h b/src/core/browser_message_filter_qt.h index c05da7944..8b22ab6ac 100644 --- a/src/core/browser_message_filter_qt.h +++ b/src/core/browser_message_filter_qt.h @@ -43,7 +43,6 @@ #include "base/callback.h" #include "content/public/browser/browser_message_filter.h" #include "content/public/common/webplugininfo.h" -#include "media/media_features.h" class GURL; class Profile; @@ -57,18 +56,6 @@ public: private: bool OnMessageReceived(const IPC::Message& message) override; -#if BUILDFLAG(ENABLE_LIBRARY_CDMS) - // Returns whether any internal plugin supporting |mime_type| is registered - // and enabled. Does not determine whether the plugin can actually be - // instantiated (e.g. whether it has all its dependencies). - // When the returned *|is_available| is true, |additional_param_names| and - // |additional_param_values| contain the name-value pairs, if any, specified - // for the *first* non-disabled plugin found that is registered for - // |mime_type|. - void OnIsInternalPluginAvailableForMimeType( - const std::string& mime_type, - base::Optional<std::vector<content::WebPluginMimeType::Param>> *opt_additional_params); -#endif void OnAllowDatabase(int render_frame_id, const GURL &origin_url, diff --git a/src/core/chromium_overrides.cpp b/src/core/chromium_overrides.cpp index 8f6687ff3..23e4ae235 100644 --- a/src/core/chromium_overrides.cpp +++ b/src/core/chromium_overrides.cpp @@ -51,7 +51,7 @@ #include "ui/base/dragdrop/os_exchange_data_provider_factory.h" #include "ui/events/devices/device_data_manager.h" #include "ui/events/platform/platform_event_source.h" -#include "ppapi/features/features.h" +#include "ppapi/buildflags/buildflags.h" #include <QGuiApplication> #include <QScreen> @@ -111,7 +111,7 @@ public: }; std::unique_ptr<PlatformEventSource> PlatformEventSource::CreateDefault() { - return base::MakeUnique<DummyPlatformEventSource>(); + return std::make_unique<DummyPlatformEventSource>(); } } // namespace ui #endif // defined(USE_X11) @@ -196,14 +196,3 @@ std::unique_ptr<ui::OSExchangeData::Provider> ui::OSExchangeDataProviderFactory::CreateProvider() { return nullptr; } - -#if defined(USE_OPENSSL_CERTS) -namespace net { - -scoped_refptr<SSLPrivateKey> FetchClientCertPrivateKey(const X509Certificate* certificate) -{ - return OpenSSLClientKeyStore::GetInstance()->FetchClientCertPrivateKey(certificate); -} - -} // namespace net -#endif diff --git a/src/core/common/qt_ipc_logging.cpp b/src/core/common/qt_ipc_logging.cpp index f2a00b23c..83eb5a5ad 100644 --- a/src/core/common/qt_ipc_logging.cpp +++ b/src/core/common/qt_ipc_logging.cpp @@ -37,7 +37,7 @@ ** ****************************************************************************/ -#include "ipc/ipc_features.h" // Generated buildflag header +#include "ipc/ipc_buildflags.h" // Generated buildflag header #if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED) #define IPC_MESSAGE_MACROS_LOG_ENABLED diff --git a/src/core/common/qt_messages.h b/src/core/common/qt_messages.h index c5caa0fff..4fc0819e3 100644 --- a/src/core/common/qt_messages.h +++ b/src/core/common/qt_messages.h @@ -5,11 +5,10 @@ // Multiply-included file, no traditional include guard. #include "base/optional.h" -#include "media/media_features.h" #include "content/public/common/common_param_traits.h" #include "content/public/common/webplugininfo.h" #include "ipc/ipc_message_macros.h" -#include "ppapi/features/features.h" +#include "ppapi/buildflags/buildflags.h" #include "user_script_data.h" IPC_STRUCT_TRAITS_BEGIN(UserScriptData) @@ -80,18 +79,6 @@ IPC_MESSAGE_ROUTED1(WebChannelIPCTransportHost_SendMessage, std::vector<char> /* // Misc messages // These are messages sent from the renderer to the browser process. -#if BUILDFLAG(ENABLE_LIBRARY_CDMS) -// Returns whether any internal plugin supporting |mime_type| is registered and -// enabled. Does not determine whether the plugin can actually be instantiated -// (e.g. whether it has all its dependencies). -// When the returned *|is_available| is true, |additional_param_names| and -// |additional_param_values| contain the name-value pairs, if any, specified -// for the *first* non-disabled plugin found that is registered for |mime_type|. -IPC_SYNC_MESSAGE_CONTROL1_1(QtWebEngineHostMsg_IsInternalPluginAvailableForMimeType, - std::string /* mime_type */, - base::Optional<std::vector<content::WebPluginMimeType::Param>>) -#endif - // Sent by the renderer process to check whether access to web databases is // granted by content settings. IPC_SYNC_MESSAGE_CONTROL5_1(QtWebEngineHostMsg_AllowDatabase, diff --git a/src/core/config/common.pri b/src/core/config/common.pri index 0acae8ed0..48aafff1f 100644 --- a/src/core/config/common.pri +++ b/src/core/config/common.pri @@ -10,6 +10,7 @@ gn_args += \ enable_remoting=false \ enable_reporting=false \ enable_web_speech=false \ + enable_widevine=true \ use_allocator_shim=false \ use_allocator=\"none\" \ v8_use_external_startup_data=false \ @@ -31,9 +32,9 @@ qtConfig(webengine-printing-and-pdf) { } qtConfig(webengine-pepper-plugins) { - gn_args += enable_plugins=true enable_widevine=true + gn_args += enable_plugins=true } else { - gn_args += enable_plugins=false enable_widevine=false + gn_args += enable_plugins=false } qtConfig(webengine-spellchecker) { diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri index bfeec4d2b..02040122b 100644 --- a/src/core/config/linux.pri +++ b/src/core/config/linux.pri @@ -10,8 +10,6 @@ gn_args += \ use_udev=true \ use_bundled_fontconfig=false -gcc:!clang: greaterThan(QT_GCC_MAJOR_VERSION, 5): gn_args += no_delete_null_pointer_checks=true - clang { clang_full_path = $$which($${QMAKE_CXX}) # Remove the "/bin/clang++" part. diff --git a/src/core/configure.json b/src/core/configure.json index f933ceb5a..778daf320 100644 --- a/src/core/configure.json +++ b/src/core/configure.json @@ -479,7 +479,7 @@ }, "webengine-pepper-plugins": { "label": "Pepper Plugins", - "purpose": "Enables use of Pepper Flash and Widevine plugins.", + "purpose": "Enables use of Pepper Flash plugins.", "section": "WebEngine", "autoDetect": "!features.webengine-embedded-build", "output": [ "privateFeature" ] diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 4ff93b901..4004adb95 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -43,7 +43,7 @@ #include "base/memory/ptr_util.h" #include "base/message_loop/message_loop.h" #include "base/threading/thread_restrictions.h" -#include "components/spellcheck/spellcheck_build_features.h" +#include "components/spellcheck/spellcheck_buildflags.h" #if BUILDFLAG(ENABLE_SPELLCHECK) #include "chrome/browser/spellchecker/spell_check_host_chrome_impl.h" #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) @@ -61,6 +61,7 @@ #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/resource_dispatcher_host.h" +#include "content/public/browser/resource_dispatcher_host_delegate.h" #include "content/public/browser/storage_partition.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_user_data.h" @@ -70,13 +71,14 @@ #include "content/public/common/service_names.mojom.h" #include "content/public/common/url_constants.h" #include "device/geolocation/public/cpp/location_provider.h" +#include "media/media_buildflags.h" #include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/binding_set.h" -#include "printing/features/features.h" +#include "printing/buildflags/buildflags.h" #include "net/ssl/client_cert_identity.h" #include "services/service_manager/public/cpp/connector.h" #include "services/service_manager/public/cpp/service.h" -#include "third_party/WebKit/public/platform/modules/insecure_input/insecure_input_service.mojom.h" +#include "third_party/blink/public/platform/modules/insecure_input/insecure_input_service.mojom.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_switches.h" #include "ui/display/screen.h" @@ -94,6 +96,7 @@ #include "certificate_error_controller_p.h" #include "desktop_screen_qt.h" #include "devtools_manager_delegate_qt.h" +#include "login_delegate_qt.h" #include "media_capture_devices_dispatcher.h" #include "net/network_delegate_qt.h" #include "net/qrc_protocol_handler_qt.h" @@ -103,8 +106,8 @@ #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) #include "profile_qt.h" #include "quota_permission_context_qt.h" -#include "renderer_host/resource_dispatcher_host_delegate_qt.h" #include "renderer_host/user_resource_controller_host.h" +#include "type_conversion.h" #include "web_contents_delegate_qt.h" #include "web_engine_context.h" #include "web_engine_library_info.h" @@ -420,7 +423,7 @@ void ContentBrowserClientQt::RenderProcessWillLaunch(content::RenderProcessHost* void ContentBrowserClientQt::ResourceDispatcherHostCreated() { - m_resourceDispatcherHostDelegate.reset(new ResourceDispatcherHostDelegateQt); + m_resourceDispatcherHostDelegate.reset(new content::ResourceDispatcherHostDelegate); content::ResourceDispatcherHost::Get()->SetDelegate(m_resourceDispatcherHostDelegate.get()); } @@ -624,8 +627,8 @@ private: void ContentBrowserClientQt::InitFrameInterfaces() { - m_frameInterfaces = base::MakeUnique<service_manager::BinderRegistry>(); - m_frameInterfacesParameterized = base::MakeUnique<service_manager::BinderRegistryWithArgs<content::RenderFrameHost*>>(); + m_frameInterfaces = std::make_unique<service_manager::BinderRegistry>(); + m_frameInterfacesParameterized = std::make_unique<service_manager::BinderRegistryWithArgs<content::RenderFrameHost*>>(); m_frameInterfacesParameterized->AddInterface(base::Bind(&ServiceDriver::BindInsecureInputService)); } @@ -803,7 +806,45 @@ bool ContentBrowserClientQt::AllowWorkerIndexedDB(const GURL &url, return networkDelegate->canSetCookies(url, url, std::string()); } -content::ResourceDispatcherHostLoginDelegate *ContentBrowserClientQt::CreateLoginDelegate( +static void LaunchURL(const GURL& url, + const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter, + ui::PageTransition page_transition, bool is_main_frame, bool has_user_gesture) +{ + Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); + content::WebContents* webContents = web_contents_getter.Run(); + if (!webContents) + return; + WebContentsDelegateQt *contentsDelegate = static_cast<WebContentsDelegateQt*>(webContents->GetDelegate()); + contentsDelegate->launchExternalURL(toQt(url), page_transition, is_main_frame, has_user_gesture); +} + + +bool ContentBrowserClientQt::HandleExternalProtocol( + const GURL &url, + content::ResourceRequestInfo::WebContentsGetter web_contents_getter, + int child_id, + content::NavigationUIData *navigation_data, + bool is_main_frame, + ui::PageTransition page_transition, + bool has_user_gesture) +{ + Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); + Q_UNUSED(child_id); + Q_UNUSED(navigation_data); + + content::BrowserThread::PostTask( + content::BrowserThread::UI, + FROM_HERE, + base::BindOnce(&LaunchURL, + url, + web_contents_getter, + page_transition, + is_main_frame, + has_user_gesture)); + return true; +} + +scoped_refptr<content::LoginDelegate> ContentBrowserClientQt::CreateLoginDelegate( net::AuthChallengeInfo *authInfo, content::ResourceRequestInfo::WebContentsGetter web_contents_getter, bool /*is_main_frame*/, @@ -811,7 +852,7 @@ content::ResourceDispatcherHostLoginDelegate *ContentBrowserClientQt::CreateLogi bool first_auth_attempt, const base::Callback<void(const base::Optional<net::AuthCredentials>&)>&auth_required_callback) { - return new ResourceDispatcherHostLoginDelegateQt(authInfo, web_contents_getter, url, first_auth_attempt, auth_required_callback); + return base::MakeRefCounted<LoginDelegateQt>(authInfo, web_contents_getter, url, first_auth_attempt, auth_required_callback); } } // namespace QtWebEngineCore diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h index 4c1d4990c..540774fab 100644 --- a/src/core/content_browser_client_qt.h +++ b/src/core/content_browser_client_qt.h @@ -42,7 +42,7 @@ #include "base/memory/ref_counted.h" #include "content/public/browser/content_browser_client.h" -#include "ppapi/features/features.h" +#include "ppapi/buildflags/buildflags.h" #include <QtGlobal> @@ -63,6 +63,7 @@ class RenderFrameHost; class RenderProcessHost; class RenderViewHostDelegateView; class ResourceContext; +class ResourceDispatcherHostDelegate; class WebContentsViewPort; class WebContents; struct MainFunctionParams; @@ -77,7 +78,6 @@ namespace QtWebEngineCore { class BrowserMainPartsQt; class ProfileQt; -class ResourceDispatcherHostDelegateQt; class ShareGroupQtQuick; class ContentBrowserClientQt : public content::ContentBrowserClient { @@ -181,18 +181,26 @@ public: void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override; #endif - content::ResourceDispatcherHostLoginDelegate *CreateLoginDelegate( + scoped_refptr<content::LoginDelegate> CreateLoginDelegate( net::AuthChallengeInfo *auth_info, content::ResourceRequestInfo::WebContentsGetter web_contents_getter, bool is_main_frame, const GURL &url, bool first_auth_attempt, const base::Callback<void(const base::Optional<net::AuthCredentials>&)>&auth_required_callback) override; + bool HandleExternalProtocol( + const GURL &url, + content::ResourceRequestInfo::WebContentsGetter web_contents_getter, + int child_id, + content::NavigationUIData *navigation_data, + bool is_main_frame, + ui::PageTransition page_transition, + bool has_user_gesture) override; private: void InitFrameInterfaces(); BrowserMainPartsQt* m_browserMainParts; - std::unique_ptr<ResourceDispatcherHostDelegateQt> m_resourceDispatcherHostDelegate; + std::unique_ptr<content::ResourceDispatcherHostDelegate> m_resourceDispatcherHostDelegate; scoped_refptr<ShareGroupQtQuick> m_shareGroupQtQuick; std::unique_ptr<service_manager::BinderRegistry> m_frameInterfaces; std::unique_ptr<service_manager::BinderRegistryWithArgs<content::RenderFrameHost*>> m_frameInterfacesParameterized; diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index 584d6c0aa..46e1fa241 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -45,8 +45,13 @@ #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" +#include "base/version.h" +#include "content/public/common/cdm_info.h" #include "content/public/common/content_constants.h" #include "content/public/common/user_agent.h" +#include "media/base/media_switches.h" +#include "media/base/video_codecs.h" +#include "media/media_buildflags.h" #include "ui/base/layout.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" @@ -59,6 +64,42 @@ #include <QLibraryInfo> #include <QString> +#if BUILDFLAG(ENABLE_LIBRARY_CDMS) +#include "media/cdm/cdm_paths.h" // nogncheck +#include "third_party/widevine/cdm/widevine_cdm_common.h" +#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. +#define WIDEVINE_CDM_AVAILABLE +#if defined(WIDEVINE_CDM_AVAILABLE) && !defined(WIDEVINE_CDM_IS_COMPONENT) +#define WIDEVINE_CDM_AVAILABLE_NOT_COMPONENT +namespace switches { +const char kCdmWidevinePath[] = "widevine-path"; +} +// File name of the CDM on different platforms. +const char kWidevineCdmFileName[] = +#if defined(OS_MACOSX) + "widevinecdm.plugin"; +#elif defined(OS_WIN) + "widevinecdm.dll"; +#else // OS_LINUX, etc. + "libwidevinecdm.so"; +#endif +#endif + +static QString webenginePluginsPath() +{ + // Look for plugins in /plugins/webengine or application dir. + static bool initialized = false; + static QString potentialPluginsPath = QLibraryInfo::location(QLibraryInfo::PluginsPath) % QLatin1String("/webengine"); + if (!initialized) { + initialized = true; + if (!QFileInfo::exists(potentialPluginsPath)) + potentialPluginsPath = QCoreApplication::applicationDirPath(); + } + return potentialPluginsPath; +} +#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) + + #if defined(Q_OS_WIN) #include <shlobj.h> static QString getLocalAppDataDir() @@ -81,8 +122,6 @@ static QString getLocalAppDataDir() #include "content/public/common/pepper_plugin_info.h" #include "ppapi/shared_impl/ppapi_permissions.h" -#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. - static const int32_t kPepperFlashPermissions = ppapi::PERMISSION_DEV | ppapi::PERMISSION_PRIVATE | ppapi::PERMISSION_BYPASS_USER_GESTURE | @@ -94,18 +133,6 @@ const char kPpapiFlashVersion[] = "ppapi-flash-version"; const char kPpapiWidevinePath[] = "ppapi-widevine-path"; } -const char kCdmSupportedCodecsParamName[] = "codecs"; -const char kCdmSupportedCodecVp8[] = "vp8"; -const char kCdmSupportedCodecVp9[] = "vp9.0"; -#if BUILDFLAG(USE_PROPRIETARY_CODECS) -const char kCdmSupportedCodecAvc1[] = "avc1"; -#endif - -static const char kWidevineCdmPluginExtension[] = ""; - -static const int32_t kWidevineCdmPluginPermissions = ppapi::PERMISSION_DEV - | ppapi::PERMISSION_PRIVATE; - static QString ppapiPluginsPath() { // Look for plugins in /plugins/ppapi or application dir. @@ -208,22 +235,40 @@ void AddPepperFlashFromCommandLine(std::vector<content::PepperPluginInfo>* plugi plugins->push_back(CreatePepperFlashInfo(base::FilePath(flash_path), flash_version)); } -void AddPepperWidevine(std::vector<content::PepperPluginInfo>* plugins) +namespace QtWebEngineCore { + +void ContentClientQt::AddPepperPlugins(std::vector<content::PepperPluginInfo>* plugins) +{ + AddPepperFlashFromSystem(plugins); + AddPepperFlashFromCommandLine(plugins); +} + +} // namespace QtWebEngineCore +#endif // BUILDFLAG(ENABLE_PLUGINS) + +namespace QtWebEngineCore { + +#if defined(WIDEVINE_CDM_AVAILABLE_NOT_COMPONENT) +static bool IsWidevineAvailable(base::FilePath *cdm_path, + std::vector<media::VideoCodec> *codecs_supported, + bool *supports_persistent_license) { -#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_LIBRARY_CDMS) && !defined(WIDEVINE_CDM_IS_COMPONENT) QStringList pluginPaths; - const base::CommandLine::StringType widevine_argument = base::CommandLine::ForCurrentProcess()->GetSwitchValueNative(switches::kPpapiWidevinePath); + const base::CommandLine::StringType widevine_argument = base::CommandLine::ForCurrentProcess()->GetSwitchValueNative(switches::kCdmWidevinePath); if (!widevine_argument.empty()) pluginPaths << QtWebEngineCore::toQt(widevine_argument); else { - pluginPaths << ppapiPluginsPath() + QStringLiteral("/") + QString::fromLatin1(kWidevineCdmAdapterFileName); + pluginPaths << webenginePluginsPath() + QStringLiteral("/") + QString::fromLatin1(kWidevineCdmFileName); +#if BUILDFLAG(ENABLE_PLUGINS) + pluginPaths << ppapiPluginsPath() + QStringLiteral("/") + QString::fromLatin1(kWidevineCdmFileName); +#endif #if defined(Q_OS_OSX) QDir potentialWidevineDir(QDir::homePath() + "/Library/Application Support/Google/Chrome/WidevineCDM"); if (potentialWidevineDir.exists()) { QFileInfoList widevineVersionDirs = potentialWidevineDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Reversed); for (int i = 0; i < widevineVersionDirs.size(); ++i) { QString versionDirPath(widevineVersionDirs.at(i).absoluteFilePath()); - QString potentialWidevinePluginPath = versionDirPath + "/_platform_specific/mac_x64/" + QString::fromLatin1(kWidevineCdmAdapterFileName); + QString potentialWidevinePluginPath = versionDirPath + "/_platform_specific/mac_x64/" + QString::fromLatin1(kWidevineCdmFileName); pluginPaths << potentialWidevinePluginPath; } } @@ -234,71 +279,93 @@ void AddPepperWidevine(std::vector<content::PepperPluginInfo>* plugins) for (int i = 0; i < widevineVersionDirs.size(); ++i) { QString versionDirPath(widevineVersionDirs.at(i).absoluteFilePath()); #ifdef WIN64 - QString potentialWidevinePluginPath = versionDirPath + "/_platform_specific/win_x64/" + QString::fromLatin1(kWidevineCdmAdapterFileName); + QString potentialWidevinePluginPath = versionDirPath + "/_platform_specific/win_x64/" + QString::fromLatin1(kWidevineCdmFileName); #else - QString potentialWidevinePluginPath = versionDirPath + "/_platform_specific/win_x86/" + QString::fromLatin1(kWidevineCdmAdapterFileName); + QString potentialWidevinePluginPath = versionDirPath + "/_platform_specific/win_x86/" + QString::fromLatin1(kWidevineCdmFileName); #endif pluginPaths << potentialWidevinePluginPath; } } #elif defined(Q_OS_LINUX) - pluginPaths << QStringLiteral("/opt/google/chrome/libwidevinecdmadapter.so") // Google Chrome - << QStringLiteral("/usr/lib/chromium/libwidevinecdmadapter.so") // Arch - << QStringLiteral("/usr/lib/chromium-browser/libwidevinecdmadapter.so") // Ubuntu/neon - << QStringLiteral("/usr/lib64/chromium/libwidevinecdmadapter.so"); // OpenSUSE style + pluginPaths << QStringLiteral("/opt/google/chrome/libwidevinecdm.so") // Google Chrome + << QStringLiteral("/usr/lib/chromium/libwidevinecdm.so") // Arch + << QStringLiteral("/usr/lib/chromium-browser/libwidevinecdm.so") // Ubuntu/neon + << QStringLiteral("/usr/lib64/chromium/libwidevinecdm.so"); // OpenSUSE style #endif } for (const QString &pluginPath : qAsConst(pluginPaths)) { - base::FilePath path = QtWebEngineCore::toFilePath(pluginPath); - if (base::PathExists(path)) { - content::PepperPluginInfo widevine_cdm; - widevine_cdm.is_out_of_process = true; - widevine_cdm.path = path; - widevine_cdm.name = kWidevineCdmDisplayName; - widevine_cdm.description = kWidevineCdmDescription; - content::WebPluginMimeType widevine_cdm_mime_type( - kWidevineCdmPluginMimeType, - kWidevineCdmPluginExtension, - kWidevineCdmPluginMimeTypeDescription); - + *cdm_path = QtWebEngineCore::toFilePath(pluginPath); + if (base::PathExists(*cdm_path)) { // Add the supported codecs as if they came from the component manifest. - std::vector<std::string> codecs; - codecs.push_back(kCdmSupportedCodecVp8); - codecs.push_back(kCdmSupportedCodecVp9); + // This list must match the CDM that is being bundled with Chrome. + codecs_supported->push_back(media::VideoCodec::kCodecVP8); + codecs_supported->push_back(media::VideoCodec::kCodecVP9); #if BUILDFLAG(USE_PROPRIETARY_CODECS) - codecs.push_back(kCdmSupportedCodecAvc1); -#endif // defined(USE_PROPRIETARY_CODECS) - std::string codec_string = - base::JoinString(codecs, ","); - widevine_cdm_mime_type.additional_params.emplace_back( - base::ASCIIToUTF16(kCdmSupportedCodecsParamName), - base::ASCIIToUTF16(codec_string)); - widevine_cdm.mime_types.push_back(widevine_cdm_mime_type); - widevine_cdm.permissions = kWidevineCdmPluginPermissions; - plugins->push_back(widevine_cdm); - break; + codecs_supported->push_back(media::VideoCodec::kCodecH264); +#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) + + *supports_persistent_license = false; + + return true; } } -#endif // defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_PEPPER_CDMS) && - // !defined(WIDEVINE_CDM_IS_COMPONENT) + return false; } +#endif // defined(WIDEVINE_CDM_AVAILABLE_NOT_COMPONENT) -namespace QtWebEngineCore { -void ContentClientQt::AddPepperPlugins(std::vector<content::PepperPluginInfo>* plugins) +void ContentClientQt::AddContentDecryptionModules(std::vector<content::CdmInfo> *cdms, + std::vector<media::CdmHostFilePath> *cdm_host_file_paths) { - AddPepperFlashFromSystem(plugins); - AddPepperFlashFromCommandLine(plugins); - AddPepperWidevine(plugins); -} - + Q_UNUSED(cdm_host_file_paths); + if (cdms) { +#if defined(WIDEVINE_CDM_AVAILABLE_NOT_COMPONENT) + base::FilePath cdm_path; + std::vector<media::VideoCodec> video_codecs_supported; + bool supports_persistent_license = false; + if (IsWidevineAvailable(&cdm_path, &video_codecs_supported, + &supports_persistent_license)) { + const base::Version version; + cdms->push_back(content::CdmInfo(kWidevineCdmDisplayName, kWidevineCdmGuid, version, cdm_path, + kWidevineCdmFileSystemId, video_codecs_supported, + supports_persistent_license, kWidevineKeySystem, false)); + } +#endif // defined(WIDEVINE_CDM_AVAILABLE_NOT_COMPONENT) + +#if BUILDFLAG(ENABLE_LIBRARY_CDMS) + // Register Clear Key CDM if specified in command line. + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + base::FilePath clear_key_cdm_path = command_line->GetSwitchValuePath(switches::kClearKeyCdmPathForTesting); + if (!clear_key_cdm_path.empty() && base::PathExists(clear_key_cdm_path)) { + // TODO(crbug.com/764480): Remove these after we have a central place for + // External Clear Key (ECK) related information. + // Normal External Clear Key key system. + const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey"; + // A variant of ECK key system that has a different GUID. + const char kExternalClearKeyDifferentGuidTestKeySystem[] = + "org.chromium.externalclearkey.differentguid"; + // ECK implementation supports persistent licenses. + constexpr bool supports_persistent_license = true; + + // Register kExternalClearKeyDifferentGuidTestKeySystem first separately. + // Otherwise, it'll be treated as a sub-key-system of normal + // kExternalClearKeyKeySystem. See MultipleCdmTypes test in + // ECKEncryptedMediaTest. + cdms->push_back(content::CdmInfo(media::kClearKeyCdmDisplayName, media::kClearKeyCdmDifferentGuid, + base::Version("0.1.0.0"), clear_key_cdm_path, + media::kClearKeyCdmFileSystemId, {}, supports_persistent_license, + kExternalClearKeyDifferentGuidTestKeySystem, false)); + + // Supported codecs are hard-coded in ExternalClearKeyProperties. + cdms->push_back(content::CdmInfo(media::kClearKeyCdmDisplayName, media::kClearKeyCdmGuid, + base::Version("0.1.0.0"), clear_key_cdm_path, + media::kClearKeyCdmFileSystemId, {}, supports_persistent_license, + kExternalClearKeyKeySystem, true)); + } +#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) + } } -#endif // BUILDFLAG(ENABLE_PLUGINS) - -#include <QCoreApplication> - -namespace QtWebEngineCore { std::string ContentClientQt::getUserAgent() { diff --git a/src/core/content_client_qt.h b/src/core/content_client_qt.h index 341406380..627e7a97e 100644 --- a/src/core/content_client_qt.h +++ b/src/core/content_client_qt.h @@ -42,7 +42,7 @@ #include "base/strings/string_piece.h" #include "content/public/common/content_client.h" -#include "ppapi/features/features.h" +#include "ppapi/buildflags/buildflags.h" #include "ui/base/layout.h" namespace QtWebEngineCore { @@ -55,6 +55,8 @@ public: void AddPepperPlugins(std::vector<content::PepperPluginInfo>* plugins) override; #endif void AddAdditionalSchemes(Schemes* schemes) override; + void AddContentDecryptionModules(std::vector<content::CdmInfo> *cdms, + std::vector<media::CdmHostFilePath> *cdm_host_file_paths) override; base::StringPiece GetDataResource(int, ui::ScaleFactor) const override; base::RefCountedMemory* GetDataResourceBytes(int resource_id) const override; diff --git a/src/core/core_chromium.pri b/src/core/core_chromium.pri index f2b529951..8ab3e17ea 100644 --- a/src/core/core_chromium.pri +++ b/src/core/core_chromium.pri @@ -68,6 +68,7 @@ SOURCES = \ gl_surface_qt.cpp \ javascript_dialog_controller.cpp \ javascript_dialog_manager_qt.cpp \ + login_delegate_qt.cpp \ media_capture_devices_dispatcher.cpp \ native_web_keyboard_event_qt.cpp \ net/cookie_monster_delegate_qt.cpp \ @@ -105,7 +106,6 @@ SOURCES = \ renderer/render_view_observer_qt.cpp \ renderer/user_resource_controller.cpp \ renderer/web_channel_ipc_transport.cpp \ - renderer_host/resource_dispatcher_host_delegate_qt.cpp \ renderer_host/user_resource_controller_host.cpp \ renderer_host/web_channel_ipc_transport_host.cpp \ resource_bundle_qt.cpp \ @@ -157,6 +157,7 @@ HEADERS = \ javascript_dialog_controller_p.h \ javascript_dialog_controller.h \ javascript_dialog_manager_qt.h \ + login_delegate_qt.h \ media_capture_devices_dispatcher.h \ net/cookie_monster_delegate_qt.h \ net/custom_protocol_handler.h \ @@ -196,7 +197,6 @@ HEADERS = \ renderer/render_view_observer_qt.h \ renderer/user_resource_controller.h \ renderer/web_channel_ipc_transport.h \ - renderer_host/resource_dispatcher_host_delegate_qt.h \ renderer_host/user_resource_controller_host.h \ renderer_host/web_channel_ipc_transport_host.h \ request_controller.h \ diff --git a/src/core/core_project.pro b/src/core/core_project.pro index 2d2bef60d..5980072ea 100644 --- a/src/core/core_project.pro +++ b/src/core/core_project.pro @@ -11,7 +11,7 @@ linking_pri = $$OUT_PWD/$$getConfigDir()/$${TARGET}.pri CHROMIUM_SRC_DIR = $$QTWEBENGINE_ROOT/$$getChromiumSrcDir() INCLUDEPATH += $$CHROMIUM_SRC_DIR \ - $$CHROMIUM_SRC_DIR/third_party/WebKit/Source \ + $$CHROMIUM_SRC_DIR/third_party/blink/public \ $$OUT_PWD/$$getConfigDir()/gen SOURCES += $$NINJA_SOURCES diff --git a/src/core/delegated_frame_node.cpp b/src/core/delegated_frame_node.cpp index d130fe33a..f829813ff 100644 --- a/src/core/delegated_frame_node.cpp +++ b/src/core/delegated_frame_node.cpp @@ -651,7 +651,10 @@ QSharedPointer<QSGTexture> ResourceHolder::initTexture(bool quadNeedsBlending, R if (!texture) { if (m_resource.is_software) { Q_ASSERT(apiDelegate); - std::unique_ptr<viz::SharedBitmap> sharedBitmap = viz::ServerSharedBitmapManager::current()->GetSharedBitmapFromId(m_resource.size, m_resource.mailbox_holder.mailbox); + std::unique_ptr<viz::SharedBitmap> sharedBitmap = + viz::ServerSharedBitmapManager::current()->GetSharedBitmapFromId(m_resource.size, + viz::BGRA_8888, + m_resource.mailbox_holder.mailbox); // QSG interprets QImage::hasAlphaChannel meaning that a node should enable blending // to draw it but Chromium keeps this information in the quads. // The input format is currently always Format_ARGB32_Premultiplied, so assume that all @@ -659,7 +662,9 @@ QSharedPointer<QSGTexture> ResourceHolder::initTexture(bool quadNeedsBlending, R // from Format_ARGB32_Premultiplied to Format_RGB32 just to get hasAlphaChannel to // return false. QImage::Format format = quadNeedsBlending ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32; - QImage image(sharedBitmap->pixels(), m_resource.size.width(), m_resource.size.height(), format); + QImage image = sharedBitmap + ? QImage(sharedBitmap->pixels(), m_resource.size.width(), m_resource.size.height(), format) + : QImage(m_resource.size.width(), m_resource.size.height(), format); texture.reset(apiDelegate->createTextureFromImage(image.copy())); } else { #ifndef QT_NO_OPENGL diff --git a/src/core/devtools_frontend_qt.cpp b/src/core/devtools_frontend_qt.cpp index 95f522826..ecfa4b6b9 100644 --- a/src/core/devtools_frontend_qt.cpp +++ b/src/core/devtools_frontend_qt.cpp @@ -83,6 +83,24 @@ using namespace QtWebEngineCore; namespace { +std::unique_ptr<base::DictionaryValue> BuildObjectForResponse(const net::HttpResponseHeaders *rh) +{ + auto response = std::make_unique<base::DictionaryValue>(); + response->SetInteger("statusCode", rh ? rh->response_code() : 200); + + auto headers = std::make_unique<base::DictionaryValue>(); + size_t iterator = 0; + std::string name; + std::string value; + // TODO(caseq): this probably needs to handle duplicate header names + // correctly by folding them. + while (rh && rh->EnumerateHeaderLines(&iterator, &name, &value)) + headers->SetString(name, value); + + response->Set("headers", std::move(headers)); + return response; +} + // ResponseWriter ------------------------------------------------------------- class ResponseWriter : public net::URLFetcherResponseWriter { @@ -137,7 +155,7 @@ int ResponseWriter::Finish(int net_error, const net::CompletionCallback &callbac static std::string GetFrontendURL() { - return chrome::kChromeUIDevToolsURL; + return "chrome-devtools://devtools/bundled/devtools_app.html"; } } // namespace @@ -471,19 +489,9 @@ void DevToolsFrontendQt::OnURLFetchComplete(const net::URLFetcher *source) PendingRequestsMap::iterator it = m_pendingRequests.find(source); DCHECK(it != m_pendingRequests.end()); - base::DictionaryValue response; - auto headers = base::MakeUnique<base::DictionaryValue>(); - net::HttpResponseHeaders* rh = source->GetResponseHeaders(); - response.SetInteger("statusCode", rh ? rh->response_code() : 200); - - size_t iterator = 0; - std::string name; - std::string value; - while (rh && rh->EnumerateHeaderLines(&iterator, &name, &value)) - headers->SetString(name, value); - response.Set("headers", std::move(headers)); + auto response = BuildObjectForResponse(source->GetResponseHeaders()); - SendMessageAck(it->second, &response); + SendMessageAck(it->second, response.get()); m_pendingRequests.erase(it); delete source; } diff --git a/src/core/renderer_host/resource_dispatcher_host_delegate_qt.cpp b/src/core/login_delegate_qt.cpp index 265386ee8..34245971f 100644 --- a/src/core/renderer_host/resource_dispatcher_host_delegate_qt.cpp +++ b/src/core/login_delegate_qt.cpp @@ -41,7 +41,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE.Chromium file. -#include "resource_dispatcher_host_delegate_qt.h" +#include "login_delegate_qt.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_view_host.h" @@ -56,7 +56,7 @@ namespace QtWebEngineCore { -ResourceDispatcherHostLoginDelegateQt::ResourceDispatcherHostLoginDelegateQt( +LoginDelegateQt::LoginDelegateQt( net::AuthChallengeInfo *authInfo, content::ResourceRequestInfo::WebContentsGetter web_contents_getter, GURL url, @@ -70,42 +70,42 @@ ResourceDispatcherHostLoginDelegateQt::ResourceDispatcherHostLoginDelegateQt( content::BrowserThread::PostTask( content::BrowserThread::UI, FROM_HERE, - base::Bind(&ResourceDispatcherHostLoginDelegateQt::triggerDialog, + base::Bind(&LoginDelegateQt::triggerDialog, this, web_contents_getter)); } -ResourceDispatcherHostLoginDelegateQt::~ResourceDispatcherHostLoginDelegateQt() +LoginDelegateQt::~LoginDelegateQt() { Q_ASSERT(m_dialogController.isNull()); } -void ResourceDispatcherHostLoginDelegateQt::OnRequestCancelled() +void LoginDelegateQt::OnRequestCancelled() { destroy(); } -QUrl ResourceDispatcherHostLoginDelegateQt::url() const +QUrl LoginDelegateQt::url() const { return toQt(m_url); } -QString ResourceDispatcherHostLoginDelegateQt::realm() const +QString LoginDelegateQt::realm() const { return QString::fromStdString(m_authInfo->realm); } -QString ResourceDispatcherHostLoginDelegateQt::host() const +QString LoginDelegateQt::host() const { return QString::fromStdString(m_authInfo->challenger.host()); } -bool ResourceDispatcherHostLoginDelegateQt::isProxy() const +bool LoginDelegateQt::isProxy() const { return m_authInfo->is_proxy; } -void ResourceDispatcherHostLoginDelegateQt::triggerDialog(const content::ResourceRequestInfo::WebContentsGetter &webContentsGetter) +void LoginDelegateQt::triggerDialog(const content::ResourceRequestInfo::WebContentsGetter &webContentsGetter) { Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); content::WebContentsImpl *webContents = @@ -119,7 +119,7 @@ void ResourceDispatcherHostLoginDelegateQt::triggerDialog(const content::Resourc client->authenticationRequired(m_dialogController); } -void ResourceDispatcherHostLoginDelegateQt::sendAuthToRequester(bool success, const QString &user, const QString &password) +void LoginDelegateQt::sendAuthToRequester(bool success, const QString &user, const QString &password) { Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); @@ -133,41 +133,10 @@ void ResourceDispatcherHostLoginDelegateQt::sendAuthToRequester(bool success, co destroy(); } -void ResourceDispatcherHostLoginDelegateQt::destroy() +void LoginDelegateQt::destroy() { m_dialogController.reset(); m_auth_required_callback.Reset(); } -static void LaunchURL(const GURL& url, int render_process_id, - const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter, - ui::PageTransition page_transition, bool is_main_frame, bool has_user_gesture) -{ - Q_UNUSED(render_process_id); - Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - content::WebContents* webContents = web_contents_getter.Run(); - if (!webContents) - return; - WebContentsDelegateQt *contentsDelegate = static_cast<WebContentsDelegateQt*>(webContents->GetDelegate()); - contentsDelegate->launchExternalURL(toQt(url), page_transition, is_main_frame, has_user_gesture); -} - - -bool ResourceDispatcherHostDelegateQt::HandleExternalProtocol(const GURL& url, content::ResourceRequestInfo* info) -{ - Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); - - content::BrowserThread::PostTask( - content::BrowserThread::UI, - FROM_HERE, - base::Bind(&LaunchURL, url, - info->GetChildID(), - info->GetWebContentsGetterForRequest(), - info->GetPageTransition(), - info->IsMainFrame(), - info->HasUserGesture()) - ); - return true; -} - } // namespace QtWebEngineCore diff --git a/src/core/renderer_host/resource_dispatcher_host_delegate_qt.h b/src/core/login_delegate_qt.h index 5bebe1599..83ddc4322 100644 --- a/src/core/renderer_host/resource_dispatcher_host_delegate_qt.h +++ b/src/core/login_delegate_qt.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWebEngine module of the Qt Toolkit. @@ -37,11 +37,11 @@ ** ****************************************************************************/ -#ifndef RESOURCE_DISPATCHER_HOST_DELEGATE_QT_H -#define RESOURCE_DISPATCHER_HOST_DELEGATE_QT_H +#ifndef LOGIN_DELEGATE_QT_H +#define LOGIN_DELEGATE_QT_H -#include "content/public/browser/resource_dispatcher_host_delegate.h" -#include "content/public/browser/resource_dispatcher_host_login_delegate.h" +#include "content/public/browser/login_delegate.h" +#include "content/public/browser/resource_request_info.h" #include "url/gurl.h" #include "web_contents_adapter_client.h" @@ -55,19 +55,18 @@ namespace QtWebEngineCore { class AuthenticationDialogController; -// FIXME: move to separate file -class ResourceDispatcherHostLoginDelegateQt : public content::ResourceDispatcherHostLoginDelegate { +class LoginDelegateQt : public content::LoginDelegate { public: - ResourceDispatcherHostLoginDelegateQt(net::AuthChallengeInfo *authInfo, - content::ResourceRequestInfo::WebContentsGetter web_contents_getter, - GURL url, - bool first_auth_attempt, - const base::Callback<void(const base::Optional<net::AuthCredentials>&)> &auth_required_callback); + LoginDelegateQt(net::AuthChallengeInfo *authInfo, + content::ResourceRequestInfo::WebContentsGetter web_contents_getter, + GURL url, + bool first_auth_attempt, + const base::Callback<void(const base::Optional<net::AuthCredentials>&)> &auth_required_callback); - ~ResourceDispatcherHostLoginDelegateQt(); + ~LoginDelegateQt(); - // ResourceDispatcherHostLoginDelegate implementation - virtual void OnRequestCancelled(); + // LoginDelegate implementation + void OnRequestCancelled() override; QUrl url() const; QString realm() const; @@ -90,12 +89,6 @@ private: QSharedPointer<AuthenticationDialogController> m_dialogController; }; -class ResourceDispatcherHostDelegateQt : public content::ResourceDispatcherHostDelegate { -public: - bool HandleExternalProtocol(const GURL& url, - content::ResourceRequestInfo* info) override; -}; - } // namespace QtWebEngineCore -#endif // RESOURCE_DISPATCHER_HOST_DELEGATE_QT_H +#endif // LOGIN_DELEGATE_QT_H diff --git a/src/core/media_capture_devices_dispatcher.cpp b/src/core/media_capture_devices_dispatcher.cpp index 87fe543b1..2d3c4e2d5 100644 --- a/src/core/media_capture_devices_dispatcher.cpp +++ b/src/core/media_capture_devices_dispatcher.cpp @@ -62,7 +62,7 @@ #include "content/public/common/media_stream_request.h" #include "media/audio/audio_device_description.h" #include "media/audio/audio_manager_base.h" -#include "media/media_features.h" +#include "media/media_buildflags.h" #include "ui/base/l10n/l10n_util.h" #if BUILDFLAG(ENABLE_WEBRTC) diff --git a/src/core/net/cookie_monster_delegate_qt.h b/src/core/net/cookie_monster_delegate_qt.h index d7cd0f33b..6b2b1f417 100644 --- a/src/core/net/cookie_monster_delegate_qt.h +++ b/src/core/net/cookie_monster_delegate_qt.h @@ -58,7 +58,6 @@ QT_WARNING_PUSH // effect with clang, so use a pragma for these dirty chromium headers QT_WARNING_DISABLE_CLANG("-Wunused-parameter") #include "base/memory/ref_counted.h" -#include "net/cookies/cookie_change_dispatcher.h" #include "net/cookies/cookie_monster.h" QT_WARNING_POP diff --git a/src/core/net/proxy_config_service_qt.cpp b/src/core/net/proxy_config_service_qt.cpp index bf1ff6e14..c5316d54e 100644 --- a/src/core/net/proxy_config_service_qt.cpp +++ b/src/core/net/proxy_config_service_qt.cpp @@ -91,14 +91,14 @@ void ProxyConfigServiceQt::RemoveObserver(net::ProxyConfigService::Observer *obs m_observers.RemoveObserver(observer); } -net::ProxyConfigService::ConfigAvailability ProxyConfigServiceQt::GetLatestProxyConfig(net::ProxyConfig *config) +net::ProxyConfigService::ConfigAvailability ProxyConfigServiceQt::GetLatestProxyConfig(net::ProxyConfigWithAnnotation *config) { #if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0) m_usesSystemConfiguration = QNetworkProxyFactory::usesSystemConfiguration(); #endif if (m_usesSystemConfiguration) { // Use Chromium's base service to retrieve system settings - net::ProxyConfig systemConfig; + net::ProxyConfigWithAnnotation systemConfig; ConfigAvailability systemAvailability = net::ProxyConfigService::CONFIG_UNSET; if (m_baseService.get()) systemAvailability = m_baseService->GetLatestProxyConfig(&systemConfig); @@ -112,7 +112,7 @@ net::ProxyConfigService::ConfigAvailability ProxyConfigServiceQt::GetLatestProxy const QNetworkProxy &qtProxy = QNetworkProxy::applicationProxy(); if (qtProxy == m_qtApplicationProxy && !m_qtProxyConfig.proxy_rules().empty()) { // no changes - *config = m_qtProxyConfig; + *config = net::ProxyConfigWithAnnotation(m_qtProxyConfig, config->traffic_annotation()); return CONFIG_VALID; } @@ -141,7 +141,7 @@ net::ProxyConfigService::ConfigAvailability ProxyConfigServiceQt::GetLatestProxy qtRules.bypass_rules.AddRuleToBypassLocal(); // don't use proxy for connections to localhost m_qtProxyConfig.proxy_rules() = qtRules; - *config = m_qtProxyConfig; + *config = net::ProxyConfigWithAnnotation(m_qtProxyConfig, config->traffic_annotation()); return CONFIG_VALID; } @@ -167,7 +167,7 @@ void ProxyConfigServiceQt::OnLazyPoll() } // Called when the base service changed -void ProxyConfigServiceQt::OnProxyConfigChanged(const net::ProxyConfig &config, ConfigAvailability availability) +void ProxyConfigServiceQt::OnProxyConfigChanged(const net::ProxyConfigWithAnnotation &config, ConfigAvailability availability) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); Q_UNUSED(config); @@ -181,7 +181,7 @@ void ProxyConfigServiceQt::OnProxyConfigChanged(const net::ProxyConfig &config, // Update our observers void ProxyConfigServiceQt::Update() { - net::ProxyConfig actual_config; + net::ProxyConfigWithAnnotation actual_config; ConfigAvailability availability = GetLatestProxyConfig(&actual_config); if (availability == CONFIG_PENDING) return; diff --git a/src/core/net/proxy_config_service_qt.h b/src/core/net/proxy_config_service_qt.h index f50a9a5d5..dcd303894 100644 --- a/src/core/net/proxy_config_service_qt.h +++ b/src/core/net/proxy_config_service_qt.h @@ -43,14 +43,14 @@ #include "base/memory/ref_counted.h" #include "base/observer_list.h" -#include "net/proxy_resolution/proxy_config.h" #include "net/proxy_resolution/proxy_config_service.h" +#include "net/proxy_resolution/proxy_config_with_annotation.h" #include <QNetworkProxy> class ProxyConfigServiceQt - : public net::ProxyConfigService, - public net::ProxyConfigService::Observer { + : public net::ProxyConfigService + , public net::ProxyConfigService::Observer { public: static net::ProxyServer fromQNetworkProxy(const QNetworkProxy &); @@ -61,12 +61,12 @@ public: // ProxyConfigService implementation: void AddObserver(net::ProxyConfigService::Observer *observer) override; void RemoveObserver(net::ProxyConfigService::Observer *observer) override; - ConfigAvailability GetLatestProxyConfig(net::ProxyConfig *config) override; + ConfigAvailability GetLatestProxyConfig(net::ProxyConfigWithAnnotation *config) override; void OnLazyPoll() override; private: // ProxyConfigService::Observer implementation: - void OnProxyConfigChanged(const net::ProxyConfig& config, + void OnProxyConfigChanged(const net::ProxyConfigWithAnnotation &config, ConfigAvailability availability) override; // Retrieve new proxy settings and notify observers. diff --git a/src/core/net/webui_controller_factory_qt.cpp b/src/core/net/webui_controller_factory_qt.cpp index 3b13f03b8..95cab0b2f 100644 --- a/src/core/net/webui_controller_factory_qt.cpp +++ b/src/core/net/webui_controller_factory_qt.cpp @@ -57,10 +57,10 @@ #include "content/public/browser/web_ui.h" #include "content/public/common/content_client.h" #include "content/public/common/url_utils.h" -#include "extensions/features/features.h" -#include "media/media_features.h" -#include "ppapi/features/features.h" -#include "printing/features/features.h" +#include "extensions/buildflags/buildflags.h" +#include "media/media_buildflags.h" +#include "ppapi/buildflags/buildflags.h" +#include "printing/buildflags/buildflags.h" #include "ui/web_dialogs/web_dialog_ui.h" #include "url/gurl.h" diff --git a/src/core/ozone/gl_surface_egl_qt.cpp b/src/core/ozone/gl_surface_egl_qt.cpp index 6de9d20b5..37a801014 100644 --- a/src/core/ozone/gl_surface_egl_qt.cpp +++ b/src/core/ozone/gl_surface_egl_qt.cpp @@ -140,7 +140,10 @@ bool GLSurfaceEGL::IsCreateContextWebGLCompatabilitySupported() { return false; } - +bool GLSurfaceEGL::IsEGLSurfacelessContextSupported() +{ + return GLSurfaceEGLQt::g_egl_surfaceless_context_supported; +} bool GLSurfaceEGL::IsEGLContextPrioritySupported() { return false; diff --git a/src/core/ozone/platform_window_qt.h b/src/core/ozone/platform_window_qt.h index d25096432..030a53c87 100644 --- a/src/core/ozone/platform_window_qt.h +++ b/src/core/ozone/platform_window_qt.h @@ -65,6 +65,7 @@ public: void SetTitle(const base::string16&) override { } void SetCapture() override { } void ReleaseCapture() override { } + bool HasCapture() const override { return false; } void ToggleFullscreen() override { } void Maximize() override { } void Minimize() override { } diff --git a/src/core/permission_manager_qt.cpp b/src/core/permission_manager_qt.cpp index 82df47ed2..b0614ada4 100644 --- a/src/core/permission_manager_qt.cpp +++ b/src/core/permission_manager_qt.cpp @@ -234,6 +234,17 @@ blink::mojom::PermissionStatus PermissionManagerQt::GetPermissionStatus( return blink::mojom::PermissionStatus::DENIED; } +blink::mojom::PermissionStatus PermissionManagerQt::GetPermissionStatusForFrame( + content::PermissionType permission, + content::RenderFrameHost *render_frame_host, + const GURL &requesting_origin) +{ + return GetPermissionStatus( + permission, + requesting_origin, + content::WebContents::FromRenderFrameHost(render_frame_host)->GetLastCommittedURL().GetOrigin()); +} + void PermissionManagerQt::ResetPermission( content::PermissionType permission, const GURL& requesting_origin, diff --git a/src/core/permission_manager_qt.h b/src/core/permission_manager_qt.h index b57dd4ba0..6a4b78d7c 100644 --- a/src/core/permission_manager_qt.h +++ b/src/core/permission_manager_qt.h @@ -71,6 +71,11 @@ public: const GURL& requesting_origin, const GURL& embedding_origin) override; + blink::mojom::PermissionStatus GetPermissionStatusForFrame( + content::PermissionType permission, + content::RenderFrameHost *render_frame_host, + const GURL& requesting_origin) override; + void ResetPermission( content::PermissionType permission, const GURL& requesting_origin, diff --git a/src/core/printing/print_view_manager_qt.h b/src/core/printing/print_view_manager_qt.h index 654608ddd..5825e7b6e 100644 --- a/src/core/printing/print_view_manager_qt.h +++ b/src/core/printing/print_view_manager_qt.h @@ -54,7 +54,7 @@ #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/web_contents_user_data.h" -#include "printing/features/features.h" +#include "printing/buildflags/buildflags.h" struct PrintHostMsg_RequestPrintPreview_Params; struct PrintHostMsg_DidPreviewDocument_Params; diff --git a/src/core/profile_io_data_qt.cpp b/src/core/profile_io_data_qt.cpp index 2cdd7aab1..bcf25f4e8 100644 --- a/src/core/profile_io_data_qt.cpp +++ b/src/core/profile_io_data_qt.cpp @@ -38,20 +38,18 @@ ****************************************************************************/ #include "profile_io_data_qt.h" + #include "base/task_scheduler/post_task.h" -#include "content/network/proxy_service_mojo.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/browsing_data_remover.h" #include "content/public/browser/cookie_store_factory.h" #include "content/public/common/content_features.h" #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" #include "chrome/browser/net/chrome_mojo_proxy_resolver_factory.h" -#include "net/cookie_monster_delegate_qt.h" #include "net/cert/cert_verifier.h" #include "net/cert/ct_known_logs.h" #include "net/cert/ct_log_verifier.h" #include "net/cert/multi_log_ct_verifier.h" -#include "net/custom_protocol_handler.h" #include "net/extras/sqlite/sqlite_channel_id_store.h" #include "net/http/http_auth_handler_factory.h" #include "net/http/http_auth_scheme.h" @@ -59,14 +57,12 @@ #include "net/http/http_cache.h" #include "net/http/http_server_properties_impl.h" #include "net/http/http_network_session.h" -#include "net/proxy/dhcp_proxy_script_fetcher_factory.h" -#include "net/proxy/proxy_script_fetcher_impl.h" -#include "net/proxy/proxy_service.h" -#include "net/proxy_config_service_qt.h" +#include "net/proxy_resolution/dhcp_pac_file_fetcher_factory.h" +#include "net/proxy_resolution/pac_file_fetcher_impl.h" +#include "net/proxy_resolution/proxy_config_service.h" +#include "net/proxy_resolution/proxy_resolution_service.h" #include "net/ssl/channel_id_service.h" #include "net/ssl/ssl_config_service_defaults.h" -#include "net/network_delegate_qt.h" -#include "net/url_request_context_getter_qt.h" #include "net/url_request/data_protocol_handler.h" #include "net/url_request/file_protocol_handler.h" #include "net/url_request/ftp_protocol_handler.h" @@ -74,10 +70,18 @@ #include "net/url_request/url_request_context_storage.h" #include "net/url_request/url_request_job_factory_impl.h" #include "net/url_request/url_request_intercepting_job_factory.h" +#include "services/network/proxy_service_mojo.h" + +#include "net/cookie_monster_delegate_qt.h" +#include "net/custom_protocol_handler.h" +#include "net/network_delegate_qt.h" +#include "net/proxy_config_service_qt.h" #include "net/qrc_protocol_handler_qt.h" +#include "net/url_request_context_getter_qt.h" #include "profile_qt.h" #include "resource_context_qt.h" #include "type_conversion.h" + namespace QtWebEngineCore { static const char* const kDefaultAuthSchemes[] = { net::kBasicAuthScheme, @@ -104,7 +108,7 @@ static bool doNetworkSessionContextMatch(const net::HttpNetworkSession::Context return false; if (first.channel_id_service != second.channel_id_service) return false; - if (first.proxy_service != second.proxy_service) + if (first.proxy_resolution_service != second.proxy_resolution_service) return false; if (first.ssl_config_service != second.ssl_config_service) return false; @@ -127,7 +131,7 @@ static net::HttpNetworkSession::Context generateNetworkSessionContext(net::URLRe network_session_context.transport_security_state = urlRequestContext->transport_security_state(); network_session_context.cert_verifier = urlRequestContext->cert_verifier(); network_session_context.channel_id_service = urlRequestContext->channel_id_service(); - network_session_context.proxy_service = urlRequestContext->proxy_service(); + network_session_context.proxy_resolution_service = urlRequestContext->proxy_resolution_service(); network_session_context.ssl_config_service = urlRequestContext->ssl_config_service(); network_session_context.http_auth_handler_factory = urlRequestContext->http_auth_handler_factory(); network_session_context.http_server_properties = urlRequestContext->http_server_properties(); @@ -149,13 +153,13 @@ ProfileIODataQt::ProfileIODataQt(ProfileQt *profile) m_mutex(QMutex::Recursive), m_weakPtrFactory(this) { - if (content::BrowserThread::IsMessageLoopValid(content::BrowserThread::UI)) + if (content::BrowserThread::IsThreadInitialized(content::BrowserThread::UI)) DCHECK_CURRENTLY_ON(content::BrowserThread::UI); } ProfileIODataQt::~ProfileIODataQt() { - if (content::BrowserThread::IsMessageLoopValid(content::BrowserThread::IO)) + if (content::BrowserThread::IsThreadInitialized(content::BrowserThread::IO)) DCHECK_CURRENTLY_ON(content::BrowserThread::IO); m_resourceContext.reset(); if (m_cookieDelegate) @@ -271,17 +275,17 @@ void ProfileIODataQt::generateStorage() // The System Proxy Resolver has issues on Windows with unconfigured network cards, // which is why we want to use the v8 one - if (!m_dhcpProxyScriptFetcherFactory) - m_dhcpProxyScriptFetcherFactory.reset(new net::DhcpProxyScriptFetcherFactory); - - m_storage->set_proxy_service(content::CreateProxyServiceUsingMojoFactory( - std::move(m_proxyResolverFactory), - std::unique_ptr<net::ProxyConfigService>(proxyConfigService), - std::make_unique<net::ProxyScriptFetcherImpl>(m_urlRequestContext.get()), - m_dhcpProxyScriptFetcherFactory->Create(m_urlRequestContext.get()), - host_resolver.get(), - nullptr /* NetLog */, - m_networkDelegate.get())); + if (!m_dhcpPacFileFetcherFactory) + m_dhcpPacFileFetcherFactory.reset(new net::DhcpPacFileFetcherFactory); + + m_storage->set_proxy_resolution_service(network::CreateProxyResolutionServiceUsingMojoFactory( + std::move(m_proxyResolverFactory), + std::unique_ptr<net::ProxyConfigService>(proxyConfigService), + std::make_unique<net::PacFileFetcherImpl>(m_urlRequestContext.get()), + m_dhcpPacFileFetcherFactory->Create(m_urlRequestContext.get()), + host_resolver.get(), + nullptr /* NetLog */, + m_networkDelegate.get())); m_storage->set_ssl_config_service(new net::SSLConfigServiceDefaults); m_storage->set_transport_security_state(std::unique_ptr<net::TransportSecurityState>( @@ -570,7 +574,7 @@ void ProfileIODataQt::updateStorageSettings() Q_ASSERT(m_proxyConfigService == 0); m_proxyConfigService = new ProxyConfigServiceQt( - net::ProxyService::CreateSystemProxyConfigService( + net::ProxyResolutionService::CreateSystemProxyConfigService( content::BrowserThread::GetTaskRunnerForThread(content::BrowserThread::IO))); m_proxyResolverFactory = ChromeMojoProxyResolverFactory::CreateWithStrongBinding(); diff --git a/src/core/profile_io_data_qt.h b/src/core/profile_io_data_qt.h index d29fefa24..c11227423 100644 --- a/src/core/profile_io_data_qt.h +++ b/src/core/profile_io_data_qt.h @@ -41,15 +41,17 @@ #define PROFILE_IO_DATA_QT_H #include "browser_context_adapter.h" + #include "chrome/browser/profiles/profile.h" #include "chrome/browser/custom_handlers/protocol_handler_registry.h" -#include "services/proxy_resolver/public/interfaces/proxy_resolver.mojom.h" +#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h" + #include <QtCore/QString> #include <QtCore/QPointer> #include <QtCore/QMutex> namespace net { -class DhcpProxyScriptFetcherFactory; +class DhcpPacFileFetcherFactory; class HttpAuthPreferences; class HttpNetworkSession; class NetworkDelegate; @@ -106,7 +108,7 @@ private: std::unique_ptr<net::URLRequestContext> m_urlRequestContext; std::unique_ptr<net::HttpNetworkSession> m_httpNetworkSession; std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> m_protocolHandlerInterceptor; - std::unique_ptr<net::DhcpProxyScriptFetcherFactory> m_dhcpProxyScriptFetcherFactory; + std::unique_ptr<net::DhcpPacFileFetcherFactory> m_dhcpPacFileFetcherFactory; std::unique_ptr<net::HttpAuthPreferences> m_httpAuthPreferences; std::unique_ptr<net::URLRequestJobFactory> m_jobFactory; base::WeakPtr<ProfileIODataQt> m_weakPtr; diff --git a/src/core/profile_qt.cpp b/src/core/profile_qt.cpp index bae1ec75d..e37230de9 100644 --- a/src/core/profile_qt.cpp +++ b/src/core/profile_qt.cpp @@ -81,8 +81,8 @@ ProfileQt::ProfileQt(BrowserContextAdapter *adapter) #if BUILDFLAG(ENABLE_SPELLCHECK) // Initial spellcheck settings registry->RegisterStringPref(prefs::kAcceptLanguages, std::string()); - registry->RegisterListPref(spellcheck::prefs::kSpellCheckDictionaries, base::MakeUnique<base::ListValue>()); - registry->RegisterListPref(spellcheck::prefs::kSpellCheckForcedDictionaries, base::MakeUnique<base::ListValue>()); + registry->RegisterListPref(spellcheck::prefs::kSpellCheckDictionaries, std::make_unique<base::ListValue>()); + registry->RegisterListPref(spellcheck::prefs::kSpellCheckForcedDictionaries, std::make_unique<base::ListValue>()); registry->RegisterStringPref(spellcheck::prefs::kSpellCheckDictionary, std::string()); registry->RegisterBooleanPref(spellcheck::prefs::kSpellCheckEnable, false); registry->RegisterBooleanPref(spellcheck::prefs::kSpellCheckUseSpellingService, false); @@ -100,6 +100,7 @@ ProfileQt::ProfileQt(BrowserContextAdapter *adapter) ProfileQt::~ProfileQt() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + content::BrowserContext::NotifyWillBeDestroyed(this); BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(this); ShutdownStoragePartitions(); m_profileIOData->shutdownOnUIThread(); diff --git a/src/core/qtwebengine.gni b/src/core/qtwebengine.gni index 60165f320..beb19a943 100644 --- a/src/core/qtwebengine.gni +++ b/src/core/qtwebengine.gni @@ -13,32 +13,29 @@ include_dirs = [ deps = [ "//base", + "//components/cdm/renderer", "//components/error_page/common", "//components/keyed_service/content", "//components/visitedlink/browser", "//components/visitedlink/renderer", "//components/web_cache/browser", "//components/web_cache/renderer", - "//components/spellcheck:build_features", + "//components/spellcheck:buildflags", "//content/public/app:browser", "//content/public/browser", "//content/public/common", "//content/public/renderer", - "//media:media_features", + "//media:media_buildflags", "//net:net_browser_services", "//net:net_with_v8", "//skia", - "//third_party/WebKit/public:blink", - "//ui/accessibility", + "//third_party/blink/public:blink", "//third_party/mesa:mesa_headers", + "//ui/accessibility", ":qtwebengine_sources", ":qtwebengine_resources" ] -if (enable_widevine) { - deps += [ "//components/cdm/renderer"] -} - if (enable_webrtc) { deps += [ "//third_party/webrtc_overrides" ] } diff --git a/src/core/qtwebengine_resources.gni b/src/core/qtwebengine_resources.gni index 491b26efc..0e3652c1d 100644 --- a/src/core/qtwebengine_resources.gni +++ b/src/core/qtwebengine_resources.gni @@ -16,13 +16,13 @@ group("qtwebengine_resources") { repack("qtwebengine_repack_resources") { sources = [ - "$root_gen_dir/blink/public/resources/blink_resources.pak", "$root_gen_dir/qtwebengine/qt_webengine_resources.pak", "$root_gen_dir/chrome/quota_internals_resources.pak", "$root_gen_dir/chrome/task_scheduler_internals_resources.pak", "$root_gen_dir/components/components_resources.pak", "$root_gen_dir/content/content_resources.pak", "$root_gen_dir/net/net_resources.pak", + "$root_gen_dir/third_party/blink/public/resources/blink_resources.pak", "$root_gen_dir/ui/resources/webui_resources.pak", ] output = "$root_out_dir/qtwebengine_resources.pak" @@ -33,43 +33,43 @@ repack("qtwebengine_repack_resources") { "//components/resources:components_resources_grit", "//content:resources_grit", "//net:net_resources_grit", - "//third_party/WebKit/public:resources_grit", + "//third_party/blink/public:resources_grit", "//ui/resources:webui_resources_grd_grit", ] } repack("qtwebengine_repack_resources_100") { sources = [ - "$root_gen_dir/ui/resources/ui_resources_100_percent.pak", "$root_gen_dir/components/components_resources_100_percent.pak", "$root_gen_dir/content/app/resources/content_resources_100_percent.pak", "$root_gen_dir/chrome/renderer_resources_100_percent.pak", - "$root_gen_dir/blink/public/resources/blink_scaled_resources_100_percent.pak", + "$root_gen_dir/third_party/blink/public/resources/blink_scaled_resources_100_percent.pak", + "$root_gen_dir/ui/resources/ui_resources_100_percent.pak", ] output = "$root_out_dir/qtwebengine_resources_100p.pak" deps = [ - "//third_party/WebKit/public:scaled_resources_100_percent", "//chrome/renderer:resources_grit", "//components/resources:components_scaled_resources_grit", "//content/app/resources:resources_grit", + "//third_party/blink/public:scaled_resources_100_percent", "//ui/resources:ui_resources_grd_grit" ] } repack("qtwebengine_repack_resources_200") { sources = [ - "$root_gen_dir/ui/resources/ui_resources_200_percent.pak", "$root_gen_dir/components/components_resources_200_percent.pak", "$root_gen_dir/content/app/resources/content_resources_200_percent.pak", "$root_gen_dir/chrome/renderer_resources_200_percent.pak", - "$root_gen_dir/blink/public/resources/blink_scaled_resources_200_percent.pak", + "$root_gen_dir/third_party/blink/public/resources/blink_scaled_resources_200_percent.pak", + "$root_gen_dir/ui/resources/ui_resources_200_percent.pak", ] output = "$root_out_dir/qtwebengine_resources_200p.pak" deps = [ - "//third_party/WebKit/public:scaled_resources_200_percent", "//chrome/renderer:resources_grit", "//components/resources:components_scaled_resources_grit", "//content/app/resources:resources_grit", + "//third_party/blink/public:scaled_resources_200_percent", "//ui/resources:ui_resources_grd_grit" ] } diff --git a/src/core/qtwebengine_sources.gni b/src/core/qtwebengine_sources.gni index f2a0c8a38..a8108f1a4 100644 --- a/src/core/qtwebengine_sources.gni +++ b/src/core/qtwebengine_sources.gni @@ -2,8 +2,8 @@ import("//build/config/features.gni") import("//build/config/ui.gni") import("//components/spellcheck/spellcheck_build_features.gni") import("//pdf/features.gni") -import("//ppapi/features/features.gni") -import("//printing/features/features.gni") +import("//ppapi/buildflags/buildflags.gni") +import("//printing/buildflags/buildflags.gni") source_set("qtwebengine_spellcheck_sources") { sources = [ @@ -22,7 +22,7 @@ source_set("qtwebengine_spellcheck_sources") { "//components/spellcheck/browser", "//components/spellcheck/renderer", "//third_party/boringssl", - "//third_party/WebKit/public:blink", + "//third_party/blink/public:blink", "//third_party/hunspell", ] if (is_mac && use_browser_spellchecker) { @@ -41,7 +41,7 @@ source_set("qtwebengine_sources") { deps = [ "//chrome/common:buildflags", "//components/nacl/common:buildflags", - "//extensions/features:features", + "//extensions/buildflags:buildflags", ] sources = [ "//chrome/common/custom_handlers/protocol_handler.cc", @@ -129,14 +129,14 @@ source_set("qtwebengine_sources") { "//chrome/browser/printing/print_job_worker_owner.h", ] deps += [ - "//printing/features:features", + "//printing/buildflags:buildflags", ] } if (enable_pdf) { deps += [ "//pdf", - "//pdf:features", + "//pdf:buildflags", "//components/printing/browser", "//components/printing/renderer", ] diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 826737efe..c2fa7d30a 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -58,6 +58,7 @@ #include "content/browser/browser_main_loop.h" #include "content/browser/frame_host/render_frame_host_impl.h" #include "content/browser/frame_host/frame_tree.h" +#include "content/browser/renderer_host/cursor_manager.h" #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/common/cursors/webcursor.h" #include "content/common/input_messages.h" @@ -65,8 +66,8 @@ #include "content/public/browser/browser_thread.h" #include "content/public/common/content_switches.h" #include "third_party/skia/include/core/SkColor.h" -#include "third_party/WebKit/public/platform/WebColor.h" -#include "third_party/WebKit/public/platform/WebCursorInfo.h" +#include "third_party/blink/public/platform/web_color.h" +#include "third_party/blink/public/platform/web_cursor_info.h" #include "ui/base/clipboard/scoped_clipboard_writer.h" #include "ui/events/blink/blink_event_util.h" #include "ui/events/event.h" @@ -317,7 +318,8 @@ bool isAccessibilityEnabled() { } RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost *widget) - : m_host(content::RenderWidgetHostImpl::From(widget)) + : content::RenderWidgetHostViewBase::RenderWidgetHostViewBase(widget) + , m_host(content::RenderWidgetHostImpl::From(widget)) , m_gestureProvider(QtGestureProviderConfig(), this) , m_sendMotionActionDown(false) , m_touchMotionStarted(false) @@ -342,7 +344,7 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost *widget { auto* task_runner = base::ThreadTaskRunnerHandle::Get().get(); m_beginFrameSource.reset(new viz::DelayBasedBeginFrameSource( - base::MakeUnique<viz::DelayBasedTimeSource>(task_runner), 0)); + std::make_unique<viz::DelayBasedTimeSource>(task_runner), 0)); m_host->SetView(this); #ifndef QT_NO_ACCESSIBILITY @@ -408,11 +410,6 @@ void RenderWidgetHostViewQt::InitAsFullscreen(content::RenderWidgetHostView*) { } -content::RenderWidgetHostImpl* RenderWidgetHostViewQt::GetRenderWidgetHostImpl() const -{ - return m_host; -} - void RenderWidgetHostViewQt::SetSize(const gfx::Size& size) { int width = size.width(); @@ -429,10 +426,6 @@ void RenderWidgetHostViewQt::SetBounds(const gfx::Rect& screenRect) SetSize(screenRect.size()); } -gfx::Vector2dF RenderWidgetHostViewQt::GetLastScrollOffset() const { - return m_lastScrollOffset; -} - gfx::Vector2d RenderWidgetHostViewQt::GetOffsetFromRootSurface() { return gfx::Vector2d(); @@ -722,6 +715,12 @@ void RenderWidgetHostViewQt::Destroy() void RenderWidgetHostViewQt::SetTooltipText(const base::string16 &tooltip_text) { + if (GetCursorManager()) + GetCursorManager()->SetTooltipTextForView(this, tooltip_text); +} + +void RenderWidgetHostViewQt::DisplayTooltipText(const base::string16 &tooltip_text) +{ if (m_adapterClient) m_adapterClient->setToolTip(toQt(tooltip_text)); } @@ -1303,7 +1302,7 @@ void RenderWidgetHostViewQt::handleInputMethodEvent(QInputMethodEvent *ev) if (format.underlineStyle() != QTextCharFormat::NoUnderline) underlineColor = format.underlineColor(); - underlines.push_back(ui::ImeTextSpan(ui::ImeTextSpan::Type::kComposition, start, end, toSk(underlineColor), /*thick*/ false, SK_ColorTRANSPARENT)); + underlines.push_back(ui::ImeTextSpan(ui::ImeTextSpan::Type::kComposition, start, end, ui::ImeTextSpan::Thickness::kThin, toSk(underlineColor), SK_ColorTRANSPARENT)); break; } case QInputMethodEvent::Cursor: @@ -1734,4 +1733,11 @@ viz::SurfaceId RenderWidgetHostViewQt::GetCurrentSurfaceId() const return viz::SurfaceId(); } +void RenderWidgetHostViewQt::TakeFallbackContentFrom(content::RenderWidgetHostView *view) +{ + DCHECK(!static_cast<RenderWidgetHostViewBase*>(view)->IsRenderWidgetHostViewChildFrame()); + DCHECK(!static_cast<RenderWidgetHostViewBase*>(view)->IsRenderWidgetHostViewGuest()); + SetBackgroundColor(view->background_color()); +} + } // namespace QtWebEngineCore diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h index 85ff0a80b..258bcc85c 100644 --- a/src/core/render_widget_host_view_qt.h +++ b/src/core/render_widget_host_view_qt.h @@ -124,10 +124,8 @@ public: void InitAsChild(gfx::NativeView) override; void InitAsPopup(content::RenderWidgetHostView*, const gfx::Rect&) override; void InitAsFullscreen(content::RenderWidgetHostView*) override; - content::RenderWidgetHostImpl* GetRenderWidgetHostImpl() const override; void SetSize(const gfx::Size& size) override; void SetBounds(const gfx::Rect&) override; - gfx::Vector2dF GetLastScrollOffset() const override; gfx::Vector2d GetOffsetFromRootSurface() override; gfx::Size GetCompositorViewportPixelSize() const override; gfx::NativeView GetNativeView() const override; @@ -150,6 +148,7 @@ public: void RenderProcessGone(base::TerminationStatus, int) override; void Destroy() override; void SetTooltipText(const base::string16 &tooltip_text) override; + void DisplayTooltipText(const base::string16& tooltip_text) override; void DidCreateNewRendererCompositorFrameSink(viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink) override; void SubmitCompositorFrame(const viz::LocalSurfaceId&, viz::CompositorFrame, viz::mojom::HitTestRegionListPtr) override; void WheelEventAck(const blink::WebMouseWheelEvent &event, content::InputEventAckState ack_result) override; @@ -161,6 +160,7 @@ public: void SetNeedsBeginFrames(bool needs_begin_frames) override; void SetWantsAnimateOnlyBeginFrames() override; viz::SurfaceId GetCurrentSurfaceId() const override; + void TakeFallbackContentFrom(content::RenderWidgetHostView *view) override; // Overridden from ui::GestureProviderClient. void OnGestureEvent(const ui::GestureEventData& gesture) override; @@ -201,10 +201,7 @@ public: #if defined(OS_MACOSX) void SetActive(bool active) override { QT_NOT_YET_IMPLEMENTED } - bool IsSpeaking() const override { QT_NOT_YET_IMPLEMENTED; return false; } void SpeakSelection() override { QT_NOT_YET_IMPLEMENTED } - void StopSpeaking() override { QT_NOT_YET_IMPLEMENTED } - bool SupportsSpeech() const override { QT_NOT_YET_IMPLEMENTED; return false; } void ShowDefinitionForSelection() override { QT_NOT_YET_IMPLEMENTED } #endif // defined(OS_MACOSX) @@ -218,6 +215,7 @@ public: void setLoadVisuallyCommittedState(LoadVisuallyCommittedState state) { m_loadVisuallyCommittedState = state; } gfx::SizeF lastContentsSize() const { return m_lastContentsSize; } + gfx::Vector2dF lastScrollOffset() const { return m_lastScrollOffset; } private: void sendDelegatedFrameAck(); diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp index 846c77c92..a8850d0a1 100644 --- a/src/core/renderer/content_renderer_client_qt.cpp +++ b/src/core/renderer/content_renderer_client_qt.cpp @@ -40,7 +40,7 @@ #include "renderer/content_renderer_client_qt.h" #include "common/qt_messages.h" -#include "printing/features/features.h" +#include "printing/buildflags/buildflags.h" #include "renderer/content_settings_observer_qt.h" #include "base/strings/string_split.h" @@ -48,6 +48,7 @@ #include "components/spellcheck/renderer/spellcheck.h" #include "components/spellcheck/renderer/spellcheck_provider.h" #endif +#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" @@ -63,10 +64,12 @@ #include "content/public/common/simple_connection_filter.h" #include "content/public/renderer/render_thread.h" #include "content/public/renderer/render_view.h" +#include "media/base/key_system_properties.h" +#include "media/media_buildflags.h" #include "net/base/net_errors.h" #include "services/service_manager/public/cpp/service_context.h" -#include "third_party/WebKit/public/platform/WebURLError.h" -#include "third_party/WebKit/public/platform/WebURLRequest.h" +#include "third_party/blink/public/platform/web_url_error.h" +#include "third_party/blink/public/platform/web_url_request.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/webui/jstemplate_builder.h" #include "content/public/common/web_preferences.h" @@ -84,7 +87,15 @@ #include "components/grit/components_resources.h" +#if BUILDFLAG(ENABLE_LIBRARY_CDMS) +#include "base/feature_list.h" +#include "content/public/renderer/key_system_support.h" +#include "media/base/media_switches.h" +#include "media/base/video_codecs.h" +#include "third_party/widevine/cdm/widevine_cdm_common.h" + #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. +#endif namespace QtWebEngineCore { @@ -105,11 +116,11 @@ void ContentRendererClientQt::RenderThreadStarted() m_visitedLinkSlave.reset(new visitedlink::VisitedLinkSlave); m_webCacheImpl.reset(new web_cache::WebCacheImpl()); - auto registry = base::MakeUnique<service_manager::BinderRegistry>(); + auto registry = std::make_unique<service_manager::BinderRegistry>(); registry->AddInterface(m_visitedLinkSlave->GetBindCallback(), base::ThreadTaskRunnerHandle::Get()); content::ChildThread::Get()->GetServiceManagerConnection()->AddConnectionFilter( - base::MakeUnique<content::SimpleConnectionFilter>(std::move(registry))); + std::make_unique<content::SimpleConnectionFilter>(std::move(registry))); renderThread->AddObserver(UserResourceController::instance()); @@ -258,188 +269,167 @@ void ContentRendererClientQt::GetInterface(const std::string &interface_name, mo // found in the LICENSE.Chromium file. #if BUILDFLAG(ENABLE_LIBRARY_CDMS) -static const char kExternalClearKeyPepperType[] = "application/x-ppapi-clearkey-cdm"; - -static bool IsPepperCdmAvailable(const std::string& pepper_type, - std::vector<content::WebPluginMimeType::Param>* additional_params) -{ - base::Optional<std::vector<content::WebPluginMimeType::Param>> opt_additional_params; - content::RenderThread::Get()->Send( - new QtWebEngineHostMsg_IsInternalPluginAvailableForMimeType( - pepper_type, - &opt_additional_params)); - - if (opt_additional_params) - *additional_params = *opt_additional_params; - - return opt_additional_params.has_value(); -} - -// KeySystemProperties implementation for external Clear Key systems. -class ExternalClearKeyProperties : public media::KeySystemProperties -{ -public: - explicit ExternalClearKeyProperties(const std::string& key_system_name) - : key_system_name_(key_system_name) {} - - std::string GetKeySystemName() const override { return key_system_name_; } - bool IsSupportedInitDataType(media::EmeInitDataType init_data_type) const override - { - switch (init_data_type) { - case media::EmeInitDataType::WEBM: - case media::EmeInitDataType::KEYIDS: - return true; - - case media::EmeInitDataType::CENC: -#if BUILDFLAG(USE_PROPRIETARY_CODECS) - return true; -#else - return false; -#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) - - case media::EmeInitDataType::UNKNOWN: - return false; - } - NOTREACHED(); - return false; - } - - media::SupportedCodecs GetSupportedCodecs() const override - { -#if BUILDFLAG(USE_PROPRIETARY_CODECS) - return media::EME_CODEC_MP4_ALL | media::EME_CODEC_WEBM_ALL; -#else - return media::EME_CODEC_WEBM_ALL; -#endif - } - - media::EmeConfigRule GetRobustnessConfigRule( - media::EmeMediaType media_type, - const std::string& requested_robustness) const override - { - return requested_robustness.empty() ? media::EmeConfigRule::SUPPORTED - : media::EmeConfigRule::NOT_SUPPORTED; - } - - // Persistent license sessions are faked. - media::EmeSessionTypeSupport GetPersistentLicenseSessionSupport() const override - { - return media::EmeSessionTypeSupport::SUPPORTED; - } - - media::EmeSessionTypeSupport GetPersistentReleaseMessageSessionSupport() const override { - return media::EmeSessionTypeSupport::NOT_SUPPORTED; - } - - media::EmeFeatureSupport GetPersistentStateSupport() const override - { - return media::EmeFeatureSupport::REQUESTABLE; - } - - media::EmeFeatureSupport GetDistinctiveIdentifierSupport() const override - { - return media::EmeFeatureSupport::NOT_SUPPORTED; - } - - std::string GetPepperType() const override - { - return kExternalClearKeyPepperType; - } - -private: - const std::string key_system_name_; -}; - // External Clear Key (used for testing). static void AddExternalClearKey(std::vector<std::unique_ptr<media::KeySystemProperties>>* concrete_key_systems) { + // TODO(xhwang): Move these into an array so we can use a for loop to add + // supported key systems below. static const char kExternalClearKeyKeySystem[] = - "org.chromium.externalclearkey"; + "org.chromium.externalclearkey"; static const char kExternalClearKeyDecryptOnlyKeySystem[] = - "org.chromium.externalclearkey.decryptonly"; + "org.chromium.externalclearkey.decryptonly"; + static const char kExternalClearKeyMessageTypeTestKeySystem[] = + "org.chromium.externalclearkey.messagetypetest"; static const char kExternalClearKeyFileIOTestKeySystem[] = - "org.chromium.externalclearkey.fileiotest"; + "org.chromium.externalclearkey.fileiotest"; + static const char kExternalClearKeyOutputProtectionTestKeySystem[] = + "org.chromium.externalclearkey.outputprotectiontest"; + static const char kExternalClearKeyPlatformVerificationTestKeySystem[] = + "org.chromium.externalclearkey.platformverificationtest"; static const char kExternalClearKeyInitializeFailKeySystem[] = - "org.chromium.externalclearkey.initializefail"; + "org.chromium.externalclearkey.initializefail"; static const char kExternalClearKeyCrashKeySystem[] = - "org.chromium.externalclearkey.crash"; - - std::vector<content::WebPluginMimeType::Param> additional_params; - if (!IsPepperCdmAvailable(kExternalClearKeyPepperType, &additional_params)) + "org.chromium.externalclearkey.crash"; + static const char kExternalClearKeyVerifyCdmHostTestKeySystem[] = + "org.chromium.externalclearkey.verifycdmhosttest"; + static const char kExternalClearKeyStorageIdTestKeySystem[] = + "org.chromium.externalclearkey.storageidtest"; + static const char kExternalClearKeyDifferentGuidTestKeySystem[] = + "org.chromium.externalclearkey.differentguid"; + static const char kExternalClearKeyCdmProxyTestKeySystem[] = + "org.chromium.externalclearkey.cdmproxytest"; + + std::vector<media::VideoCodec> supported_video_codecs; + bool supports_persistent_license; + if (!content::IsKeySystemSupported(kExternalClearKeyKeySystem, + &supported_video_codecs, + &supports_persistent_license)) { return; + } concrete_key_systems->emplace_back( - new ExternalClearKeyProperties(kExternalClearKeyKeySystem)); + new cdm::ExternalClearKeyProperties(kExternalClearKeyKeySystem)); // Add support of decrypt-only mode in ClearKeyCdm. - concrete_key_systems->emplace_back( - new ExternalClearKeyProperties(kExternalClearKeyDecryptOnlyKeySystem)); + concrete_key_systems->emplace_back(new cdm::ExternalClearKeyProperties( + kExternalClearKeyDecryptOnlyKeySystem)); - // A key system that triggers FileIO test in ClearKeyCdm. - concrete_key_systems->emplace_back( - new ExternalClearKeyProperties(kExternalClearKeyFileIOTestKeySystem)); + // A key system that triggers various types of messages in ClearKeyCdm. + concrete_key_systems->emplace_back(new cdm::ExternalClearKeyProperties( + kExternalClearKeyMessageTypeTestKeySystem)); + + // A key system that triggers the FileIO test in ClearKeyCdm. + concrete_key_systems->emplace_back(new cdm::ExternalClearKeyProperties( + kExternalClearKeyFileIOTestKeySystem)); + + // A key system that triggers the output protection test in ClearKeyCdm. + concrete_key_systems->emplace_back(new cdm::ExternalClearKeyProperties( + kExternalClearKeyOutputProtectionTestKeySystem)); + + // A key system that triggers the platform verification test in ClearKeyCdm. + concrete_key_systems->emplace_back(new cdm::ExternalClearKeyProperties( + kExternalClearKeyPlatformVerificationTestKeySystem)); // A key system that Chrome thinks is supported by ClearKeyCdm, but actually // will be refused by ClearKeyCdm. This is to test the CDM initialization // failure case. - concrete_key_systems->emplace_back( - new ExternalClearKeyProperties(kExternalClearKeyInitializeFailKeySystem)); + concrete_key_systems->emplace_back(new cdm::ExternalClearKeyProperties( + kExternalClearKeyInitializeFailKeySystem)); // A key system that triggers a crash in ClearKeyCdm. - concrete_key_systems->emplace_back( - new ExternalClearKeyProperties(kExternalClearKeyCrashKeySystem)); + concrete_key_systems->emplace_back(new cdm::ExternalClearKeyProperties( + kExternalClearKeyCrashKeySystem)); + + // A key system that triggers the verify host files test in ClearKeyCdm. + concrete_key_systems->emplace_back(new cdm::ExternalClearKeyProperties( + kExternalClearKeyVerifyCdmHostTestKeySystem)); + + // A key system that fetches the Storage ID in ClearKeyCdm. + concrete_key_systems->emplace_back(new cdm::ExternalClearKeyProperties( + kExternalClearKeyStorageIdTestKeySystem)); + + // A key system that is registered with a different CDM GUID. + concrete_key_systems->emplace_back(new cdm::ExternalClearKeyProperties( + kExternalClearKeyDifferentGuidTestKeySystem)); + + // A key system that triggers CDM Proxy test in ClearKeyCdm. + concrete_key_systems->emplace_back(new cdm::ExternalClearKeyProperties( + kExternalClearKeyCdmProxyTestKeySystem)); } #if defined(WIDEVINE_CDM_AVAILABLE) -static void AddPepperBasedWidevine(std::vector<std::unique_ptr<media::KeySystemProperties>> *concrete_key_systems) +static void AddWidevine(std::vector<std::unique_ptr<media::KeySystemProperties>> *concrete_key_systems) { -//#if defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) -// Version glibc_version(gnu_get_libc_version()); -// DCHECK(glibc_version.IsValid()); -// if (glibc_version.IsOlderThan(WIDEVINE_CDM_MIN_GLIBC_VERSION)) -// return; -//#endif // defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) - - std::vector<content::WebPluginMimeType::Param> additional_params; - if (!IsPepperCdmAvailable(kWidevineCdmPluginMimeType, &additional_params)) { + std::vector<media::VideoCodec> supported_video_codecs; + bool supports_persistent_license = false; + if (!content::IsKeySystemSupported(kWidevineKeySystem, + &supported_video_codecs, + &supports_persistent_license)) { DVLOG(1) << "Widevine CDM is not currently available."; return; } media::SupportedCodecs supported_codecs = media::EME_CODEC_NONE; + // Audio codecs are always supported. + // TODO(sandersd): Distinguish these from those that are directly supported, + // as those may offer a higher level of protection. supported_codecs |= media::EME_CODEC_WEBM_OPUS; supported_codecs |= media::EME_CODEC_WEBM_VORBIS; - supported_codecs |= media::EME_CODEC_WEBM_VP8; - supported_codecs |= media::EME_CODEC_WEBM_VP9; #if BUILDFLAG(USE_PROPRIETARY_CODECS) - supported_codecs |= media::EME_CODEC_MP4_AVC1; supported_codecs |= media::EME_CODEC_MP4_AAC; #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) + // Video codecs are determined by what was registered for the CDM. + for (const auto& codec : supported_video_codecs) { + switch (codec) { + case media::VideoCodec::kCodecVP8: + supported_codecs |= media::EME_CODEC_WEBM_VP8; + break; + case media::VideoCodec::kCodecVP9: + supported_codecs |= media::EME_CODEC_WEBM_VP9; + supported_codecs |= media::EME_CODEC_COMMON_VP9; + break; +#if BUILDFLAG(USE_PROPRIETARY_CODECS) + case media::VideoCodec::kCodecH264: + supported_codecs |= media::EME_CODEC_MP4_AVC1; + break; +#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) + default: + DVLOG(1) << "Unexpected supported codec: " << GetCodecName(codec); + break; + } + } + + media::EmeSessionTypeSupport persistent_license_support = media::EmeSessionTypeSupport::NOT_SUPPORTED; + using Robustness = cdm::WidevineKeySystemProperties::Robustness; + concrete_key_systems->emplace_back(new cdm::WidevineKeySystemProperties( - supported_codecs, - Robustness::SW_SECURE_CRYPTO, // Maximum audio robustness. - Robustness::SW_SECURE_DECODE, // Maximum video robustness. - media::EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-license. - media::EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-release-message. - media::EmeFeatureSupport::REQUESTABLE, // Persistent state. - media::EmeFeatureSupport::NOT_SUPPORTED)); // Distinctive identifier. + supported_codecs, + Robustness::SW_SECURE_CRYPTO, // Maximum audio robustness. + Robustness::SW_SECURE_DECODE, // Maximum video robustness. + persistent_license_support, // persistent-license. + media::EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-release-message. + media::EmeFeatureSupport::REQUESTABLE, // Persistent state. + media::EmeFeatureSupport::NOT_SUPPORTED)); // Distinctive identifier. + } -#endif // defined(WIDEVINE_CDM_AVAILABLE) -#endif // BUILDFLAG(ENABLE_PEPPER_CDMS) +#endif // defined(WIDEVINE_CDM_AVAILABLE) +#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) void ContentRendererClientQt::AddSupportedKeySystems(std::vector<std::unique_ptr<media::KeySystemProperties>> *key_systems) { #if BUILDFLAG(ENABLE_LIBRARY_CDMS) - AddExternalClearKey(key_systems); + if (base::FeatureList::IsEnabled(media::kExternalClearKeyForTesting)) + AddExternalClearKey(key_systems); #if defined(WIDEVINE_CDM_AVAILABLE) - AddPepperBasedWidevine(key_systems); -#endif // defined(WIDEVINE_CDM_AVAILABLE) -#endif // BUILDFLAG(ENABLE_PEPPER_CDMS) + AddWidevine(key_systems); +#endif // defined(WIDEVINE_CDM_AVAILABLE) + +#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) } #if BUILDFLAG(ENABLE_SPELLCHECK) diff --git a/src/core/renderer/content_renderer_client_qt.h b/src/core/renderer/content_renderer_client_qt.h index 9da664398..3ef199874 100644 --- a/src/core/renderer/content_renderer_client_qt.h +++ b/src/core/renderer/content_renderer_client_qt.h @@ -40,7 +40,7 @@ #define CONTENT_RENDERER_CLIENT_QT_H #include "content/public/renderer/content_renderer_client.h" -#include "components/spellcheck/spellcheck_build_features.h" +#include "components/spellcheck/spellcheck_buildflags.h" #include "services/service_manager/public/cpp/binder_registry.h" #include "services/service_manager/public/cpp/connector.h" #include "services/service_manager/public/cpp/local_interface_provider.h" diff --git a/src/core/renderer/content_settings_observer_qt.cpp b/src/core/renderer/content_settings_observer_qt.cpp index bfd0c96f8..045098457 100644 --- a/src/core/renderer/content_settings_observer_qt.cpp +++ b/src/core/renderer/content_settings_observer_qt.cpp @@ -45,10 +45,10 @@ #include "content_settings_observer_qt.h" #include "content/public/renderer/render_frame.h" -#include "third_party/WebKit/public/platform/WebContentSettingCallbacks.h" -#include "third_party/WebKit/public/platform/WebSecurityOrigin.h" -#include "third_party/WebKit/public/web/WebDocument.h" -#include "third_party/WebKit/public/web/WebLocalFrame.h" +#include "third_party/blink/public/platform/web_content_setting_callbacks.h" +#include "third_party/blink/public/platform/web_security_origin.h" +#include "third_party/blink/public/web/web_plugin_document.h" +#include "third_party/blink/public/web/web_local_frame.h" #include "url/origin.h" #include "common/qt_messages.h" diff --git a/src/core/renderer/content_settings_observer_qt.h b/src/core/renderer/content_settings_observer_qt.h index 07dcbe350..981655f20 100644 --- a/src/core/renderer/content_settings_observer_qt.h +++ b/src/core/renderer/content_settings_observer_qt.h @@ -47,7 +47,7 @@ #include "base/containers/flat_map.h" #include "content/public/renderer/render_frame_observer.h" #include "content/public/renderer/render_frame_observer_tracker.h" -#include "third_party/WebKit/public/platform/WebContentSettingsClient.h" +#include "third_party/blink/public/platform/web_content_settings_client.h" #include "url/gurl.h" namespace blink { diff --git a/src/core/renderer/print_web_view_helper_delegate_qt.cpp b/src/core/renderer/print_web_view_helper_delegate_qt.cpp index 4a17f7dec..79d86b00f 100644 --- a/src/core/renderer/print_web_view_helper_delegate_qt.cpp +++ b/src/core/renderer/print_web_view_helper_delegate_qt.cpp @@ -42,7 +42,7 @@ // found in the LICENSE.Chromium file. #include "print_web_view_helper_delegate_qt.h" -#include "third_party/WebKit/public/web/WebElement.h" +#include "third_party/blink/public/web/web_element.h" #include "web_engine_library_info.h" namespace QtWebEngineCore { diff --git a/src/core/renderer/render_frame_observer_qt.h b/src/core/renderer/render_frame_observer_qt.h index ac098a961..c641621da 100644 --- a/src/core/renderer/render_frame_observer_qt.h +++ b/src/core/renderer/render_frame_observer_qt.h @@ -43,7 +43,7 @@ #include "base/compiler_specific.h" #include "content/public/renderer/render_frame_observer.h" #include "content/public/renderer/render_frame_observer_tracker.h" -#include "ppapi/features/features.h" +#include "ppapi/buildflags/buildflags.h" namespace content { diff --git a/src/core/renderer/render_view_observer_qt.cpp b/src/core/renderer/render_view_observer_qt.cpp index 4893a5188..d37b67ebc 100644 --- a/src/core/renderer/render_view_observer_qt.cpp +++ b/src/core/renderer/render_view_observer_qt.cpp @@ -43,13 +43,13 @@ #include "components/web_cache/renderer/web_cache_impl.h" #include "content/public/renderer/render_view.h" -#include "third_party/WebKit/public/web/WebDocument.h" -#include "third_party/WebKit/public/web/WebElement.h" -#include "third_party/WebKit/public/web/WebFrame.h" -#include "third_party/WebKit/public/web/WebFrameContentDumper.h" -#include "third_party/WebKit/public/web/WebFrameWidget.h" -#include "third_party/WebKit/public/web/WebLocalFrame.h" -#include "third_party/WebKit/public/web/WebView.h" +#include "third_party/blink/public/web/web_document.h" +#include "third_party/blink/public/web/web_element.h" +#include "third_party/blink/public/web/web_frame.h" +#include "third_party/blink/public/web/web_frame_content_dumper.h" +#include "third_party/blink/public/web/web_frame_widget.h" +#include "third_party/blink/public/web/web_local_frame.h" +#include "third_party/blink/public/web/web_view.h" RenderViewObserverQt::RenderViewObserverQt( content::RenderView* render_view, diff --git a/src/core/renderer/user_resource_controller.cpp b/src/core/renderer/user_resource_controller.cpp index 6e28564f8..b8cf8b077 100644 --- a/src/core/renderer/user_resource_controller.cpp +++ b/src/core/renderer/user_resource_controller.cpp @@ -47,10 +47,10 @@ #include "content/public/renderer/render_frame_observer.h" #include "content/public/renderer/render_view_observer.h" #include "extensions/common/url_pattern.h" -#include "third_party/WebKit/public/web/WebDocument.h" -#include "third_party/WebKit/public/web/WebLocalFrame.h" -#include "third_party/WebKit/public/web/WebScriptSource.h" -#include "third_party/WebKit/public/web/WebView.h" +#include "third_party/blink/public/web/web_document.h" +#include "third_party/blink/public/web/web_local_frame.h" +#include "third_party/blink/public/web/web_script_source.h" +#include "third_party/blink/public/web/web_view.h" #include "v8/include/v8.h" #include "common/qt_messages.h" diff --git a/src/core/renderer/web_channel_ipc_transport.cpp b/src/core/renderer/web_channel_ipc_transport.cpp index ef00bcef3..70aeabdcf 100644 --- a/src/core/renderer/web_channel_ipc_transport.cpp +++ b/src/core/renderer/web_channel_ipc_transport.cpp @@ -49,8 +49,8 @@ #include "gin/handle.h" #include "gin/object_template_builder.h" #include "gin/wrappable.h" -#include "third_party/WebKit/public/web/WebKit.h" -#include "third_party/WebKit/public/web/WebLocalFrame.h" +#include "third_party/blink/public/web/blink.h" +#include "third_party/blink/public/web/web_local_frame.h" #include "v8/include/v8.h" #include <QJsonDocument> diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 31379a0f2..f3bba89a8 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -81,8 +81,8 @@ #include "content/public/common/url_constants.h" #include "content/public/common/web_preferences.h" #include "content/public/common/webrtc_ip_handling_policy.h" -#include "third_party/WebKit/public/web/WebFindOptions.h" -#include "printing/features/features.h" +#include "third_party/blink/public/web/web_find_options.h" +#include "printing/buildflags/buildflags.h" #include "ui/base/clipboard/clipboard.h" #include "ui/base/clipboard/custom_data_helper.h" #include "ui/gfx/font_render_params.h" @@ -1096,7 +1096,8 @@ void WebContentsAdapter::inspectElementAt(const QPoint &location) return; } if (content::DevToolsAgentHost::HasFor(m_webContents.get())) - content::DevToolsAgentHost::GetOrCreateFor(m_webContents.get())->InspectElement(nullptr, location.x(), location.y()); + content::DevToolsAgentHost::GetOrCreateFor(m_webContents.get())->InspectElement( + m_webContents->GetFocusedFrame(), location.x(), location.y()); } bool WebContentsAdapter::hasInspector() const @@ -1201,8 +1202,8 @@ quint64 WebContentsAdapter::printToPDFCallbackResult(const QPageLayout &pageLayo QPointF WebContentsAdapter::lastScrollOffset() const { CHECK_INITIALIZED(QPointF()); - if (content::RenderWidgetHostView *rwhv = m_webContents->GetRenderWidgetHostView()) - return toQt(rwhv->GetLastScrollOffset()); + if (RenderWidgetHostViewQt *rwhv = static_cast<RenderWidgetHostViewQt *>(m_webContents->GetRenderWidgetHostView())) + return toQt(rwhv->lastScrollOffset()); return QPointF(); } diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 3ebeaeb38..fb7071b7a 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -340,7 +340,7 @@ void WebContentsDelegateQt::didFailLoad(const QUrl &url, int errorCode, const QS void WebContentsDelegateQt::DidFailLoad(content::RenderFrameHost* render_frame_host, const GURL& validated_url, int error_code, const base::string16& error_description) { - if (render_frame_host->GetParent()) + if (render_frame_host != web_contents()->GetMainFrame()) return; if (validated_url.spec() == content::kUnreachableWebDataURL) { @@ -619,7 +619,7 @@ void WebContentsDelegateQt::BeforeUnloadFired(const base::TimeTicks &proceed_tim Q_UNUSED(proceed_time); } -bool WebContentsDelegateQt::CheckMediaAccessPermission(content::WebContents *web_contents, const GURL& security_origin, content::MediaStreamType type) +bool WebContentsDelegateQt::CheckMediaAccessPermission(content::RenderFrameHost *, const GURL& security_origin, content::MediaStreamType type) { switch (type) { case content::MEDIA_DEVICE_AUDIO_CAPTURE: diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index 07d99a52d..b120ec95a 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -124,7 +124,7 @@ public: void UpdateTargetURL(content::WebContents* source, const GURL& url) override; 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::WebContents *web_contents, const GURL& security_origin, content::MediaStreamType type) override; + bool CheckMediaAccessPermission(content::RenderFrameHost* render_frame_host, const GURL& security_origin, content::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; diff --git a/src/core/web_contents_view_qt.cpp b/src/core/web_contents_view_qt.cpp index b680aee0f..1727d2d49 100644 --- a/src/core/web_contents_view_qt.cpp +++ b/src/core/web_contents_view_qt.cpp @@ -46,7 +46,7 @@ #include "web_contents_adapter.h" #include "web_engine_context.h" -#include "components/spellcheck/spellcheck_build_features.h" +#include "components/spellcheck/spellcheck_buildflags.h" #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/public/common/context_menu_params.h" #include <ui/gfx/image/image_skia.h> diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 8feff40a2..8a76bb683 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -56,7 +56,7 @@ #include "content/browser/devtools/devtools_http_handler.h" #include "content/browser/gpu/gpu_main_thread_factory.h" #include "content/browser/renderer_host/render_process_host_impl.h" -#include "content/browser/utility_process_host_impl.h" +#include "content/browser/utility_process_host.h" #include "content/gpu/in_process_gpu_thread.h" #include "content/public/app/content_main.h" #include "content/public/app/content_main_runner.h" @@ -73,7 +73,7 @@ #include "gpu/ipc/host/gpu_switches.h" #include "media/audio/audio_manager.h" #include "net/base/port_util.h" -#include "ppapi/features/features.h" +#include "ppapi/buildflags/buildflags.h" #include "services/service_manager/sandbox/switches.h" #include "ui/events/event_switches.h" #include "ui/native_theme/native_theme_features.h" @@ -522,7 +522,7 @@ WebEngineContext::WebEngineContext() parsedCommandLine->AppendSwitch(switches::kDisableGpu); } - content::UtilityProcessHostImpl::RegisterUtilityMainThreadFactory(content::CreateInProcessUtilityThread); + content::UtilityProcessHost::RegisterUtilityMainThreadFactory(content::CreateInProcessUtilityThread); content::RenderProcessHostImpl::RegisterRendererMainThreadFactory(content::CreateInProcessRendererThread); content::RegisterGpuMainThreadFactory(content::CreateInProcessGpuThread); diff --git a/src/core/web_engine_context.h b/src/core/web_engine_context.h index 73bda03fb..646123121 100644 --- a/src/core/web_engine_context.h +++ b/src/core/web_engine_context.h @@ -46,7 +46,8 @@ #include "base/memory/ref_counted.h" #include "base/values.h" -#include "printing/features/features.h" +#include "printing/buildflags/buildflags.h" + #include <QVector> namespace base { diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp index 950be89b9..dbf978839 100644 --- a/src/core/web_engine_library_info.cpp +++ b/src/core/web_engine_library_info.cpp @@ -43,7 +43,7 @@ #include "base/base_paths.h" #include "base/command_line.h" #include "base/files/file_util.h" -#include "components/spellcheck/spellcheck_build_features.h" +#include "components/spellcheck/spellcheck_buildflags.h" #include "content/public/common/content_paths.h" #include "ui/base/ui_base_paths.h" #include "ui/base/ui_base_switches.h" diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index 1eeca8093..b8e8b1689 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -65,7 +65,7 @@ */ #include "web_event_factory.h" -#include "third_party/WebKit/Source/platform/WindowsKeyboardCodes.h" +#include "third_party/blink/renderer/platform/windows_keyboard_codes.h" #include "ui/events/keycodes/dom/dom_code.h" #include "ui/events/keycodes/dom/dom_key.h" #include "ui/events/keycodes/dom/keycode_converter.h" @@ -1266,13 +1266,13 @@ WebGestureEvent WebEventFactory::toWebGestureEvent(QNativeGestureEvent *ev, doub webKitEvent.SetTimeStampSeconds(currentTimeForEvent(ev)); webKitEvent.SetModifiers(modifiersForEvent(ev)); - webKitEvent.x = static_cast<int>(ev->localPos().x() / dpiScale); - webKitEvent.y = static_cast<int>(ev->localPos().y() / dpiScale); + webKitEvent.SetPositionInWidget(WebFloatPoint(ev->localPos().x() / dpiScale, + ev->localPos().y() / dpiScale)); - webKitEvent.global_x = static_cast<int>(ev->screenPos().x() / dpiScale); - webKitEvent.global_y = static_cast<int>(ev->screenPos().y() / dpiScale); + webKitEvent.SetPositionInScreen(WebFloatPoint(ev->screenPos().x() / dpiScale, + ev->screenPos().y() / dpiScale)); - webKitEvent.source_device = blink::kWebGestureDeviceTouchpad; + webKitEvent.SetSourceDevice(blink::kWebGestureDeviceTouchpad); Qt::NativeGestureType gestureType = ev->gestureType(); switch (gestureType) { diff --git a/src/core/web_event_factory.h b/src/core/web_event_factory.h index 442f04054..dc29970a7 100644 --- a/src/core/web_event_factory.h +++ b/src/core/web_event_factory.h @@ -42,10 +42,10 @@ #include "content/public/browser/native_web_keyboard_event.h" #ifndef QT_NO_GESTURES -#include "third_party/WebKit/public/platform/WebGestureEvent.h" +#include "third_party/blink/public/platform/web_gesture_event.h" #endif -#include "third_party/WebKit/public/platform/WebMouseEvent.h" -#include "third_party/WebKit/public/platform/WebMouseWheelEvent.h" +#include "third_party/blink/public/platform/web_mouse_event.h" +#include "third_party/blink/public/platform/web_mouse_wheel_event.h" #include <QtGlobal> diff --git a/tests/auto/quick/inspectorserver/tst_inspectorserver.cpp b/tests/auto/quick/inspectorserver/tst_inspectorserver.cpp index 5f47ee797..8e23e86e8 100644 --- a/tests/auto/quick/inspectorserver/tst_inspectorserver.cpp +++ b/tests/auto/quick/inspectorserver/tst_inspectorserver.cpp @@ -167,7 +167,7 @@ void tst_InspectorServer::openRemoteDebuggingSession() // - The page list didn't return a valid inspector URL // - Or the front-end couldn't be loaded through the inspector HTTP server // - Or the web socket connection couldn't be established between the front-end and the page through the inspector server - QTRY_VERIFY(inspectorWebView->title().startsWith("Developer Tools -")); + QTRY_VERIFY(inspectorWebView->title().startsWith("DevTools -")); } QTEST_MAIN(tst_InspectorServer) diff --git a/tests/auto/quick/qmltests/data/tst_favicon.qml b/tests/auto/quick/qmltests/data/tst_favicon.qml index 0aa8f0bb8..563a87c83 100644 --- a/tests/auto/quick/qmltests/data/tst_favicon.qml +++ b/tests/auto/quick/qmltests/data/tst_favicon.qml @@ -182,7 +182,7 @@ TestWebEngineView { var url = Qt.resolvedUrl("http://url.invalid") webEngineView.url = url - verify(webEngineView.waitForLoadFailed()) + verify(webEngineView.waitForLoadFailed(20000)) verify(webEngineView.testSupport.waitForErrorPageLoadSucceeded()) compare(iconChangedSpy.count, 0) @@ -198,7 +198,7 @@ TestWebEngineView { var url = Qt.resolvedUrl("http://url.invalid") webEngineView.url = url - verify(webEngineView.waitForLoadFailed()) + verify(webEngineView.waitForLoadFailed(20000)) compare(iconChangedSpy.count, 0) diff --git a/tests/auto/quick/qmltests/data/tst_getUserMedia.qml b/tests/auto/quick/qmltests/data/tst_getUserMedia.qml index b497542e3..d1c894699 100644 --- a/tests/auto/quick/qmltests/data/tst_getUserMedia.qml +++ b/tests/auto/quick/qmltests/data/tst_getUserMedia.qml @@ -32,11 +32,14 @@ import QtWebEngine 1.6 TestWebEngineView { id: webEngineView + width: 400 + height: 400 settings.screenCaptureEnabled: true TestCase { name: "GetUserMedia" + when: windowShown function init_data() { return [ diff --git a/tests/auto/quick/qmltests/data/tst_loadUrl.qml b/tests/auto/quick/qmltests/data/tst_loadUrl.qml index d1b6d6099..ec5c965ea 100644 --- a/tests/auto/quick/qmltests/data/tst_loadUrl.qml +++ b/tests/auto/quick/qmltests/data/tst_loadUrl.qml @@ -204,7 +204,7 @@ TestWebEngineView { // Test loadHtml after a failed load var aboutBlank = "about:blank"; webEngineView.url = aboutBlank; // Reset from previous test - verify(webEngineView.waitForLoadSucceeded()); + tryCompare(loadRequestArray, "length", 2); webEngineView.clear(); var bogusSite = "http://www.somesitethatdoesnotexist.abc/"; @@ -217,7 +217,7 @@ TestWebEngineView { } webEngineView.loadingChanged.connect(handleLoadFailed); webEngineView.url = bogusSite - tryCompare(loadRequestArray, "length", 4, 12000); + tryCompare(loadRequestArray, "length", 4, 30000); webEngineView.loadingChanged.disconnect(handleLoadFailed); loadRequest = loadRequestArray[0]; diff --git a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp index 42e96c0f5..cf695228c 100644 --- a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp +++ b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp @@ -364,7 +364,7 @@ void tst_QQuickWebEngineView::basicRenderingSanity() { showWebEngineView(); - webEngineView()->setUrl(QUrl(QString::fromUtf8("data:text/html,<html><body bgcolor=\"#00ff00\"></body></html>"))); + webEngineView()->setUrl(QUrl(QString::fromUtf8("data:text/html,<html><body bgcolor=\"%2300ff00\"></body></html>"))); QVERIFY(waitForLoadSucceeded(webEngineView())); // This should not crash. diff --git a/tests/auto/widgets/origins/tst_origins.cpp b/tests/auto/widgets/origins/tst_origins.cpp index d6eeff204..6b1b4bba5 100644 --- a/tests/auto/widgets/origins/tst_origins.cpp +++ b/tests/auto/widgets/origins/tst_origins.cpp @@ -257,10 +257,10 @@ void tst_Origins::webSocket() const int expected = 1006; QVERIFY(load(QSL("file:" THIS_DIR "resources/websocket.html"))); - QTRY_COMPARE_WITH_TIMEOUT(eval(QSL("err")), QVariant(expected), 10000); + QTRY_COMPARE_WITH_TIMEOUT(eval(QSL("err")), QVariant(expected), 20000); QVERIFY(load(QSL("qrc:/resources/websocket.html"))); - QTRY_COMPARE_WITH_TIMEOUT(eval(QSL("err")), QVariant(expected), 10000); + QTRY_COMPARE_WITH_TIMEOUT(eval(QSL("err")), QVariant(expected), 20000); QVERIFY(load(QSL("tst:/resources/websocket.html"))); QTRY_VERIFY(eval(QSL("err")) == QVariant(expected)); diff --git a/tests/auto/widgets/qwebenginedownloads/tst_qwebenginedownloads.cpp b/tests/auto/widgets/qwebenginedownloads/tst_qwebenginedownloads.cpp index f932d50c3..34bfb6bb6 100644 --- a/tests/auto/widgets/qwebenginedownloads/tst_qwebenginedownloads.cpp +++ b/tests/auto/widgets/qwebenginedownloads/tst_qwebenginedownloads.cpp @@ -284,7 +284,7 @@ void tst_QWebEngineDownloads::downloadLink_data() /* fileMimeTypeDeclared */ << QByteArrayLiteral("text/plain") /* fileMimeTypeDetected */ << QByteArrayLiteral("text/plain") /* fileDisposition */ << QByteArrayLiteral("") - /* fileHasReferer */ << true + /* fileHasReferer */ << false // crbug.com/455987 /* fileAction */ << FileIsDownloaded; // ... same with the content disposition header save for the download type. @@ -308,7 +308,7 @@ void tst_QWebEngineDownloads::downloadLink_data() /* fileMimeTypeDeclared */ << QByteArrayLiteral("text/plain") /* fileMimeTypeDetected */ << QByteArrayLiteral("text/plain") /* fileDisposition */ << QByteArrayLiteral("attachment") - /* fileHasReferer */ << true + /* fileHasReferer */ << false // crbug.com/455987 /* fileAction */ << FileIsDownloaded; // The file's extension has no effect. diff --git a/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp b/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp index da041ee59..49984f987 100644 --- a/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp +++ b/tests/auto/widgets/qwebenginefaviconmanager/tst_qwebenginefaviconmanager.cpp @@ -239,7 +239,7 @@ void tst_QWebEngineFaviconManager::errorPageEnabled() QUrl url("http://url.invalid"); m_page->load(url); - QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 14000); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 20000); QCOMPARE(iconUrlChangedSpy.count(), 0); QCOMPARE(iconChangedSpy.count(), 0); diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index 0673b67ee..ed545fa80 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -2395,6 +2395,15 @@ void tst_QWebEnginePage::getUserMediaRequest() QFETCH(QWebEnginePage::Feature, feature); GetUserMediaTestPage page; + if (feature == QWebEnginePage::DesktopVideoCapture || feature == QWebEnginePage::DesktopAudioVideoCapture) { + // Desktop capture needs to be on a desktop. + QWebEngineView view; + view.setPage(&page); + view.resize(640, 480); + view.show(); + QVERIFY(QTest::qWaitForWindowExposed(&view)); + } + QTRY_VERIFY_WITH_TIMEOUT(page.loadSucceeded(), 20000); page.settings()->setAttribute(QWebEngineSettings::ScreenCaptureEnabled, true); diff --git a/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp b/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp index 150b3c554..0704cf383 100644 --- a/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp +++ b/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp @@ -42,8 +42,6 @@ private Q_SLOTS: void tst_QWebEngineSettings::resetAttributes() { - // QT_TODO_FIXME_ADAPT - QSKIP("The application deadlocks and hangs without exiting."); QWebEngineProfile profile; QWebEngineSettings *settings = profile.settings(); @@ -85,8 +83,6 @@ void tst_QWebEngineSettings::defaultFontFamily_data() void tst_QWebEngineSettings::defaultFontFamily() { - // QT_TODO_FIXME_ADAPT - QSKIP("The application deadlocks and hangs without exiting."); QWebEngineProfile profile; QWebEngineSettings *settings = profile.settings(); @@ -151,8 +147,8 @@ void tst_QWebEngineSettings::javascriptClipboard() QCOMPARE(evaluateJavaScriptSync(&page, "document.queryCommandEnabled('copy')").toBool(), copyResult); QCOMPARE(evaluateJavaScriptSync(&page, "document.execCommand('copy')").toBool(), copyResult); - QCOMPARE(QApplication::clipboard()->text(), - (copyResult ? QString("OriginalText") : QString())); + QTRY_COMPARE(QApplication::clipboard()->text(), + (copyResult ? QString("OriginalText") : QString())); QGuiApplication::clipboard()->setText("AnotherText"); diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp index 2a39124d4..d7ae96962 100644 --- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp +++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp @@ -1069,7 +1069,7 @@ void tst_QWebEngineView::changeLocale() QWebEngineView viewDE; QSignalSpy loadFinishedSpyDE(&viewDE, SIGNAL(loadFinished(bool))); viewDE.load(url); - QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpyDE.count(), 1, 12000); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpyDE.count(), 1, 20000); QTRY_VERIFY(!toPlainTextSync(viewDE.page()).isEmpty()); errorLines = toPlainTextSync(viewDE.page()).split(QRegExp("[\r\n]"), QString::SkipEmptyParts); @@ -1079,7 +1079,7 @@ void tst_QWebEngineView::changeLocale() QWebEngineView viewEN; QSignalSpy loadFinishedSpyEN(&viewEN, SIGNAL(loadFinished(bool))); viewEN.load(url); - QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpyEN.count(), 1, 12000); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpyEN.count(), 1, 20000); QTRY_VERIFY(!toPlainTextSync(viewEN.page()).isEmpty()); errorLines = toPlainTextSync(viewEN.page()).split(QRegExp("[\r\n]"), QString::SkipEmptyParts); @@ -1092,7 +1092,7 @@ void tst_QWebEngineView::changeLocale() // Check whether an existing QWebEngineView keeps the language settings after changing the default locale viewDE.load(url); - QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpyDE.count(), 1, 12000); + QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpyDE.count(), 1, 20000); QTRY_VERIFY(!toPlainTextSync(viewDE.page()).isEmpty()); errorLines = toPlainTextSync(viewDE.page()).split(QRegExp("[\r\n]"), QString::SkipEmptyParts); @@ -2724,7 +2724,6 @@ void tst_QWebEngineView::webUIURLs_data() QTest::newRow("usb-internals") << QUrl("chrome://usb-internals") << false; QTest::newRow("user-actions") << QUrl("chrome://user-actions") << false; QTest::newRow("version") << QUrl("chrome://version") << false; - QTest::newRow("view-http-cache") << QUrl("chrome://view-http-cache") << true; QTest::newRow("webrtc-internals") << QUrl("chrome://webrtc-internals") << true; QTest::newRow("webrtc-logs") << QUrl("chrome://webrtc-logs") << false; } diff --git a/tools/scripts/git_submodule.py b/tools/scripts/git_submodule.py index bf931563c..684a8af67 100644 --- a/tools/scripts/git_submodule.py +++ b/tools/scripts/git_submodule.py @@ -67,7 +67,7 @@ class DEPSParser: url = '' if (type(scope[dep]) == str): url = scope[dep] - elif (type(scope[dep]) == dict): + elif (type(scope[dep]) == dict and 'url' in scope[dep]): url = scope[dep]['url'] if ('condition' in scope[dep]) and (not 'checkout_linux' in scope[dep]['condition']): diff --git a/tools/scripts/take_snapshot.py b/tools/scripts/take_snapshot.py index 50191621a..6cb55e5c4 100755 --- a/tools/scripts/take_snapshot.py +++ b/tools/scripts/take_snapshot.py @@ -242,6 +242,7 @@ def isInChromiumBlacklist(file_path): or file_path.startswith('ui/events/ozone/chromeos') or file_path.startswith('ui/file_manager') or file_path.startswith('ui/gfx/chromeos') + or file_path.startswith('v8/third_party/antlr4') ): return True diff --git a/tools/scripts/version_resolver.py b/tools/scripts/version_resolver.py index 21fae9ee4..748205d51 100644 --- a/tools/scripts/version_resolver.py +++ b/tools/scripts/version_resolver.py @@ -38,8 +38,8 @@ import json import urllib2 import git_submodule as GitSubmodule -chromium_version = '66.0.3359.156' -chromium_branch = '3359' +chromium_version = '67.0.3396.76' +chromium_branch = '3396' ninja_version = 'v1.8.2' json_url = 'http://omahaproxy.appspot.com/all.json' |