diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-07-06 11:40:44 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-07-06 11:45:46 +0200 |
commit | b3f7d3a62e00e611e8d7f592ae048a9536b635c6 (patch) | |
tree | e88ce4289a42dbfcc828fab1f96dbabbf1572725 | |
parent | c0d5f7e6c10e56777b025b83a1fc53c610927714 (diff) | |
parent | 80a2497207b3824852578df63b30d8af4ee800a3 (diff) |
Merge Chromium 44 and fixes
Bumbs the Chromium version to 44 and merges the 'wip/44-based' branch,
which contains all the patches to build against Chromium 44.
Change-Id: If03dd301cb2a5cf7da3fe0a92ce1134f1239bf00
60 files changed, 816 insertions, 494 deletions
diff --git a/src/3rdparty b/src/3rdparty -Subproject 85827b2c3db3c4cb6308ce8a4c2069c0e403cd9 +Subproject 82846fd95406c4f8fc34def96486c12e87f21e7 diff --git a/src/core/api/qwebenginecookiestoreclient.cpp b/src/core/api/qwebenginecookiestoreclient.cpp index c8b314be9..b0e91021d 100644 --- a/src/core/api/qwebenginecookiestoreclient.cpp +++ b/src/core/api/qwebenginecookiestoreclient.cpp @@ -113,12 +113,6 @@ void QWebEngineCookieStoreClientPrivate::onCookieChanged(const QNetworkCookie &c Q_EMIT q->cookieAdded(cookie); } -void QWebEngineCookieStoreClientPrivate::onCookieStoreLoaded() -{ - Q_Q(QWebEngineCookieStoreClient); - Q_EMIT q->cookieStoreLoaded(); -} - QWebEngineCookieStoreClient::QWebEngineCookieStoreClient(QObject *parent) : QObject(parent) , d_ptr(new QWebEngineCookieStoreClientPrivate(this)) diff --git a/src/core/api/qwebenginecookiestoreclient.h b/src/core/api/qwebenginecookiestoreclient.h index 3ab7df14f..58a332542 100644 --- a/src/core/api/qwebenginecookiestoreclient.h +++ b/src/core/api/qwebenginecookiestoreclient.h @@ -69,7 +69,6 @@ public: Q_SIGNALS: void cookieAdded(const QNetworkCookie &cookie); void cookieRemoved(const QNetworkCookie &cookie); - void cookieStoreLoaded(); private: friend class QtWebEngineCore::CookieMonsterDelegateQt; diff --git a/src/core/api/qwebenginecookiestoreclient_p.h b/src/core/api/qwebenginecookiestoreclient_p.h index aedb473cd..4a0f280f5 100644 --- a/src/core/api/qwebenginecookiestoreclient_p.h +++ b/src/core/api/qwebenginecookiestoreclient_p.h @@ -86,7 +86,6 @@ public: void onSetCallbackResult(qint64 callbackId, bool success); void onCookieChanged(const QNetworkCookie &cookie, bool removed); - void onCookieStoreLoaded(); }; QT_END_NAMESPACE diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp index 5460cf65d..9d4fdfe00 100644 --- a/src/core/browser_accessibility_qt.cpp +++ b/src/core/browser_accessibility_qt.cpp @@ -59,82 +59,6 @@ BrowserAccessibilityQt::BrowserAccessibilityQt() QAccessible::registerAccessibleInterface(this); } -// This function is taken from chromium/content/browser/accessibility/browser_accessibility_win.cc -// see also http://www.w3.org/TR/html-aapi -void BrowserAccessibilityQt::OnDataChanged() -{ - BrowserAccessibility::OnDataChanged(); - - // The calculation of the accessible name of an element has been - // standardized in the HTML to Platform Accessibility APIs Implementation - // Guide (http://www.w3.org/TR/html-aapi/). In order to return the - // appropriate accessible name on Windows, we need to apply some logic - // to the fields we get from WebKit. - // - // TODO(dmazzoni): move most of this logic into WebKit. - // - // WebKit gives us: - // - // name: the default name, e.g. inner text - // title ui element: a reference to a <label> element on the same - // page that labels this node. - // description: accessible labels that override the default name: - // aria-label or aria-labelledby or aria-describedby - // help: the value of the "title" attribute - // - // On Windows, the logic we apply lets some fields take precedence and - // always returns the primary name in "name" and the secondary name, - // if any, in "description". - - int title_elem_id = GetIntAttribute( - ui::AX_ATTR_TITLE_UI_ELEMENT); - std::string help = GetStringAttribute(ui::AX_ATTR_HELP); - std::string description = GetStringAttribute( - ui::AX_ATTR_DESCRIPTION); - - // WebKit annoyingly puts the title in the description if there's no other - // description, which just confuses the rest of the logic. Put it back. - // Now "help" is always the value of the "title" attribute, if present. - std::string title_attr; - if (GetHtmlAttribute("title", &title_attr) && - description == title_attr && - help.empty()) { - help = description; - description.clear(); - } - - // Now implement the main logic: the descripion should become the name if - // it's nonempty, and the help should become the description if - // there's no description - or the name if there's no name or description. - if (!description.empty()) { - set_name(description); - description.clear(); - } - if (!help.empty() && description.empty()) { - description = help; - help.clear(); - } - if (!description.empty() && name().empty() && !title_elem_id) { - set_name(description); - description.clear(); - } - - // If it's a text field, also consider the placeholder. - std::string placeholder; - if (GetRole() == ui::AX_ROLE_TEXT_FIELD && - HasState(ui::AX_STATE_FOCUSABLE) && - GetHtmlAttribute("placeholder", &placeholder)) { - if (name().empty() && !title_elem_id) { - set_name(placeholder); - } else if (description.empty()) { - description = placeholder; - } - } - - SetStringAttribute(ui::AX_ATTR_DESCRIPTION, description); - SetStringAttribute(ui::AX_ATTR_HELP, help); -} - bool BrowserAccessibilityQt::isValid() const { return true; @@ -227,7 +151,7 @@ QString BrowserAccessibilityQt::text(QAccessible::Text t) const { switch (t) { case QAccessible::Name: - return toQt(name()); + return toQt(GetStringAttribute(ui::AX_ATTR_NAME)); case QAccessible::Description: return toQt(GetStringAttribute(ui::AX_ATTR_DESCRIPTION)); case QAccessible::Help: @@ -277,10 +201,10 @@ QAccessible::Role BrowserAccessibilityQt::role() const return QAccessible::Document; // returning Application here makes Qt return the top level app object case ui::AX_ROLE_ARTICLE: return QAccessible::Section; - case ui::AX_ROLE_BROWSER: - return QAccessible::Document; // FIXME case ui::AX_ROLE_BANNER: return QAccessible::Section; + case ui::AX_ROLE_BLOCKQUOTE: + return QAccessible::Section; case ui::AX_ROLE_BUSY_INDICATOR: return QAccessible::Animation; // FIXME case ui::AX_ROLE_BUTTON: @@ -325,10 +249,6 @@ QAccessible::Role BrowserAccessibilityQt::role() const return QAccessible::Section; case ui::AX_ROLE_DOCUMENT: return QAccessible::Document; - case ui::AX_ROLE_DRAWER: - return QAccessible::Client; // FIXME - case ui::AX_ROLE_EDITABLE_TEXT: - return QAccessible::EditableText; case ui::AX_ROLE_EMBEDDED_OBJECT: return QAccessible::Grouping; // FIXME case ui::AX_ROLE_FOOTER: @@ -339,14 +259,8 @@ QAccessible::Role BrowserAccessibilityQt::role() const return QAccessible::Table; case ui::AX_ROLE_GROUP: return QAccessible::Grouping; - case ui::AX_ROLE_GROW_AREA: - return QAccessible::Grip; case ui::AX_ROLE_HEADING: return QAccessible::Heading; - case ui::AX_ROLE_HELP_TAG: - return QAccessible::HelpBalloon; // FIXME - case ui::AX_ROLE_HORIZONTAL_RULE: - return QAccessible::Separator; case ui::AX_ROLE_IFRAME: return QAccessible::Grouping; case ui::AX_ROLE_IGNORED: @@ -357,8 +271,6 @@ QAccessible::Role BrowserAccessibilityQt::role() const return QAccessible::Graphic; case ui::AX_ROLE_IMAGE_MAP_LINK: return QAccessible::Link; - case ui::AX_ROLE_INCREMENTOR: - return QAccessible::NoRole; // FIXME case ui::AX_ROLE_INLINE_TEXT_BOX: return QAccessible::EditableText; case ui::AX_ROLE_LABEL_TEXT: @@ -387,8 +299,6 @@ QAccessible::Role BrowserAccessibilityQt::role() const return QAccessible::NoRole; // FIXME case ui::AX_ROLE_MATH: return QAccessible::Equation; - case ui::AX_ROLE_MATTE: - return QAccessible::NoRole; // FIXME case ui::AX_ROLE_MENU: return QAccessible::PopupMenu; case ui::AX_ROLE_MENU_BAR: @@ -413,6 +323,8 @@ QAccessible::Role BrowserAccessibilityQt::role() const return QAccessible::Paragraph; case ui::AX_ROLE_POP_UP_BUTTON: return QAccessible::ComboBox; + case ui::AX_ROLE_PRE: + return QAccessible::Section; case ui::AX_ROLE_PRESENTATIONAL: return QAccessible::NoRole; // FIXME case ui::AX_ROLE_PROGRESS_INDICATOR: @@ -429,8 +341,6 @@ QAccessible::Role BrowserAccessibilityQt::role() const return QAccessible::RowHeader; case ui::AX_ROLE_RULER: return QAccessible::NoRole; // FIXME - case ui::AX_ROLE_RULER_MARKER: - return QAccessible::NoRole; // FIXME case ui::AX_ROLE_SCROLL_AREA: return QAccessible::Client; // FIXME case ui::AX_ROLE_SCROLL_BAR: @@ -439,8 +349,6 @@ QAccessible::Role BrowserAccessibilityQt::role() const return QAccessible::NoRole; // FIXME case ui::AX_ROLE_SEARCH: return QAccessible::Section; - case ui::AX_ROLE_SHEET: - return QAccessible::NoRole; // FIXME case ui::AX_ROLE_SLIDER: return QAccessible::Slider; case ui::AX_ROLE_SLIDER_THUMB: @@ -451,16 +359,12 @@ QAccessible::Role BrowserAccessibilityQt::role() const return QAccessible::NoRole; // FIXME case ui::AX_ROLE_SPLITTER: return QAccessible::Splitter; - case ui::AX_ROLE_SPLIT_GROUP: - return QAccessible::Splitter; case ui::AX_ROLE_STATIC_TEXT: return QAccessible::StaticText; case ui::AX_ROLE_STATUS: return QAccessible::StatusBar; case ui::AX_ROLE_SVG_ROOT: return QAccessible::Graphic; - case ui::AX_ROLE_SYSTEM_WIDE: - return QAccessible::NoRole; // FIXME case ui::AX_ROLE_TABLE: return QAccessible::Table; case ui::AX_ROLE_TABLE_HEADER_CONTAINER: @@ -473,8 +377,6 @@ QAccessible::Role BrowserAccessibilityQt::role() const return QAccessible::PageTabList; case ui::AX_ROLE_TAB_PANEL: return QAccessible::PageTab; - case ui::AX_ROLE_TEXT_AREA: - return QAccessible::EditableText; case ui::AX_ROLE_TEXT_FIELD: return QAccessible::EditableText; case ui::AX_ROLE_TIMER: @@ -493,8 +395,6 @@ QAccessible::Role BrowserAccessibilityQt::role() const return QAccessible::Tree; case ui::AX_ROLE_TREE_ITEM: return QAccessible::TreeItem; - case ui::AX_ROLE_VALUE_INDICATOR: - return QAccessible::Client; // FIXME case ui::AX_ROLE_WINDOW: return QAccessible::Window; } diff --git a/src/core/browser_accessibility_qt.h b/src/core/browser_accessibility_qt.h index 7d58f515e..d4f8ac0a5 100644 --- a/src/core/browser_accessibility_qt.h +++ b/src/core/browser_accessibility_qt.h @@ -55,9 +55,6 @@ class BrowserAccessibilityQt public: BrowserAccessibilityQt(); - // BrowserAccessibility - virtual void OnDataChanged() Q_DECL_OVERRIDE; - // QAccessibleInterface virtual bool isValid() const Q_DECL_OVERRIDE; virtual QObject *object() const Q_DECL_OVERRIDE; diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp index a01f7a4b8..4c5e7fdc1 100644 --- a/src/core/browser_context_adapter.cpp +++ b/src/core/browser_context_adapter.cpp @@ -40,6 +40,7 @@ #include "browser_context_qt.h" #include "content_client_qt.h" #include "download_manager_delegate_qt.h" +#include "permission_manager_qt.h" #include "web_engine_context.h" #include "web_engine_visited_links_manager.h" #include "url_request_context_getter_qt.h" @@ -352,4 +353,9 @@ UserScriptControllerHost *BrowserContextAdapter::userScriptController() return m_userScriptController.data(); } +void BrowserContextAdapter::permissionRequestReply(const QUrl &origin, PermissionType type, bool reply) +{ + static_cast<PermissionManagerQt*>(browserContext()->GetPermissionManager())->permissionRequestReply(origin, type, reply); +} + } // namespace QtWebEngineCore diff --git a/src/core/browser_context_adapter.h b/src/core/browser_context_adapter.h index 1a973c026..717450184 100644 --- a/src/core/browser_context_adapter.h +++ b/src/core/browser_context_adapter.h @@ -119,6 +119,13 @@ public: TrackVisitedLinksOnDisk, }; + enum PermissionType { + UnsupportedPermission = 0, + GeolocationPermission = 1, +// Reserved: +// NotificationPermission = 2, + }; + HttpCacheType httpCacheType() const; void setHttpCacheType(BrowserContextAdapter::HttpCacheType); @@ -138,6 +145,8 @@ public: void updateCustomUrlSchemeHandlers(); UserScriptControllerHost *userScriptController(); + void permissionRequestReply(const QUrl &origin, PermissionType type, bool reply); + private: QString m_name; bool m_offTheRecord; diff --git a/src/core/browser_context_qt.cpp b/src/core/browser_context_qt.cpp index aa444ab7e..28486cced 100644 --- a/src/core/browser_context_qt.cpp +++ b/src/core/browser_context_qt.cpp @@ -38,6 +38,7 @@ #include "browser_context_adapter.h" #include "download_manager_delegate_qt.h" +#include "permission_manager_qt.h" #include "qtwebenginecoreglobal_p.h" #include "resource_context_qt.h" #include "type_conversion.h" @@ -134,6 +135,18 @@ content::SSLHostStateDelegate* BrowserContextQt::GetSSLHostStateDelegate() return 0; } +scoped_ptr<content::ZoomLevelDelegate> BrowserContextQt::CreateZoomLevelDelegate(const base::FilePath&) +{ + return nullptr; +} + +content::PermissionManager *BrowserContextQt::GetPermissionManager() +{ + if (!permissionManager) + permissionManager.reset(new PermissionManagerQt(m_adapter)); + return permissionManager.get(); +} + net::URLRequestContextGetter *BrowserContextQt::CreateRequestContext(content::ProtocolHandlerMap *protocol_handlers) { url_request_getter_ = new URLRequestContextGetterQt(m_adapter, protocol_handlers); diff --git a/src/core/browser_context_qt.h b/src/core/browser_context_qt.h index af36b55ab..eccd684a3 100644 --- a/src/core/browser_context_qt.h +++ b/src/core/browser_context_qt.h @@ -47,6 +47,7 @@ namespace QtWebEngineCore { class BrowserContextAdapter; +class PermissionManagerQt; class URLRequestContextGetterQt; class BrowserContextQt : public content::BrowserContext @@ -72,13 +73,17 @@ public: virtual content::PushMessagingService* GetPushMessagingService() Q_DECL_OVERRIDE; virtual content::SSLHostStateDelegate* GetSSLHostStateDelegate() Q_DECL_OVERRIDE; net::URLRequestContextGetter *CreateRequestContext(content::ProtocolHandlerMap *protocol_handlers); + virtual scoped_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate(const base::FilePath& partition_path) Q_DECL_OVERRIDE; + virtual content::PermissionManager *GetPermissionManager() Q_DECL_OVERRIDE; + + BrowserContextAdapter *adapter() { return m_adapter; } - BrowserContextAdapter* adapter() { return m_adapter; } private: friend class ContentBrowserClientQt; friend class WebContentsAdapter; scoped_ptr<content::ResourceContext> resourceContext; scoped_refptr<URLRequestContextGetterQt> url_request_getter_; + scoped_ptr<PermissionManagerQt> permissionManager; BrowserContextAdapter *m_adapter; friend class BrowserContextAdapter; diff --git a/src/core/chrome_qt.gyp b/src/core/chrome_qt.gyp index 703ce7525..0f30b7a04 100644 --- a/src/core/chrome_qt.gyp +++ b/src/core/chrome_qt.gyp @@ -19,6 +19,8 @@ '<(chromium_src_dir)/chrome/browser/media/desktop_streams_registry.cc', '<(chromium_src_dir)/chrome/browser/media/desktop_streams_registry.h', '<(chromium_src_dir)/chrome/browser/media/desktop_media_list.h', + '<(chromium_src_dir)/chrome/common/chrome_switches.cc', + '<(chromium_src_dir)/chrome/common/chrome_switches.h', '<(chromium_src_dir)/chrome/common/localized_error.cc', '<(chromium_src_dir)/chrome/common/localized_error.h', ], diff --git a/src/core/chromium_gpu_helper.cpp b/src/core/chromium_gpu_helper.cpp index ef574eccd..9dfc498ad 100644 --- a/src/core/chromium_gpu_helper.cpp +++ b/src/core/chromium_gpu_helper.cpp @@ -43,18 +43,18 @@ // Including gpu/command_buffer headers before content/gpu headers makes sure that // guards are defined to prevent duplicate definition errors with forward declared // GL typedefs cascading through content header includes. +#include "gpu/command_buffer/service/sync_point_manager.h" #include "gpu/command_buffer/service/mailbox_manager.h" #include "gpu/command_buffer/service/texture_manager.h" #include "content/common/gpu/gpu_channel_manager.h" -#include "content/common/gpu/sync_point_manager.h" #include "content/gpu/gpu_child_thread.h" #ifdef Q_OS_QNX #include "content/common/gpu/stream_texture_qnx.h" #endif -static void addSyncPointCallbackDelegate(content::SyncPointManager *syncPointManager, uint32 sync_point, const base::Closure& callback) +static void addSyncPointCallbackDelegate(gpu::SyncPointManager *syncPointManager, uint32 sync_point, const base::Closure& callback) { syncPointManager->AddSyncPointCallback(sync_point, callback); } @@ -78,13 +78,13 @@ base::MessageLoop *gpu_message_loop() return content::GpuChildThread::instance()->message_loop(); } -content::SyncPointManager *sync_point_manager() +gpu::SyncPointManager *sync_point_manager() { content::GpuChannelManager *gpuChannelManager = content::GpuChildThread::instance()->ChannelManager(); return gpuChannelManager->sync_point_manager(); } -void AddSyncPointCallbackOnGpuThread(base::MessageLoop *gpuMessageLoop, content::SyncPointManager *syncPointManager, uint32 sync_point, const base::Closure& callback) +void AddSyncPointCallbackOnGpuThread(base::MessageLoop *gpuMessageLoop, gpu::SyncPointManager *syncPointManager, uint32 sync_point, const base::Closure& callback) { // We need to set our callback from the GPU thread, where the SyncPointManager lives. gpuMessageLoop->PostTask(FROM_HERE, base::Bind(&addSyncPointCallbackDelegate, make_scoped_refptr(syncPointManager), sync_point, callback)); diff --git a/src/core/chromium_gpu_helper.h b/src/core/chromium_gpu_helper.h index 936ad1d24..6242dd068 100644 --- a/src/core/chromium_gpu_helper.h +++ b/src/core/chromium_gpu_helper.h @@ -47,12 +47,9 @@ namespace base { class MessageLoop; } -namespace content { -class SyncPointManager; -} - namespace gpu { struct Mailbox; +class SyncPointManager; namespace gles2 { class MailboxManager; class Texture; @@ -66,10 +63,10 @@ class Texture; QMap<uint32, gfx::TransferableFence> transferFences(); base::MessageLoop *gpu_message_loop(); -content::SyncPointManager *sync_point_manager(); +gpu::SyncPointManager *sync_point_manager(); gpu::gles2::MailboxManager *mailbox_manager(); -void AddSyncPointCallbackOnGpuThread(base::MessageLoop *gpuMessageLoop, content::SyncPointManager *syncPointManager, uint32 sync_point, const base::Closure& callback); +void AddSyncPointCallbackOnGpuThread(base::MessageLoop *gpuMessageLoop, gpu::SyncPointManager *syncPointManager, uint32 sync_point, const base::Closure& callback); gpu::gles2::Texture* ConsumeTexture(gpu::gles2::MailboxManager *mailboxManager, unsigned target, const gpu::Mailbox& mailbox); unsigned int service_id(gpu::gles2::Texture *tex); diff --git a/src/core/chromium_overrides.cpp b/src/core/chromium_overrides.cpp index ac8906bd1..b9ce722dd 100644 --- a/src/core/chromium_overrides.cpp +++ b/src/core/chromium_overrides.cpp @@ -154,39 +154,6 @@ OSExchangeData::Provider* OSExchangeData::CreateProvider() return 0; } -} - -namespace gfx { - -// Stubs for these unused functions that are stripped in case -// of a release aura build but a debug build needs the symbols. - -RenderText* RenderText::CreateNativeInstance() -{ - QT_NOT_USED; - return 0; -} - -#if defined(OS_LINUX) -PlatformFont* PlatformFont::CreateDefault() -{ - QT_NOT_USED; - return 0; -} - -PlatformFont* PlatformFont::CreateFromNativeFont(NativeFont) -{ - QT_NOT_USED; - return 0; -} - -PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string&, int) -{ - QT_NOT_USED; - return 0; -} -#endif - -} // namespace gfx +} // namespace ui #endif // defined(USE_AURA) && !defined(USE_OZONE) diff --git a/src/core/clipboard_qt.cpp b/src/core/clipboard_qt.cpp index 027a93bac..85235acce 100644 --- a/src/core/clipboard_qt.cpp +++ b/src/core/clipboard_qt.cpp @@ -361,7 +361,7 @@ void ClipboardQt::ReadData(const FormatType& format, std::string* result) const *result = std::string(byteArray.constData(), byteArray.length()); } -uint64 ClipboardQt::GetSequenceNumber(ui::ClipboardType type) +uint64 ClipboardQt::GetSequenceNumber(ui::ClipboardType type) const { return clipboardChangeObserver()->getSequenceNumber(type == ui::CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard : QClipboard::Selection); } diff --git a/src/core/clipboard_qt.h b/src/core/clipboard_qt.h index 4c7e6ab59..ee1fc7440 100644 --- a/src/core/clipboard_qt.h +++ b/src/core/clipboard_qt.h @@ -62,7 +62,7 @@ private: class ClipboardQt : public ui::Clipboard { public: - virtual uint64 GetSequenceNumber(ui::ClipboardType type) Q_DECL_OVERRIDE; + virtual uint64 GetSequenceNumber(ui::ClipboardType type) const Q_DECL_OVERRIDE; virtual bool IsFormatAvailable(const FormatType& format, ui::ClipboardType type) const Q_DECL_OVERRIDE; virtual void Clear(ui::ClipboardType type) Q_DECL_OVERRIDE; virtual void ReadAvailableTypes(ui::ClipboardType type, std::vector<base::string16>* types, bool* contains_filenames) const Q_DECL_OVERRIDE; diff --git a/src/core/config/desktop_linux.pri b/src/core/config/desktop_linux.pri index 679e5559c..2ebd6b995 100644 --- a/src/core/config/desktop_linux.pri +++ b/src/core/config/desktop_linux.pri @@ -17,6 +17,9 @@ GYP_CONFIG += \ clang=0 \ enable_plugins=1 \ +config_system_libxslt: GYP_CONFIG += use_system_libxml=1 +contains(QT_CONFIG, system-zlib): config_system_minizip: GYP_CONFIG += use_system_zlib=1 +contains(QT_CONFIG, system-png): GYP_CONFIG += use_system_libpng=1 contains(QT_CONFIG, system-jpeg): GYP_CONFIG += use_system_libjpeg=1 !contains(QT_CONFIG, pulseaudio): GYP_CONFIG += use_pulseaudio=0 diff --git a/src/core/config/embedded_linux.pri b/src/core/config/embedded_linux.pri index cc8c40f8e..5ab0409e8 100644 --- a/src/core/config/embedded_linux.pri +++ b/src/core/config/embedded_linux.pri @@ -50,5 +50,8 @@ GYP_CONFIG += \ v8_use_snapshot=false \ want_separate_host_toolset=1 \ +config_system_libxslt: GYP_CONFIG += use_system_libxml=1 +contains(QT_CONFIG, system-zlib): config_system_minizip: GYP_CONFIG += use_system_zlib=1 +contains(QT_CONFIG, system-png): GYP_CONFIG += use_system_libpng=1 contains(QT_CONFIG, system-jpeg): GYP_CONFIG += use_system_libjpeg=1 !contains(QT_CONFIG, pulseaudio): GYP_CONFIG += use_pulseaudio=0 diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 16f0b00e3..f38451901 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -56,6 +56,7 @@ #include "ui/gl/gl_context.h" #include "ui/gl/gl_implementation.h" #include "ui/gl/gl_share_group.h" +#include "ui/gl/gpu_timing.h" #include "access_token_store_qt.h" #include "browser_context_adapter.h" @@ -279,7 +280,11 @@ public: virtual bool MakeCurrent(gfx::GLSurface *) Q_DECL_OVERRIDE { Q_UNREACHABLE(); return false; } virtual void ReleaseCurrent(gfx::GLSurface *) Q_DECL_OVERRIDE { Q_UNREACHABLE(); } virtual bool IsCurrent(gfx::GLSurface *) Q_DECL_OVERRIDE { Q_UNREACHABLE(); return false; } - virtual void SetSwapInterval(int) Q_DECL_OVERRIDE { Q_UNREACHABLE(); } + virtual void OnSetSwapInterval(int) Q_DECL_OVERRIDE { Q_UNREACHABLE(); } + virtual scoped_refptr<gfx::GPUTimingClient> CreateGPUTimingClient() Q_DECL_OVERRIDE + { + return nullptr; + } private: void *m_handle; @@ -362,9 +367,8 @@ content::MediaObserver *ContentBrowserClientQt::GetMediaObserver() return MediaCaptureDevicesDispatcher::GetInstance(); } -void ContentBrowserClientQt::OverrideWebkitPrefs(content::RenderViewHost *rvh, const GURL &url, content::WebPreferences *web_prefs) +void ContentBrowserClientQt::OverrideWebkitPrefs(content::RenderViewHost *rvh, content::WebPreferences *web_prefs) { - Q_UNUSED(url); if (content::WebContents *webContents = rvh->GetDelegate()->GetAsWebContents()) static_cast<WebContentsDelegateQt*>(webContents->GetDelegate())->overrideWebPreferences(webContents, web_prefs); } @@ -404,41 +408,6 @@ void ContentBrowserClientQt::AllowCertificateError(int render_process_id, int re contentsDelegate->allowCertificateError(errorController); } -void ContentBrowserClientQt::RequestPermission(content::PermissionType permission, - content::WebContents* web_contents, - int bridge_id, - const GURL& requesting_frame, - bool user_gesture, - const base::Callback<void(bool)>& result_callback) -{ - Q_UNUSED(bridge_id); - Q_UNUSED(user_gesture); - WebContentsDelegateQt* contentsDelegate = static_cast<WebContentsDelegateQt*>(web_contents->GetDelegate()); - Q_ASSERT(contentsDelegate); - if (permission == content::PERMISSION_GEOLOCATION) - contentsDelegate->requestGeolocationPermission(requesting_frame, result_callback); - else - result_callback.Run(false); -} - - -void ContentBrowserClientQt::CancelPermissionRequest(content::PermissionType permission, - content::WebContents* web_contents, - int bridge_id, - const GURL& requesting_frame) -{ - Q_UNUSED(bridge_id); - WebContentsDelegateQt* contentsDelegate = static_cast<WebContentsDelegateQt*>(web_contents->GetDelegate()); - Q_ASSERT(contentsDelegate); - if (permission == content::PERMISSION_GEOLOCATION) - contentsDelegate->cancelGeolocationPermissionRequest(requesting_frame); -} - -blink::WebNotificationPermission ContentBrowserClientQt::CheckDesktopNotificationPermission(const GURL&, content::ResourceContext *, int ) -{ - return blink::WebNotificationPermission::WebNotificationPermissionDenied; -} - content::LocationProvider *ContentBrowserClientQt::OverrideSystemLocationProvider() { #ifdef QT_USE_POSITIONING diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h index 141c82a8f..f6add6805 100644 --- a/src/core/content_browser_client_qt.h +++ b/src/core/content_browser_client_qt.h @@ -40,7 +40,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "content/public/browser/content_browser_client.h" -#include "third_party/WebKit/public/platform/WebNotificationPermission.h" +#include "third_party/WebKit/public/platform/modules/notifications/WebNotificationPermission.h" #include <QtCore/qcompilerdetection.h> // Needed for Q_DECL_OVERRIDE @@ -88,7 +88,7 @@ public: virtual content::MediaObserver* GetMediaObserver() Q_DECL_OVERRIDE; virtual content::AccessTokenStore* CreateAccessTokenStore() Q_DECL_OVERRIDE; virtual content::QuotaPermissionContext *CreateQuotaPermissionContext() Q_DECL_OVERRIDE; - virtual void OverrideWebkitPrefs(content::RenderViewHost *, const GURL &, content::WebPreferences *) Q_DECL_OVERRIDE; + virtual void OverrideWebkitPrefs(content::RenderViewHost *, content::WebPreferences *) Q_DECL_OVERRIDE; virtual void AllowCertificateError( int render_process_id, int render_frame_id, @@ -101,23 +101,10 @@ public: bool expired_previous_decision, const base::Callback<void(bool)>& callback, content::CertificateRequestResultType* result) Q_DECL_OVERRIDE; - virtual void RequestPermission( - content::PermissionType permission, - content::WebContents* web_contents, - int bridge_id, - const GURL& requesting_frame, - bool user_gesture, - const base::Callback<void(bool)>& result_callback) Q_DECL_OVERRIDE; - virtual void CancelPermissionRequest(content::PermissionType permission, - content::WebContents* web_contents, - int bridge_id, - const GURL& requesting_frame) Q_DECL_OVERRIDE; content::LocationProvider* OverrideSystemLocationProvider() Q_DECL_OVERRIDE; content::DevToolsManagerDelegate *GetDevToolsManagerDelegate() Q_DECL_OVERRIDE; virtual net::URLRequestContextGetter *CreateRequestContext(content::BrowserContext *browser_context, content::ProtocolHandlerMap *protocol_handlers, content::URLRequestInterceptorScopedVector request_interceptorss) Q_DECL_OVERRIDE; - virtual blink::WebNotificationPermission CheckDesktopNotificationPermission(const GURL& source_origin, content::ResourceContext* context, int render_process_id) Q_DECL_OVERRIDE; - virtual std::string GetApplicationLocale() Q_DECL_OVERRIDE; virtual void AppendExtraCommandLineSwitches(base::CommandLine* command_line, int child_process_id) Q_DECL_OVERRIDE; diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index 49308f252..01e1fe383 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -130,12 +130,12 @@ void AddPepperFlashFromSystem(std::vector<content::PepperPluginInfo>* plugins) void AddPepperFlashFromCommandLine(std::vector<content::PepperPluginInfo>* plugins) { - const CommandLine::StringType flash_path = CommandLine::ForCurrentProcess()->GetSwitchValueNative(switches::kPpapiFlashPath); + const base::CommandLine::StringType flash_path = base::CommandLine::ForCurrentProcess()->GetSwitchValueNative(switches::kPpapiFlashPath); if (flash_path.empty() || !QFile(QtWebEngineCore::toQt(flash_path)).exists()) return; // Read pepper flash plugin version from command-line. (e.g. 16.0.0.235) - std::string flash_version = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kPpapiFlashVersion); + std::string flash_version = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kPpapiFlashVersion); plugins->push_back(CreatePepperFlashInfo(base::FilePath(flash_path), flash_version)); } diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp index 4003823b1..0688fb015 100644 --- a/src/core/content_main_delegate_qt.cpp +++ b/src/core/content_main_delegate_qt.cpp @@ -72,7 +72,7 @@ void ContentMainDelegateQt::PreSandboxStartup() // Suppress info, warning and error messages per default. int logLevel = logging::LOG_FATAL; - CommandLine* parsedCommandLine = CommandLine::ForCurrentProcess(); + base::CommandLine* parsedCommandLine = base::CommandLine::ForCurrentProcess(); if (parsedCommandLine->HasSwitch(switches::kLoggingLevel)) { std::string logLevelValue = parsedCommandLine->GetSwitchValueASCII(switches::kLoggingLevel); int level = 0; diff --git a/src/core/cookie_monster_delegate_qt.cpp b/src/core/cookie_monster_delegate_qt.cpp index f42768901..d40abf13e 100644 --- a/src/core/cookie_monster_delegate_qt.cpp +++ b/src/core/cookie_monster_delegate_qt.cpp @@ -127,12 +127,4 @@ void CookieMonsterDelegateQt::OnCookieChanged(const net::CanonicalCookie& cookie m_client->d_ptr->onCookieChanged(toQt(cookie), removed); } -void CookieMonsterDelegateQt::OnLoaded() -{ - if (!m_client) - return; - - m_client->d_ptr->onCookieStoreLoaded(); -} - } diff --git a/src/core/cookie_monster_delegate_qt.h b/src/core/cookie_monster_delegate_qt.h index 05ab24e9f..7cd76bff0 100644 --- a/src/core/cookie_monster_delegate_qt.h +++ b/src/core/cookie_monster_delegate_qt.h @@ -71,7 +71,6 @@ public: void setClient(QWebEngineCookieStoreClient *client); void OnCookieChanged(const net::CanonicalCookie& cookie, bool removed, ChangeCause cause) override; - void OnLoaded() override; }; } diff --git a/src/core/core_gyp_generator.pro b/src/core/core_gyp_generator.pro index 90d748c4b..b878fdc9f 100644 --- a/src/core/core_gyp_generator.pro +++ b/src/core/core_gyp_generator.pro @@ -58,6 +58,7 @@ SOURCES = \ native_web_keyboard_event_qt.cpp \ network_delegate_qt.cpp \ ozone_platform_eglfs.cpp \ + permission_manager_qt.cpp \ process_main.cpp \ proxy_config_service_qt.cpp \ proxy_resolver_qt.cpp \ @@ -129,6 +130,7 @@ HEADERS = \ media_capture_devices_dispatcher.h \ network_delegate_qt.h \ ozone_platform_eglfs.h \ + permission_manager_qt.h \ process_main.h \ proxy_config_service_qt.h \ proxy_resolver_qt.h \ diff --git a/src/core/delegated_frame_node.cpp b/src/core/delegated_frame_node.cpp index 6f79d4952..dee381e15 100644 --- a/src/core/delegated_frame_node.cpp +++ b/src/core/delegated_frame_node.cpp @@ -76,6 +76,10 @@ #include <EGL/eglext.h> #endif +#ifndef GL_TIMEOUT_IGNORED +#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull +#endif + namespace QtWebEngineCore { class MailboxTexture : public QSGTexture, protected QOpenGLFunctions { @@ -205,7 +209,6 @@ static void waitChromiumSync(gfx::TransferableFence *sync) #endif break; case gfx::TransferableFence::ArbSync: -#ifdef GL_ARB_sync typedef void (QOPENGLF_APIENTRYP WaitSyncPtr)(GLsync sync, GLbitfield flags, GLuint64 timeout); static WaitSyncPtr glWaitSync_ = 0; if (!glWaitSync_) { @@ -214,7 +217,6 @@ static void waitChromiumSync(gfx::TransferableFence *sync) Q_ASSERT(glWaitSync_); } glWaitSync_(sync->arb.sync, 0, GL_TIMEOUT_IGNORED); -#endif break; } } @@ -250,7 +252,6 @@ static void deleteChromiumSync(gfx::TransferableFence *sync) #endif break; case gfx::TransferableFence::ArbSync: -#ifdef GL_ARB_sync typedef void (QOPENGLF_APIENTRYP DeleteSyncPtr)(GLsync sync); static DeleteSyncPtr glDeleteSync_ = 0; if (!glDeleteSync_) { @@ -260,7 +261,6 @@ static void deleteChromiumSync(gfx::TransferableFence *sync) } glDeleteSync_(sync->arb.sync); sync->reset(); -#endif break; } // If Chromium was able to create a sync, we should have been able to handle its type here too. @@ -409,7 +409,7 @@ void DelegatedFrameNode::preprocess() { QMutexLocker lock(&m_mutex); base::MessageLoop *gpuMessageLoop = gpu_message_loop(); - content::SyncPointManager *syncPointManager = sync_point_manager(); + gpu::SyncPointManager *syncPointManager = sync_point_manager(); Q_FOREACH (MailboxTexture *mailboxTexture, mailboxesToFetch) { m_numPendingSyncPoints++; @@ -444,6 +444,20 @@ void DelegatedFrameNode::preprocess() } } +static YUVVideoMaterial::ColorSpace toQt(cc::YUVVideoDrawQuad::ColorSpace color_space) +{ + switch (color_space) { + case cc::YUVVideoDrawQuad::REC_601: + return YUVVideoMaterial::REC_601; + case cc::YUVVideoDrawQuad::REC_709: + return YUVVideoMaterial::REC_709; + case cc::YUVVideoDrawQuad::JPEG: + return YUVVideoMaterial::JPEG; + } + Q_UNREACHABLE(); + return YUVVideoMaterial::REC_601; +} + void DelegatedFrameNode::commit(ChromiumCompositorData *chromiumCompositorData, cc::ReturnedResourceArray *resourcesToRelease, RenderWidgetHostViewQtDelegate *apiDelegate) { m_chromiumCompositorData = chromiumCompositorData; @@ -560,7 +574,7 @@ void DelegatedFrameNode::commit(ChromiumCompositorData *chromiumCompositorData, ResourceHolder *resource = findAndHoldResource(tquad->resource_id, resourceCandidates); QSGSimpleTextureNode *textureNode = new QSGSimpleTextureNode; - textureNode->setTextureCoordinatesTransform(tquad->flipped ? QSGSimpleTextureNode::MirrorVertically : QSGSimpleTextureNode::NoTransform); + textureNode->setTextureCoordinatesTransform(tquad->y_flipped ? QSGSimpleTextureNode::MirrorVertically : QSGSimpleTextureNode::NoTransform); textureNode->setRect(toQt(quad->rect)); textureNode->setFiltering(resource->transferableResource().filter == GL_LINEAR ? QSGTexture::Linear : QSGTexture::Nearest); textureNode->setTexture(initAndHoldTexture(resource, quad->ShouldDrawWithBlending(), apiDelegate)); @@ -628,7 +642,9 @@ void DelegatedFrameNode::commit(ChromiumCompositorData *chromiumCompositorData, initAndHoldTexture(yResource, quad->ShouldDrawWithBlending()), initAndHoldTexture(uResource, quad->ShouldDrawWithBlending()), initAndHoldTexture(vResource, quad->ShouldDrawWithBlending()), - aResource ? initAndHoldTexture(aResource, quad->ShouldDrawWithBlending()) : 0, toQt(vquad->tex_coord_rect)); + aResource ? initAndHoldTexture(aResource, quad->ShouldDrawWithBlending()) : 0, + toQt(vquad->ya_tex_coord_rect), toQt(vquad->uv_tex_coord_rect), + toQt(vquad->ya_tex_size), toQt(vquad->uv_tex_size), toQt(vquad->color_space)); videoNode->setRect(toQt(quad->rect)); currentLayerChain->appendChildNode(videoNode); break; diff --git a/src/core/dev_tools_http_handler_delegate_qt.cpp b/src/core/dev_tools_http_handler_delegate_qt.cpp index 964d6ad38..2afd75e6e 100644 --- a/src/core/dev_tools_http_handler_delegate_qt.cpp +++ b/src/core/dev_tools_http_handler_delegate_qt.cpp @@ -49,9 +49,11 @@ #include "base/files/file_path.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" +#include "components/devtools_discovery/devtools_discovery_manager.h" +#include "components/devtools_discovery/devtools_target_descriptor.h" +#include "components/devtools_http_handler/devtools_http_handler.h" #include "content/public/browser/devtools_agent_host.h" -#include "content/public/browser/devtools_http_handler.h" -#include "content/public/browser/devtools_target.h" +#include "content/public/browser/devtools_frontend_host.h" #include "content/public/browser/favicon_status.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/render_view_host.h" @@ -59,14 +61,18 @@ #include "content/public/browser/web_contents_delegate.h" #include "content/public/common/content_switches.h" #include "net/base/ip_endpoint.h" +#include "net/base/net_errors.h" #include "net/socket/stream_listen_socket.h" #include "net/socket/tcp_server_socket.h" using namespace content; +using namespace devtools_discovery; +using namespace devtools_http_handler; namespace { const char kTargetTypePage[] = "page"; +const char kTargetTypeSharedWorker[] = "worker"; const char kTargetTypeServiceWorker[] = "service_worker"; const char kTargetTypeOther[] = "other"; @@ -74,15 +80,29 @@ class TCPServerSocketFactory : public DevToolsHttpHandler::ServerSocketFactory { public: TCPServerSocketFactory(const std::string& address, int port, int backlog) - : DevToolsHttpHandler::ServerSocketFactory(address, port, backlog) {} + : m_address(address), m_port(port), m_backlog(backlog) + {} private: - scoped_ptr<net::ServerSocket> Create() const override { - return scoped_ptr<net::ServerSocket>(new net::TCPServerSocket(NULL, net::NetLog::Source())); - } - DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory); + scoped_ptr<net::ServerSocket> CreateForHttpServer() override { + scoped_ptr<net::ServerSocket> socket(new net::TCPServerSocket(nullptr, net::NetLog::Source())); + if (socket->ListenWithAddressAndPort(m_address, m_port, m_backlog) != net::OK) + return scoped_ptr<net::ServerSocket>(); + + return socket; + } + + const std::string m_address; + int m_port; + int m_backlog; + DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory); }; -class Target : public content::DevToolsTarget { +class DevToolsDiscoveryProviderQt : public DevToolsDiscoveryManager::Provider { +public: + DevToolsTargetDescriptor::List GetDescriptors() override; +}; + +class Target : public DevToolsTargetDescriptor { public: explicit Target(scoped_refptr<DevToolsAgentHost> agent_host); @@ -92,6 +112,8 @@ public: switch (agent_host_->GetType()) { case DevToolsAgentHost::TYPE_WEB_CONTENTS: return kTargetTypePage; + case DevToolsAgentHost::TYPE_SHARED_WORKER: + return kTargetTypeSharedWorker; case DevToolsAgentHost::TYPE_SERVICE_WORKER: return kTargetTypeServiceWorker; default: @@ -141,17 +163,40 @@ bool Target::Close() const { return agent_host_->Close(); } +DevToolsTargetDescriptor::List DevToolsDiscoveryProviderQt::GetDescriptors() +{ + DevToolsTargetDescriptor::List targets; + for (const auto& agent_host : DevToolsAgentHost::GetOrCreateAll()) { + targets.push_back(new Target(agent_host)); + } + return targets; +} + } // namespace namespace QtWebEngineCore { +scoped_ptr<DevToolsHttpHandler> createDevToolsHttpHandler() +{ + DevToolsHttpHandlerDelegateQt *delegate = new DevToolsHttpHandlerDelegateQt(); + if (!delegate->isValid()) { + delete delegate; + return nullptr; + } + scoped_ptr<DevToolsHttpHandler::ServerSocketFactory> factory(new TCPServerSocketFactory(delegate->bindAddress().toStdString(), delegate->port(), 1)); + // Ownership of the delegate is taken over the devtools http handler. + scoped_ptr<DevToolsHttpHandler> handler(new DevToolsHttpHandler(factory.Pass(), std::string(), delegate, base::FilePath(), base::FilePath(), std::string(), std::string())); + DevToolsDiscoveryManager::GetInstance()->AddProvider(scoped_ptr<DevToolsDiscoveryManager::Provider>(new DevToolsDiscoveryProviderQt())); + return handler; +} + DevToolsHttpHandlerDelegateQt::DevToolsHttpHandlerDelegateQt() - : m_devtoolsHttpHandler(0) - , m_bindAddress(QLatin1String("127.0.0.1")) + : m_bindAddress(QLatin1String("127.0.0.1")) , m_port(0) + , m_valid(false) { const QString inspectorEnv = QString::fromUtf8(qgetenv("QTWEBENGINE_REMOTE_DEBUGGING")); - const CommandLine &commandLine = *CommandLine::ForCurrentProcess(); + const base::CommandLine &commandLine = *base::CommandLine::ForCurrentProcess(); QString portStr; if (commandLine.HasSwitch(switches::kRemoteDebuggingPort)) { @@ -166,26 +211,16 @@ DevToolsHttpHandlerDelegateQt::DevToolsHttpHandlerDelegateQt() } else return; - bool ok = false; - m_port = portStr.toInt(&ok); - if (ok && m_port > 0 && m_port < 65535) { - scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory> factory(new TCPServerSocketFactory(m_bindAddress.toStdString(), m_port, 1)); - m_devtoolsHttpHandler = DevToolsHttpHandler::Start(factory.Pass(), std::string(), this, base::FilePath()); - } else + m_port = portStr.toInt(&m_valid); + m_valid = m_valid && m_port > 0 && m_port < 65535; + if (!m_valid) qWarning("Invalid port given for the inspector server \"%s\". Examples of valid input: \"12345\" or \"192.168.2.14:12345\" (with the address of one of this host's network interface).", qPrintable(portStr)); } -DevToolsHttpHandlerDelegateQt::~DevToolsHttpHandlerDelegateQt() -{ - // Stop() takes care of deleting the DevToolsHttpHandler. - if (m_devtoolsHttpHandler) - m_devtoolsHttpHandler->Stop(); -} - -void DevToolsHttpHandlerDelegateQt::Initialized(const net::IPEndPoint& ip_address) +void DevToolsHttpHandlerDelegateQt::Initialized(const net::IPEndPoint *ip_address) { - if (ip_address.address().size()) { - QString addressAndPort = QString::fromStdString(ip_address.ToString()); + if (ip_address && ip_address->address().size()) { + QString addressAndPort = QString::fromStdString(ip_address->ToString()); qWarning("Remote debugging server started successfully. Try pointing a Chromium-based browser to http://%s", qPrintable(addressAndPort)); } else qWarning("Couldn't start the inspector server on bind address \"%s\" and port \"%d\". In case of invalid input, try something like: \"12345\" or \"192.168.2.14:12345\" (with the address of one of this host's interface).", qPrintable(m_bindAddress), m_port); @@ -203,42 +238,19 @@ std::string DevToolsHttpHandlerDelegateQt::GetDiscoveryPageHTML() return html; } -bool DevToolsHttpHandlerDelegateQt::BundlesFrontendResources() -{ - return true; -} - -base::FilePath DevToolsHttpHandlerDelegateQt::GetDebugFrontendDir() -{ - return base::FilePath(); -} - -scoped_ptr<net::StreamListenSocket> DevToolsHttpHandlerDelegateQt::CreateSocketForTethering(net::StreamListenSocket::Delegate* delegate, std::string* name) -{ - return scoped_ptr<net::StreamListenSocket>(); -} - -base::DictionaryValue* DevToolsManagerDelegateQt::HandleCommand(DevToolsAgentHost *, base::DictionaryValue *) { - return 0; -} - -std::string DevToolsManagerDelegateQt::GetPageThumbnailData(const GURL& url) +std::string DevToolsHttpHandlerDelegateQt::GetPageThumbnailData(const GURL& url) { return std::string(); } -scoped_ptr<DevToolsTarget> DevToolsManagerDelegateQt::CreateNewTarget(const GURL &) +std::string DevToolsHttpHandlerDelegateQt::GetFrontendResource(const std::string &path) { - return scoped_ptr<DevToolsTarget>(); + return content::DevToolsFrontendHost::GetFrontendResource(path).as_string(); } -void DevToolsManagerDelegateQt::EnumerateTargets(TargetCallback callback) +base::DictionaryValue* DevToolsManagerDelegateQt::HandleCommand(DevToolsAgentHost *, base::DictionaryValue *) { - TargetList targets; - for (const auto& agent_host : DevToolsAgentHost::GetOrCreateAll()) { - targets.push_back(new Target(agent_host)); - } - callback.Run(targets); + return 0; } } //namespace QtWebEngineCore diff --git a/src/core/dev_tools_http_handler_delegate_qt.h b/src/core/dev_tools_http_handler_delegate_qt.h index 902e99507..b998359fd 100644 --- a/src/core/dev_tools_http_handler_delegate_qt.h +++ b/src/core/dev_tools_http_handler_delegate_qt.h @@ -37,43 +37,43 @@ #ifndef DEV_TOOLS_HTTP_HANDLER_DELEGATE_QT_H #define DEV_TOOLS_HTTP_HANDLER_DELEGATE_QT_H -#include "content/public/browser/devtools_http_handler_delegate.h" +#include "components/devtools_http_handler/devtools_http_handler_delegate.h" #include "content/public/browser/devtools_manager_delegate.h" +#include "net/socket/stream_listen_socket.h" #include <QString> #include <QtCore/qcompilerdetection.h> // needed for Q_DECL_OVERRIDE -namespace net { -class StreamListenSocket; -} - namespace content { class BrowserContext; +} + +namespace devtools_http_handler { class DevToolsHttpHandler; -class RenderViewHost; } namespace QtWebEngineCore { -class DevToolsHttpHandlerDelegateQt : public content::DevToolsHttpHandlerDelegate { -public: +scoped_ptr<devtools_http_handler::DevToolsHttpHandler> createDevToolsHttpHandler(); +class DevToolsHttpHandlerDelegateQt : public devtools_http_handler::DevToolsHttpHandlerDelegate { +public: DevToolsHttpHandlerDelegateQt(); - virtual ~DevToolsHttpHandlerDelegateQt(); - // content::DevToolsHttpHandlerDelegate Overrides - virtual void Initialized(const net::IPEndPoint &ip_address) Q_DECL_OVERRIDE; - virtual std::string GetDiscoveryPageHTML() Q_DECL_OVERRIDE; - virtual bool BundlesFrontendResources() Q_DECL_OVERRIDE; - virtual base::FilePath GetDebugFrontendDir() Q_DECL_OVERRIDE; - // Requests the list of all inspectable targets. - // The caller gets the ownership of the returned targets. - virtual scoped_ptr<net::StreamListenSocket> CreateSocketForTethering(net::StreamListenSocket::Delegate *delegate, std::string *name) Q_DECL_OVERRIDE; + bool isValid() const { return m_valid; } + QString bindAddress() const { return m_bindAddress; } + int port() const { return m_port; } + + // devtools_http_handler::DevToolsHttpHandlerDelegate Overrides + void Initialized(const net::IPEndPoint *ip_address) Q_DECL_OVERRIDE; + std::string GetDiscoveryPageHTML() Q_DECL_OVERRIDE; + std::string GetFrontendResource(const std::string&) Q_DECL_OVERRIDE; + std::string GetPageThumbnailData(const GURL &url) Q_DECL_OVERRIDE; private: - content::DevToolsHttpHandler *m_devtoolsHttpHandler; QString m_bindAddress; int m_port; + bool m_valid; }; class DevToolsManagerDelegateQt : public content::DevToolsManagerDelegate { @@ -81,9 +81,6 @@ public: void Inspect(content::BrowserContext *browser_context, content::DevToolsAgentHost *agent_host) Q_DECL_OVERRIDE { } void DevToolsAgentStateChanged(content::DevToolsAgentHost *agent_host, bool attached) Q_DECL_OVERRIDE { } base::DictionaryValue *HandleCommand(content::DevToolsAgentHost *agent_host, base::DictionaryValue *command) Q_DECL_OVERRIDE; - scoped_ptr<content::DevToolsTarget> CreateNewTarget(const GURL &url) Q_DECL_OVERRIDE; - void EnumerateTargets(TargetCallback callback) Q_DECL_OVERRIDE; - std::string GetPageThumbnailData(const GURL &url) Q_DECL_OVERRIDE; }; } // namespace QtWebEngineCore diff --git a/src/core/gl_surface_qt.cpp b/src/core/gl_surface_qt.cpp index ca0e0350f..19ce59f7e 100644 --- a/src/core/gl_surface_qt.cpp +++ b/src/core/gl_surface_qt.cpp @@ -539,6 +539,22 @@ GLSurface::CreateViewGLSurface(gfx::AcceleratedWidget window) return NULL; } +std::string DriverEGL::GetPlatformExtensions() +{ +#if defined(USE_X11) + EGLNativeDisplayType nativeDisplay = reinterpret_cast<EGLNativeDisplayType>(GLContextHelper::getXDisplay()); + EGLDisplay display = eglGetDisplay(nativeDisplay); +#else + EGLDisplay display = GLContextHelper::getEGLDisplay(); +#endif + if (display == EGL_NO_DISPLAY) + return ""; + + DCHECK(g_driver_egl.fn.eglQueryStringFn); + const char* str = g_driver_egl.fn.eglQueryStringFn(display, EGL_EXTENSIONS); + return str ? std::string(str) : ""; +} + } // namespace gfx namespace content { diff --git a/src/core/gl_surface_qt.h b/src/core/gl_surface_qt.h index 21c46e699..4b5da207e 100644 --- a/src/core/gl_surface_qt.h +++ b/src/core/gl_surface_qt.h @@ -39,7 +39,7 @@ #ifndef GL_SURFACE_QT_H_ #define GL_SURFACE_QT_H_ -#include "ui/gfx/size.h" +#include "ui/gfx/geometry/size.h" #include "ui/gl/gl_surface.h" #include <QtCore/qcompilerdetection.h> // Needed for Q_DECL_OVERRIDE diff --git a/src/core/javascript_dialog_manager_qt.h b/src/core/javascript_dialog_manager_qt.h index 4682ce5b8..8bf7ac6b9 100644 --- a/src/core/javascript_dialog_manager_qt.h +++ b/src/core/javascript_dialog_manager_qt.h @@ -66,8 +66,7 @@ public: const content::JavaScriptDialogManager::DialogClosedCallback &callback) Q_DECL_OVERRIDE { Q_UNUSED(messageText); Q_UNUSED(isReload); Q_UNUSED(callback); } virtual bool HandleJavaScriptDialog(content::WebContents *, bool accept, const base::string16 *promptOverride) Q_DECL_OVERRIDE; virtual void CancelActiveAndPendingDialogs(content::WebContents *contents) Q_DECL_OVERRIDE { takeDialogForContents(contents); } - virtual void WebContentsDestroyed(content::WebContents *contents) Q_DECL_OVERRIDE { takeDialogForContents(contents); } - + virtual void ResetDialogState(content::WebContents *contents) Q_DECL_OVERRIDE { takeDialogForContents(contents); } void runDialogForContents(content::WebContents *, WebContentsAdapterClient::JavascriptDialogType, const QString &messageText, const QString &defaultPrompt , const QUrl &,const content::JavaScriptDialogManager::DialogClosedCallback &callback, const QString &title = QString()); diff --git a/src/core/media_capture_devices_dispatcher.cpp b/src/core/media_capture_devices_dispatcher.cpp index 6866afc41..605a17948 100644 --- a/src/core/media_capture_devices_dispatcher.cpp +++ b/src/core/media_capture_devices_dispatcher.cpp @@ -91,9 +91,8 @@ scoped_ptr<content::MediaStreamUI> getDevicesForDesktopCapture(content::MediaStr devices.push_back(content::MediaStreamDevice( content::MEDIA_DESKTOP_VIDEO_CAPTURE, mediaId.ToString(), "Screen")); if (captureAudio) { - // Use the special loopback device ID for system audio capture. devices.push_back(content::MediaStreamDevice( - content::MEDIA_LOOPBACK_AUDIO_CAPTURE, + content::MEDIA_DESKTOP_AUDIO_CAPTURE, media::AudioManagerBase::kLoopbackInputDeviceId, "System Audio")); } @@ -225,7 +224,7 @@ void MediaCaptureDevicesDispatcher::processMediaAccessRequest(WebContentsAdapter if (request.video_type == content::MEDIA_TAB_VIDEO_CAPTURE || request.audio_type == content::MEDIA_TAB_AUDIO_CAPTURE) return; - if (request.video_type == content::MEDIA_DESKTOP_VIDEO_CAPTURE || request.audio_type == content::MEDIA_LOOPBACK_AUDIO_CAPTURE) + if (request.video_type == content::MEDIA_DESKTOP_VIDEO_CAPTURE || request.audio_type == content::MEDIA_DESKTOP_AUDIO_CAPTURE) // It's still unclear what to make of screen capture. We can rely on existing javascript dialog infrastructure // to experiment with this without exposing it through our API yet. processDesktopCaptureAccessRequest(webContents, request, callback); @@ -279,7 +278,7 @@ void MediaCaptureDevicesDispatcher::processDesktopCaptureAccessRequest(content:: // Audio is only supported for screen capture streams. bool capture_audio = (mediaId.type == content::DesktopMediaID::TYPE_SCREEN && - request.audio_type == content::MEDIA_LOOPBACK_AUDIO_CAPTURE); + request.audio_type == content::MEDIA_DESKTOP_AUDIO_CAPTURE); ui = getDevicesForDesktopCapture( devices, mediaId, capture_audio, true, diff --git a/src/core/network_delegate_qt.h b/src/core/network_delegate_qt.h index 4f4097fd3..825045642 100644 --- a/src/core/network_delegate_qt.h +++ b/src/core/network_delegate_qt.h @@ -37,7 +37,7 @@ #ifndef NETWORK_DELEGATE_QT_H #define NETWORK_DELEGATE_QT_H -#include "net/base/network_delegate.h" +#include "net/base/network_delegate_impl.h" #include "net/base/net_errors.h" #include <QUrl> @@ -46,7 +46,7 @@ namespace QtWebEngineCore { -class NetworkDelegateQt : public net::NetworkDelegate { +class NetworkDelegateQt : public net::NetworkDelegateImpl { public: NetworkDelegateQt() {} virtual ~NetworkDelegateQt() {} diff --git a/src/core/permission_manager_qt.cpp b/src/core/permission_manager_qt.cpp new file mode 100644 index 000000000..865874fe6 --- /dev/null +++ b/src/core/permission_manager_qt.cpp @@ -0,0 +1,207 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "permission_manager_qt.h" + +#include "content/public/browser/permission_type.h" +#include "content/public/browser/web_contents.h" + +#include "type_conversion.h" +#include "web_contents_delegate_qt.h" + +namespace QtWebEngineCore { + +BrowserContextAdapter::PermissionType toQt(content::PermissionType type) +{ + switch (type) { + case content::PermissionType::GEOLOCATION: + return BrowserContextAdapter::GeolocationPermission; + case content::PermissionType::NOTIFICATIONS: + case content::PermissionType::MIDI_SYSEX: + case content::PermissionType::PUSH_MESSAGING: + case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: + case content::PermissionType::NUM: + break; + } + return BrowserContextAdapter::UnsupportedPermission; +} + +PermissionManagerQt::PermissionManagerQt(BrowserContextAdapter *contextAdapter) + : m_contextAdapter(contextAdapter) + , m_subscriberCount(0) +{ +} + +PermissionManagerQt::~PermissionManagerQt() +{ +} + +void PermissionManagerQt::permissionRequestReply(const QUrl &origin, BrowserContextAdapter::PermissionType type, bool reply) +{ + QPair<QUrl, BrowserContextAdapter::PermissionType> key(origin, type); + m_permissions[key] = reply; + content::PermissionStatus status = reply ? content::PERMISSION_STATUS_GRANTED : content::PERMISSION_STATUS_DENIED; + auto it = m_requests.begin(); + const auto end = m_requests.end(); + while (it != end) { + if (it->origin == origin && it->type == type) { + it->callback.Run(status); + it = m_requests.erase(it); + } else + ++it; + } + Q_FOREACH (const Subscriber &subscriber, m_subscribers) { + if (subscriber.origin == origin && subscriber.type == type) + subscriber.callback.Run(status); + } +} + +void PermissionManagerQt::RequestPermission(content::PermissionType permission, + content::WebContents* web_contents, + int request_id, + const GURL& requesting_origin, + bool user_gesture, + const base::Callback<void(content::PermissionStatus)>& callback) +{ + Q_UNUSED(user_gesture); + BrowserContextAdapter::PermissionType permissionType = toQt(permission); + if (permissionType == BrowserContextAdapter::UnsupportedPermission) { + callback.Run(content::PERMISSION_STATUS_DENIED); + return; + } + + WebContentsDelegateQt* contentsDelegate = static_cast<WebContentsDelegateQt*>(web_contents->GetDelegate()); + Q_ASSERT(contentsDelegate); + Request request = { + request_id, + permissionType, + toQt(requesting_origin), + callback + }; + m_requests.append(request); + if (permissionType == BrowserContextAdapter::GeolocationPermission) + contentsDelegate->requestGeolocationPermission(request.origin); +} + +void PermissionManagerQt::CancelPermissionRequest(content::PermissionType permission, + content::WebContents* web_contents, + int request_id, + const GURL& requesting_origin) +{ + Q_UNUSED(web_contents); + const BrowserContextAdapter::PermissionType permissionType = toQt(permission); + if (permissionType == BrowserContextAdapter::UnsupportedPermission) + return; + + // Should we add API to cancel permissions in the UI level? + const QUrl origin = toQt(requesting_origin); + auto it = m_requests.begin(); + const auto end = m_requests.end(); + while (it != end) { + if (it->id == request_id && it->type == permissionType && it->origin == origin) { + m_requests.erase(it); + return; + } + } + qWarning() << "PermissionManagerQt::CancelPermissionRequest called on unknown request" << request_id << origin << permissionType; +} + +content::PermissionStatus PermissionManagerQt::GetPermissionStatus( + content::PermissionType permission, + const GURL& requesting_origin, + const GURL& /*embedding_origin*/) +{ + const BrowserContextAdapter::PermissionType permissionType = toQt(permission); + if (permissionType == BrowserContextAdapter::UnsupportedPermission) + return content::PERMISSION_STATUS_DENIED; + + QPair<QUrl, BrowserContextAdapter::PermissionType> key(toQt(requesting_origin), permissionType); + if (!m_permissions.contains(key)) + return content::PERMISSION_STATUS_ASK; + if (m_permissions[key]) + return content::PERMISSION_STATUS_GRANTED; + return content::PERMISSION_STATUS_DENIED; +} + +void PermissionManagerQt::ResetPermission( + content::PermissionType permission, + const GURL& requesting_origin, + const GURL& /*embedding_origin*/) +{ + const BrowserContextAdapter::PermissionType permissionType = toQt(permission); + if (permissionType == BrowserContextAdapter::UnsupportedPermission) + return; + + QPair<QUrl, BrowserContextAdapter::PermissionType> key(toQt(requesting_origin), permissionType); + m_permissions.remove(key); +} + +void PermissionManagerQt::RegisterPermissionUsage( + content::PermissionType /*permission*/, + const GURL& /*requesting_origin*/, + const GURL& /*embedding_origin*/) +{ + // We do not currently track which permissions are used. +} + +int PermissionManagerQt::SubscribePermissionStatusChange( + content::PermissionType permission, + const GURL& requesting_origin, + const GURL& /*embedding_origin*/, + const base::Callback<void(content::PermissionStatus)>& callback) +{ + Subscriber subscriber = { + m_subscriberCount++, + toQt(permission), + toQt(requesting_origin), + callback + }; + m_subscribers.append(subscriber); + return subscriber.id; +} + +void PermissionManagerQt::UnsubscribePermissionStatusChange(int subscription_id) +{ + for (int i = 0; i < m_subscribers.count(); i++) { + if (m_subscribers[i].id == subscription_id) { + m_subscribers.removeAt(i); + return; + } + } + qWarning() << "PermissionManagerQt::UnsubscribePermissionStatusChange called on unknown subscription id" << subscription_id; +} + +} // namespace QtWebEngineCore diff --git a/src/core/permission_manager_qt.h b/src/core/permission_manager_qt.h new file mode 100644 index 000000000..75f88f9a9 --- /dev/null +++ b/src/core/permission_manager_qt.h @@ -0,0 +1,119 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef PERMISSION_MANAGER_QT_H +#define PERMISSION_MANAGER_QT_H + +#include "base/callback.h" +#include "content/public/browser/permission_manager.h" +#include "browser_context_adapter.h" + +#include <QHash> +#include <QList> + +namespace QtWebEngineCore { + +class PermissionManagerQt : public content::PermissionManager { + +public: + PermissionManagerQt(BrowserContextAdapter *); + ~PermissionManagerQt(); + typedef BrowserContextAdapter::PermissionType PermissionType; + + void permissionRequestReply(const QUrl &origin, PermissionType type, bool reply); + + // content::PermissionManager implementation: + void RequestPermission( + content::PermissionType permission, + content::WebContents* web_contents, + int request_id, + const GURL& requesting_origin, + bool user_gesture, + const base::Callback<void(content::PermissionStatus)>& callback) override; + + void CancelPermissionRequest( + content::PermissionType permission, + content::WebContents* web_contents, + int request_id, + const GURL& requesting_origin) override; + + content::PermissionStatus GetPermissionStatus( + content::PermissionType permission, + const GURL& requesting_origin, + const GURL& embedding_origin) override; + + void ResetPermission( + content::PermissionType permission, + const GURL& requesting_origin, + const GURL& embedding_origin) override; + + void RegisterPermissionUsage( + content::PermissionType permission, + const GURL& requesting_origin, + const GURL& embedding_origin) override; + + int SubscribePermissionStatusChange( + content::PermissionType permission, + const GURL& requesting_origin, + const GURL& embedding_origin, + const base::Callback<void(content::PermissionStatus)>& callback) override; + + void UnsubscribePermissionStatusChange(int subscription_id) override; + +private: + BrowserContextAdapter *m_contextAdapter; + QHash<QPair<QUrl, PermissionType>, bool> m_permissions; + struct Request { + int id; + PermissionType type; + QUrl origin; + base::Callback<void(content::PermissionStatus)> callback; + }; + QList<Request> m_requests; + struct Subscriber { + int id; + PermissionType type; + QUrl origin; + base::Callback<void(content::PermissionStatus)> callback; + }; + int m_subscriberCount; + QList<Subscriber> m_subscribers; + +}; + +} // namespace QtWebEngineCore + +#endif // PERMISSION_MANAGER_QT_H diff --git a/src/core/proxy_config_service_qt.cpp b/src/core/proxy_config_service_qt.cpp index 14e386a34..933b1a10e 100644 --- a/src/core/proxy_config_service_qt.cpp +++ b/src/core/proxy_config_service_qt.cpp @@ -168,6 +168,8 @@ void ProxyConfigServiceQt::OnProxyConfigChanged(const net::ProxyConfig &config, || m_qtApplicationProxy.type() == QNetworkProxy::NoProxy) { net::ProxyConfig actual_config; availability = GetLatestProxyConfig(&actual_config); + if (availability == CONFIG_PENDING) + return; FOR_EACH_OBSERVER(net::ProxyConfigService::Observer, m_observers, OnProxyConfigChanged(actual_config, availability)); } diff --git a/src/core/proxy_resolver_qt.h b/src/core/proxy_resolver_qt.h index 5580de598..4d419fb6e 100644 --- a/src/core/proxy_resolver_qt.h +++ b/src/core/proxy_resolver_qt.h @@ -38,6 +38,7 @@ #define PROXY_RESOLVER_QT_H #include "net/proxy/proxy_resolver.h" +#include "net/proxy/proxy_resolver_factory.h" #include <qglobal.h> @@ -59,4 +60,15 @@ public: int SetPacScript(const scoped_refptr<net::ProxyResolverScriptData>& /*script_data*/, const net::CompletionCallback& /*callback*/) override; }; +class ProxyResolverFactoryQt : public net::LegacyProxyResolverFactory { +public: + ProxyResolverFactoryQt(bool expects_pac_bytes) : net::LegacyProxyResolverFactory(expects_pac_bytes) + { + } + scoped_ptr<net::ProxyResolver> CreateProxyResolver() override + { + return scoped_ptr<net::ProxyResolver>(new ProxyResolverQt()); + } +}; + #endif // PROXY_RESOLVER_QT_H diff --git a/src/core/qtwebengine.gypi b/src/core/qtwebengine.gypi index 15da6b6ec..2c433f614 100644 --- a/src/core/qtwebengine.gypi +++ b/src/core/qtwebengine.gypi @@ -8,6 +8,8 @@ 'dependencies': [ '<(chromium_src_dir)/base/base.gyp:base', '<(chromium_src_dir)/base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', + '<(chromium_src_dir)/components/components.gyp:devtools_discovery', + '<(chromium_src_dir)/components/components.gyp:devtools_http_handler', '<(chromium_src_dir)/components/components.gyp:error_page_renderer', '<(chromium_src_dir)/components/components.gyp:visitedlink_browser', '<(chromium_src_dir)/components/components.gyp:visitedlink_renderer', diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 766cd5a74..46f93b90b 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -61,10 +61,11 @@ #include "third_party/WebKit/public/platform/WebCursorInfo.h" #include "third_party/WebKit/public/web/WebCompositionUnderline.h" #include "ui/base/clipboard/scoped_clipboard_writer.h" +#include "ui/events/blink/blink_event_util.h" #include "ui/events/event.h" #include "ui/events/gesture_detection/gesture_provider_config_helper.h" #include "ui/events/gesture_detection/motion_event.h" -#include "ui/gfx/size_conversions.h" +#include "ui/gfx/geometry/size_conversions.h" #include <QEvent> #include <QFocusEvent> @@ -143,7 +144,7 @@ static inline int firstAvailableId(const QMap<int, int> &map) } static inline ui::GestureProvider::Config QtGestureProviderConfig() { - ui::GestureProvider::Config config = ui::DefaultGestureProviderConfig(); + ui::GestureProvider::Config config = ui::GetGestureProviderConfig(ui::GestureProviderConfigType::CURRENT_PLATFORM); // Causes an assert in CreateWebGestureEventFromGestureEventData and we don't need them in Qt. config.gesture_begin_end_types_enabled = false; config.gesture_detector_config.swipe_enabled = false; @@ -181,12 +182,14 @@ static inline int flagsFromModifiers(Qt::KeyboardModifiers modifiers) return modifierFlags; } +static uint32 s_eventId = 0; class MotionEventQt : public ui::MotionEvent { public: MotionEventQt(const QList<QTouchEvent::TouchPoint> &touchPoints, const base::TimeTicks &eventTime, Action action, const Qt::KeyboardModifiers modifiers, int index = -1) : touchPoints(touchPoints) , eventTime(eventTime) , action(action) + , eventId(++s_eventId) , flags(flagsFromModifiers(modifiers)) , index(index) { @@ -194,7 +197,7 @@ public: Q_ASSERT((action != ACTION_DOWN && action != ACTION_UP) || index == 0); } - virtual int GetId() const Q_DECL_OVERRIDE { return 0; } + virtual uint32 GetUniqueEventId() const Q_DECL_OVERRIDE { return eventId; } virtual Action GetAction() const Q_DECL_OVERRIDE { return action; } virtual int GetActionIndex() const Q_DECL_OVERRIDE { return index; } virtual size_t GetPointerCount() const Q_DECL_OVERRIDE { return touchPoints.size(); } @@ -233,6 +236,7 @@ private: QList<QTouchEvent::TouchPoint> touchPoints; base::TimeTicks eventTime; Action action; + const uint32 eventId; int flags; int index; }; @@ -427,27 +431,11 @@ void RenderWidgetHostViewQt::UnlockMouse() m_host->LostMouseLock(); } -void RenderWidgetHostViewQt::WasShown() -{ - m_host->WasShown(ui::LatencyInfo()); -} - -void RenderWidgetHostViewQt::WasHidden() -{ - m_host->WasHidden(); -} - void RenderWidgetHostViewQt::MovePluginWindows(const std::vector<content::WebPluginGeometry>&) { // QT_NOT_YET_IMPLEMENTED } -void RenderWidgetHostViewQt::Blur() -{ - m_host->SetInputMethodActive(false); - m_host->Blur(); -} - void RenderWidgetHostViewQt::UpdateCursor(const content::WebCursor &webCursor) { content::WebCursor::CursorInfo cursorInfo; @@ -601,13 +589,13 @@ void RenderWidgetHostViewQt::SelectionBoundsChanged(const ViewHostMsg_SelectionB m_cursorRect = QRect(caretRect.x(), caretRect.y(), caretRect.width(), caretRect.height()); } -void RenderWidgetHostViewQt::CopyFromCompositingSurface(const gfx::Rect& src_subrect, const gfx::Size& dst_size, content::CopyFromCompositingSurfaceCallback& callback, const SkColorType color_type) +void RenderWidgetHostViewQt::CopyFromCompositingSurface(const gfx::Rect& src_subrect, const gfx::Size& dst_size, content::ReadbackRequestCallback& callback, const SkColorType color_type) { NOTIMPLEMENTED(); Q_UNUSED(src_subrect); Q_UNUSED(dst_size); Q_UNUSED(color_type); - callback.Run(false, SkBitmap()); + callback.Run(SkBitmap(), content::READBACK_FAILED); } void RenderWidgetHostViewQt::CopyFromCompositingSurfaceToVideoFrame(const gfx::Rect& src_subrect, const scoped_refptr<media::VideoFrame>& target, const base::Callback<void(bool)>& callback) @@ -689,7 +677,7 @@ void RenderWidgetHostViewQt::SelectionChanged(const base::string16 &text, size_t void RenderWidgetHostViewQt::OnGestureEvent(const ui::GestureEventData& gesture) { - m_host->ForwardGestureEvent(content::CreateWebGestureEventFromGestureEventData(gesture)); + m_host->ForwardGestureEvent(ui::CreateWebGestureEventFromGestureEventData(gesture)); } QSGNode *RenderWidgetHostViewQt::updatePaintNode(QSGNode *oldNode) @@ -718,12 +706,12 @@ void RenderWidgetHostViewQt::notifyResize() void RenderWidgetHostViewQt::notifyShown() { - WasShown(); + m_host->WasShown(ui::LatencyInfo()); } void RenderWidgetHostViewQt::notifyHidden() { - WasHidden(); + m_host->WasHidden(); } void RenderWidgetHostViewQt::windowBoundsChanged() @@ -809,7 +797,7 @@ QVariant RenderWidgetHostViewQt::inputMethodQuery(Qt::InputMethodQuery query) co void RenderWidgetHostViewQt::ProcessAckedTouchEvent(const content::TouchEventWithLatencyInfo &touch, content::InputEventAckState ack_result) { Q_UNUSED(touch); const bool eventConsumed = ack_result == content::INPUT_EVENT_ACK_STATE_CONSUMED; - m_gestureProvider.OnTouchEventAck(eventConsumed); + m_gestureProvider.OnAsyncTouchEventAck(eventConsumed); } void RenderWidgetHostViewQt::sendDelegatedFrameAck() @@ -823,16 +811,10 @@ void RenderWidgetHostViewQt::sendDelegatedFrameAck() void RenderWidgetHostViewQt::processMotionEvent(const ui::MotionEvent &motionEvent) { - if (!m_gestureProvider.OnTouchEvent(motionEvent)) + if (!m_gestureProvider.OnTouchEvent(motionEvent).succeeded) return; - // Short-circuit touch forwarding if no touch handlers exist. - if (!m_host->ShouldForwardTouchEvent()) { - const bool eventConsumed = false; - m_gestureProvider.OnTouchEventAck(eventConsumed); - return; - } - blink::WebTouchEvent touchEvent = content::CreateWebTouchEventFromMotionEvent(motionEvent); + blink::WebTouchEvent touchEvent = ui::CreateWebTouchEventFromMotionEvent(motionEvent, false); m_host->ForwardTouchEventWithLatencyInfo(touchEvent, CreateLatencyInfo(touchEvent)); } diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h index 6b44cead0..310ada429 100644 --- a/src/core/render_widget_host_view_qt.h +++ b/src/core/render_widget_host_view_qt.h @@ -128,10 +128,7 @@ public: virtual gfx::Rect GetViewBounds() const Q_DECL_OVERRIDE; virtual bool LockMouse() Q_DECL_OVERRIDE; virtual void UnlockMouse() Q_DECL_OVERRIDE; - virtual void WasShown() Q_DECL_OVERRIDE; - virtual void WasHidden() Q_DECL_OVERRIDE; virtual void MovePluginWindows(const std::vector<content::WebPluginGeometry>&) Q_DECL_OVERRIDE; - virtual void Blur() Q_DECL_OVERRIDE; virtual void UpdateCursor(const content::WebCursor&) Q_DECL_OVERRIDE; virtual void SetIsLoading(bool) Q_DECL_OVERRIDE; virtual void TextInputTypeChanged(ui::TextInputType type, ui::TextInputMode mode, bool can_compose_inline, int flags) Q_DECL_OVERRIDE; @@ -141,7 +138,7 @@ public: virtual void Destroy() Q_DECL_OVERRIDE; virtual void SetTooltipText(const base::string16 &tooltip_text) Q_DECL_OVERRIDE; virtual void SelectionBoundsChanged(const ViewHostMsg_SelectionBounds_Params&) Q_DECL_OVERRIDE; - virtual void CopyFromCompositingSurface(const gfx::Rect& src_subrect, const gfx::Size& dst_size, content::CopyFromCompositingSurfaceCallback& callback, const SkColorType color_type) Q_DECL_OVERRIDE; + virtual void CopyFromCompositingSurface(const gfx::Rect& src_subrect, const gfx::Size& dst_size, content::ReadbackRequestCallback& callback, const SkColorType color_type) Q_DECL_OVERRIDE; virtual void CopyFromCompositingSurfaceToVideoFrame(const gfx::Rect& src_subrect, const scoped_refptr<media::VideoFrame>& target, const base::Callback<void(bool)>& callback) Q_DECL_OVERRIDE; virtual bool CanCopyToVideoFrame() const Q_DECL_OVERRIDE; virtual bool HasAcceleratedSurface(const gfx::Size&) Q_DECL_OVERRIDE; diff --git a/src/core/renderer/pepper/pepper_host_factory_qt.cpp b/src/core/renderer/pepper/pepper_host_factory_qt.cpp index fe877e4bc..61eeac9a0 100644 --- a/src/core/renderer/pepper/pepper_host_factory_qt.cpp +++ b/src/core/renderer/pepper/pepper_host_factory_qt.cpp @@ -58,9 +58,8 @@ PepperHostFactoryQt::PepperHostFactoryQt(content::BrowserPpapiHost* host) PepperHostFactoryQt::~PepperHostFactoryQt() {} -scoped_ptr<ppapi::host::ResourceHost> PepperHostFactoryQt::CreateResourceHost( - ppapi::host::PpapiHost* host, - const ppapi::proxy::ResourceMessageCallParams& params, +scoped_ptr<ppapi::host::ResourceHost> PepperHostFactoryQt::CreateResourceHost(ppapi::host::PpapiHost* host, + PP_Resource resource, PP_Instance instance, const IPC::Message& message) { @@ -75,7 +74,7 @@ scoped_ptr<ppapi::host::ResourceHost> PepperHostFactoryQt::CreateResourceHost( return scoped_ptr<ppapi::host::ResourceHost>( new PepperFlashBrowserHostQt(host_, instance, - params.pp_resource())); + resource)); return scoped_ptr<ppapi::host::ResourceHost>(); } diff --git a/src/core/renderer/pepper/pepper_host_factory_qt.h b/src/core/renderer/pepper/pepper_host_factory_qt.h index 568f064b3..22bf87b1b 100644 --- a/src/core/renderer/pepper/pepper_host_factory_qt.h +++ b/src/core/renderer/pepper/pepper_host_factory_qt.h @@ -56,7 +56,7 @@ public: virtual scoped_ptr<ppapi::host::ResourceHost> CreateResourceHost( ppapi::host::PpapiHost* host, - const ppapi::proxy::ResourceMessageCallParams& params, + PP_Resource resource, PP_Instance instance, const IPC::Message& message) override; private: diff --git a/src/core/renderer/pepper/pepper_renderer_host_factory_qt.cpp b/src/core/renderer/pepper/pepper_renderer_host_factory_qt.cpp index 65229f501..51416d698 100644 --- a/src/core/renderer/pepper/pepper_renderer_host_factory_qt.cpp +++ b/src/core/renderer/pepper/pepper_renderer_host_factory_qt.cpp @@ -57,7 +57,7 @@ PepperRendererHostFactoryQt::~PepperRendererHostFactoryQt() scoped_ptr<ppapi::host::ResourceHost> PepperRendererHostFactoryQt::CreateResourceHost( ppapi::host::PpapiHost* host, - const ppapi::proxy::ResourceMessageCallParams& params, + PP_Resource resource, PP_Instance instance, const IPC::Message& message) { @@ -71,7 +71,7 @@ scoped_ptr<ppapi::host::ResourceHost> PepperRendererHostFactoryQt::CreateResourc return scoped_ptr<ppapi::host::ResourceHost>( new PepperFlashRendererHostQt(host_, instance, - params.pp_resource())); + resource)); return scoped_ptr<ppapi::host::ResourceHost>(); } diff --git a/src/core/renderer/pepper/pepper_renderer_host_factory_qt.h b/src/core/renderer/pepper/pepper_renderer_host_factory_qt.h index 0878087fc..8631c1e03 100644 --- a/src/core/renderer/pepper/pepper_renderer_host_factory_qt.h +++ b/src/core/renderer/pepper/pepper_renderer_host_factory_qt.h @@ -57,7 +57,7 @@ public: // HostFactory. scoped_ptr<ppapi::host::ResourceHost> CreateResourceHost( ppapi::host::PpapiHost* host, - const ppapi::proxy::ResourceMessageCallParams& params, + PP_Resource resource, PP_Instance instance, const IPC::Message& message) override; diff --git a/src/core/resources/repack_resources.gypi b/src/core/resources/repack_resources.gypi index b5d8c9d91..fdf317a7c 100644 --- a/src/core/resources/repack_resources.gypi +++ b/src/core/resources/repack_resources.gypi @@ -6,7 +6,7 @@ 'repack_path': '<(chromium_src_dir)/tools/grit/grit/format/repack.py', 'pak_inputs': [ '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak', - '<(SHARED_INTERMEDIATE_DIR)/webkit/devtools_resources.pak', + '<(SHARED_INTERMEDIATE_DIR)/blink/devtools_resources.pak', '<(SHARED_INTERMEDIATE_DIR)/content/content_resources.pak', '<(SHARED_INTERMEDIATE_DIR)/ui/resources/ui_resources_100_percent.pak', '<(SHARED_INTERMEDIATE_DIR)/blink/public/resources/blink_resources.pak', diff --git a/src/core/type_conversion.h b/src/core/type_conversion.h index a711e7235..90bd38b81 100644 --- a/src/core/type_conversion.h +++ b/src/core/type_conversion.h @@ -51,7 +51,7 @@ #include "net/cookies/canonical_cookie.h" #include "third_party/skia/include/utils/SkMatrix44.h" #include "third_party/skia/include/core/SkColor.h" -#include "ui/gfx/rect.h" +#include "ui/gfx/geometry/rect.h" #include "url/gurl.h" namespace QtWebEngineCore { diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp index d829666b7..1205e3674 100644 --- a/src/core/url_request_context_getter_qt.cpp +++ b/src/core/url_request_context_getter_qt.cpp @@ -40,7 +40,6 @@ #include "base/threading/worker_pool.h" #include "base/threading/sequenced_worker_pool.h" #include "content/public/browser/browser_thread.h" -#include "content/public/browser/cookie_crypto_delegate.h" #include "content/public/browser/cookie_store_factory.h" #include "net/base/cache_type.h" #include "net/cert/cert_verifier.h" @@ -150,15 +149,16 @@ void URLRequestContextGetterQt::generateStorage() generateCookieStore(); generateUserAgent(); - m_storage->set_channel_id_service(new net::ChannelIDService( + m_storage->set_channel_id_service(scoped_ptr<net::ChannelIDService>(new net::ChannelIDService( new net::DefaultChannelIDStore(NULL), - base::WorkerPool::GetTaskRunner(true))); + base::WorkerPool::GetTaskRunner(true)))); m_storage->set_cert_verifier(net::CertVerifier::CreateDefault()); net::ProxyService *proxyService = nullptr; - if (ProxyResolverQt::useProxyResolverQt()) - proxyService = new net::ProxyService(proxyConfigService, new ProxyResolverQt, nullptr); - else + if (ProxyResolverQt::useProxyResolverQt()) { + scoped_ptr<ProxyResolverFactoryQt> factory(new ProxyResolverFactoryQt(false)); + proxyService = new net::ProxyService(proxyConfigService, factory.Pass(), nullptr); + } else proxyService = net::ProxyService::CreateUsingSystemProxyResolver(proxyConfigService, /*num_pac_threads = */0 /*default*/, NULL); m_storage->set_proxy_service(proxyService); m_storage->set_ssl_config_service(new net::SSLConfigServiceDefaults); diff --git a/src/core/user_script_controller_host.cpp b/src/core/user_script_controller_host.cpp index 227a639b1..d57518275 100644 --- a/src/core/user_script_controller_host.cpp +++ b/src/core/user_script_controller_host.cpp @@ -52,9 +52,12 @@ namespace QtWebEngineCore { class UserScriptControllerHost::WebContentsObserverHelper : public content::WebContentsObserver { public: WebContentsObserverHelper(UserScriptControllerHost *, content::WebContents *); - virtual void AboutToNavigateRenderView(content::RenderViewHost* renderViewHost) Q_DECL_OVERRIDE; - virtual void WebContentsDestroyed() Q_DECL_OVERRIDE; + // WebContentsObserver overrides: + void RenderViewCreated(content::RenderViewHost *renderViewHost) override; + void RenderViewHostChanged(content::RenderViewHost *oldHost, content::RenderViewHost *newHost) override; + void WebContentsDestroyed() override; + private: UserScriptControllerHost *m_controllerHost; }; @@ -65,13 +68,23 @@ UserScriptControllerHost::WebContentsObserverHelper::WebContentsObserverHelper(U { } -void UserScriptControllerHost::WebContentsObserverHelper::AboutToNavigateRenderView(content::RenderViewHost *renderViewHost) +void UserScriptControllerHost::WebContentsObserverHelper::RenderViewCreated(content::RenderViewHost *renderViewHost) { content::WebContents *contents = web_contents(); Q_FOREACH (const UserScript &script, m_controllerHost->m_perContentsScripts.value(contents)) renderViewHost->Send(new RenderViewObserverHelper_AddScript(renderViewHost->GetRoutingID(), script.data())); } +void UserScriptControllerHost::WebContentsObserverHelper::RenderViewHostChanged(content::RenderViewHost *oldHost, + content::RenderViewHost *newHost) +{ + oldHost->Send(new RenderViewObserverHelper_ClearScripts(oldHost->GetRoutingID())); + + content::WebContents *contents = web_contents(); + Q_FOREACH (const UserScript &script, m_controllerHost->m_perContentsScripts.value(contents)) + newHost->Send(new RenderViewObserverHelper_AddScript(newHost->GetRoutingID(), script.data())); +} + void UserScriptControllerHost::WebContentsObserverHelper::WebContentsDestroyed() { m_controllerHost->webContentsDestroyed(web_contents()); diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index ac1bf968d..bf4f027ce 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -204,9 +204,6 @@ static void serializeNavigationHistory(const content::NavigationController &cont output << entry->GetIsOverridingUserAgent(); output << static_cast<qint64>(entry->GetTimestamp().ToInternalValue()); output << entry->GetHttpStatusCode(); - // If you want to navigate a named frame in Chrome, you will first need to - // add support for persisting it. It is currently only used for layout tests. - CHECK(entry->GetFrameToNavigate().empty()); } } } @@ -799,7 +796,7 @@ void WebContentsAdapter::grantMediaAccessPermission(const QUrl &securityOrigin, void WebContentsAdapter::runGeolocationRequestCallback(const QUrl &securityOrigin, bool allowed) { Q_D(WebContentsAdapter); - d->webContentsDelegate->geolocationPermissionReply(securityOrigin, allowed); + d->browserContextAdapter->permissionRequestReply(securityOrigin, BrowserContextAdapter::GeolocationPermission, allowed); } void WebContentsAdapter::grantMouseLockPermission(bool granted) diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 671002538..93fabf15a 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -108,7 +108,7 @@ content::WebContents *WebContentsDelegateQt::OpenURLFromTab(content::WebContents return target; } -void WebContentsDelegateQt::NavigationStateChanged(const content::WebContents* source, content::InvalidateTypes changed_flags) +void WebContentsDelegateQt::NavigationStateChanged(content::WebContents* source, content::InvalidateTypes changed_flags) { if (changed_flags & content::INVALIDATE_TYPE_URL) m_viewClient->urlChanged(toQt(source->GetVisibleURL())); @@ -127,7 +127,7 @@ void WebContentsDelegateQt::AddNewContents(content::WebContents* source, content void WebContentsDelegateQt::CloseContents(content::WebContents *source) { m_viewClient->close(); - GetJavaScriptDialogManager()->CancelActiveAndPendingDialogs(source); + GetJavaScriptDialogManager(source)->CancelActiveAndPendingDialogs(source); } void WebContentsDelegateQt::LoadProgressChanged(content::WebContents* source, double progress) @@ -229,19 +229,28 @@ void WebContentsDelegateQt::DidUpdateFaviconURL(const std::vector<content::Favic } } -content::JavaScriptDialogManager *WebContentsDelegateQt::GetJavaScriptDialogManager() +content::JavaScriptDialogManager *WebContentsDelegateQt::GetJavaScriptDialogManager(content::WebContents *) { return JavaScriptDialogManagerQt::GetInstance(); } -void WebContentsDelegateQt::ToggleFullscreenModeForTab(content::WebContents* web_contents, bool enter_fullscreen) +void WebContentsDelegateQt::EnterFullscreenModeForTab(content::WebContents *web_contents, const GURL& origin) { - if (m_viewClient->isFullScreen() != enter_fullscreen) { - m_viewClient->requestFullScreen(enter_fullscreen); + Q_UNUSED(origin); // FIXME + if (!m_viewClient->isFullScreen()) { + m_viewClient->requestFullScreen(true); web_contents->GetRenderViewHost()->WasResized(); } } +void WebContentsDelegateQt::ExitFullscreenModeForTab(content::WebContents *web_contents) +{ + if (m_viewClient->isFullScreen()) { + m_viewClient->requestFullScreen(false); + web_contents->GetRenderViewHost()->WasResized(); + } +} + bool WebContentsDelegateQt::IsFullscreenForTabOrPending(const content::WebContents* web_contents) const { return m_viewClient->isFullScreen(); @@ -337,28 +346,9 @@ void WebContentsDelegateQt::allowCertificateError(const QSharedPointer<Certifica m_viewClient->allowCertificateError(errorController); } -void WebContentsDelegateQt::requestGeolocationPermission(const GURL &requestingFrameOrigin, const base::Callback<void (bool)> &resultCallback) +void WebContentsDelegateQt::requestGeolocationPermission(const QUrl &requestingOrigin) { - QUrl url = toQt(requestingFrameOrigin); - bool newRequest = !m_geolocationPermissionRequests.contains(url); - m_geolocationPermissionRequests[url] = resultCallback; - if (newRequest) - m_viewClient->runGeolocationPermissionRequest(url); -} - -void WebContentsDelegateQt::cancelGeolocationPermissionRequest(const GURL &requestingFrameOrigin) -{ - m_geolocationPermissionRequests.remove(toQt(requestingFrameOrigin)); - // FIXME: Tell the API layer to cancel the permission request? -} - -void WebContentsDelegateQt::geolocationPermissionReply(const QUrl &origin, bool permission) -{ - auto it = m_geolocationPermissionRequests.find(origin); - if (it != m_geolocationPermissionRequests.end()) { - (*it).Run(permission); - m_geolocationPermissionRequests.erase(it); - } + m_viewClient->runGeolocationPermissionRequest(requestingOrigin); } void WebContentsDelegateQt::ShowValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view, const base::string16 &main_text, const base::string16 &sub_text) diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index 254177d24..b983738e9 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -39,6 +39,7 @@ #include "content/public/browser/web_contents_delegate.h" #include "content/public/browser/web_contents_observer.h" +#include "content/public/common/permission_status.mojom.h" #include "base/callback.h" @@ -72,13 +73,14 @@ public: // WebContentsDelegate overrides virtual content::WebContents *OpenURLFromTab(content::WebContents *source, const content::OpenURLParams ¶ms) Q_DECL_OVERRIDE; - virtual void NavigationStateChanged(const content::WebContents* source, content::InvalidateTypes changed_flags) Q_DECL_OVERRIDE; + virtual void NavigationStateChanged(content::WebContents* source, content::InvalidateTypes changed_flags) Q_DECL_OVERRIDE; virtual void AddNewContents(content::WebContents* source, content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture, bool* was_blocked) Q_DECL_OVERRIDE; virtual void CloseContents(content::WebContents *source) Q_DECL_OVERRIDE; virtual void LoadProgressChanged(content::WebContents* source, double progress) Q_DECL_OVERRIDE; virtual void HandleKeyboardEvent(content::WebContents *source, const content::NativeWebKeyboardEvent &event) Q_DECL_OVERRIDE; - virtual content::JavaScriptDialogManager *GetJavaScriptDialogManager() Q_DECL_OVERRIDE; - virtual void ToggleFullscreenModeForTab(content::WebContents* web_contents, bool enter_fullscreen) Q_DECL_OVERRIDE; + virtual content::JavaScriptDialogManager *GetJavaScriptDialogManager(content::WebContents *source) Q_DECL_OVERRIDE; + virtual void EnterFullscreenModeForTab(content::WebContents* web_contents, const GURL& origin) Q_DECL_OVERRIDE; + virtual void ExitFullscreenModeForTab(content::WebContents*) Q_DECL_OVERRIDE; virtual bool IsFullscreenForTabOrPending(const content::WebContents* web_contents) const Q_DECL_OVERRIDE; virtual void RunFileChooser(content::WebContents *, const content::FileChooserParams ¶ms) Q_DECL_OVERRIDE; virtual bool AddMessageToConsole(content::WebContents* source, int32 level, const base::string16& message, int32 line_no, const base::string16& source_id) Q_DECL_OVERRIDE; @@ -101,15 +103,11 @@ public: void overrideWebPreferences(content::WebContents *, content::WebPreferences*); void allowCertificateError(const QSharedPointer<CertificateErrorController> &) ; - void requestGeolocationPermission(const GURL &requestingFrameOrigin, const base::Callback<void (bool)> &resultCallback); - void cancelGeolocationPermissionRequest(const GURL &requestingFrameOrigin); - void geolocationPermissionReply(const QUrl&, bool permission); + void requestGeolocationPermission(const QUrl &requestingOrigin); private: WebContentsAdapter *createWindow(content::WebContents *new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture); - QHash<QUrl, base::Callback<void (bool)> > m_geolocationPermissionRequests; - WebContentsAdapterClient *m_viewClient; QString m_lastSearchedString; int m_lastReceivedFindReply; diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index f3659a7d2..4265ddb1f 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -193,12 +193,11 @@ WebEngineContext::WebEngineContext() QVector<const char*> argv(args.size()); for (int i = 0; i < args.size(); ++i) argv[i] = args[i].constData(); - CommandLine::Init(argv.size(), argv.constData()); + base::CommandLine::Init(argv.size(), argv.constData()); - CommandLine* parsedCommandLine = CommandLine::ForCurrentProcess(); + base::CommandLine* parsedCommandLine = base::CommandLine::ForCurrentProcess(); parsedCommandLine->AppendSwitchPath(switches::kBrowserSubprocessPath, WebEngineLibraryInfo::getPath(content::CHILD_PROCESS_EXE)); parsedCommandLine->AppendSwitch(switches::kNoSandbox); - parsedCommandLine->AppendSwitch(switches::kDisablePlugins); parsedCommandLine->AppendSwitch(switches::kEnableDelegatedRenderer); parsedCommandLine->AppendSwitch(switches::kEnableThreadedCompositing); parsedCommandLine->AppendSwitch(switches::kInProcessGPU); @@ -213,7 +212,6 @@ WebEngineContext::WebEngineContext() parsedCommandLine->AppendSwitch(switches::kDisableAcceleratedVideoDecode); parsedCommandLine->AppendSwitch(switches::kDisableGpuShaderDiskCache); parsedCommandLine->AppendSwitch(switches::kDisable2dCanvasAntialiasing); - parsedCommandLine->AppendSwitch(switches::kEnableImplSidePainting); parsedCommandLine->AppendSwitch(cc::switches::kDisableCompositedAntialiasing); parsedCommandLine->AppendSwitchASCII(switches::kProfilerTiming, switches::kProfilerTimingDisabledValue); } @@ -247,13 +245,13 @@ WebEngineContext::WebEngineContext() contentMainParams.sandbox_info = &sandbox_info; #endif m_contentRunner->Initialize(contentMainParams); - m_browserRunner->Initialize(content::MainFunctionParams(*CommandLine::ForCurrentProcess())); + m_browserRunner->Initialize(content::MainFunctionParams(*base::CommandLine::ForCurrentProcess())); // Once the MessageLoop has been created, attach a top-level RunLoop. m_runLoop.reset(new base::RunLoop); m_runLoop->BeforeRun(); - m_devtools.reset(new DevToolsHttpHandlerDelegateQt); + m_devtools = createDevToolsHttpHandler(); // Force the initialization of MediaCaptureDevicesDispatcher on the UI // thread to avoid a thread check assertion in its constructor when it // first gets referenced on the IO thread. diff --git a/src/core/web_engine_context.h b/src/core/web_engine_context.h index f900c93d8..f78791f27 100644 --- a/src/core/web_engine_context.h +++ b/src/core/web_engine_context.h @@ -41,6 +41,8 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" +#include "base/values.h" +#include "components/devtools_http_handler/devtools_http_handler.h" #include <QExplicitlySharedDataPointer> @@ -59,7 +61,6 @@ namespace QtWebEngineCore { class BrowserContextAdapter; class ContentMainDelegateQt; -class DevToolsHttpHandlerDelegateQt; class SurfaceFactoryQt; } // namespace @@ -81,7 +82,7 @@ private: scoped_ptr<content::BrowserMainRunner> m_browserRunner; QObject* m_globalQObject; QExplicitlySharedDataPointer<QtWebEngineCore::BrowserContextAdapter> m_defaultBrowserContext; - scoped_ptr<QtWebEngineCore::DevToolsHttpHandlerDelegateQt> m_devtools; + scoped_ptr<devtools_http_handler::DevToolsHttpHandler> m_devtools; }; #endif // WEB_ENGINE_CONTEXT_H diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp index 4a12e732c..b9b60f587 100644 --- a/src/core/web_engine_library_info.cpp +++ b/src/core/web_engine_library_info.cpp @@ -261,7 +261,7 @@ base::string16 WebEngineLibraryInfo::getApplicationName() std::string WebEngineLibraryInfo::getApplicationLocale() { - CommandLine *parsedCommandLine = CommandLine::ForCurrentProcess(); + base::CommandLine *parsedCommandLine = base::CommandLine::ForCurrentProcess(); if (!parsedCommandLine->HasSwitch(switches::kLang)) return QLocale().bcp47Name().toStdString(); diff --git a/src/core/yuv_video_node.cpp b/src/core/yuv_video_node.cpp index 23528c8ec..815ea7d51 100644 --- a/src/core/yuv_video_node.cpp +++ b/src/core/yuv_video_node.cpp @@ -61,12 +61,16 @@ protected: "attribute highp vec4 a_position;\n" "attribute mediump vec2 a_texCoord;\n" "uniform highp mat4 matrix;\n" - "varying mediump vec2 v_texCoord;\n" - "uniform mediump vec2 texScale;\n" - "uniform mediump vec2 texOffset;\n" + "varying mediump vec2 v_yaTexCoord;\n" + "varying mediump vec2 v_uvTexCoord;\n" + "uniform mediump vec2 yaTexScale;\n" + "uniform mediump vec2 yaTexOffset;\n" + "uniform mediump vec2 uvTexScale;\n" + "uniform mediump vec2 uvTexOffset;\n" "void main() {\n" " gl_Position = matrix * a_position;\n" - " v_texCoord = a_texCoord * texScale + texOffset;\n" + " v_yaTexCoord = a_texCoord * yaTexScale + yaTexOffset;\n" + " v_uvTexCoord = a_texCoord * uvTexScale + uvTexOffset;\n" "}"; return shader; } @@ -74,19 +78,26 @@ protected: virtual const char *fragmentShader() const Q_DECL_OVERRIDE { // Keep in sync with cc::FragmentShaderYUVVideo static const char *shader = - "varying mediump vec2 v_texCoord;\n" + "varying mediump vec2 v_yaTexCoord;\n" + "varying mediump vec2 v_uvTexCoord;\n" "uniform sampler2D y_texture;\n" "uniform sampler2D u_texture;\n" "uniform sampler2D v_texture;\n" - "uniform lowp float alpha;\n" - "uniform lowp vec3 yuv_adj;\n" - "uniform lowp mat3 yuv_matrix;\n" + "uniform mediump float alpha;\n" + "uniform mediump vec3 yuv_adj;\n" + "uniform mediump mat3 yuv_matrix;\n" + "uniform mediump vec4 ya_clamp_rect;\n" + "uniform mediump vec4 uv_clamp_rect;\n" "void main() {\n" - " lowp float y_raw = texture2D(y_texture, v_texCoord).x;\n" - " lowp float u_unsigned = texture2D(u_texture, v_texCoord).x;\n" - " lowp float v_unsigned = texture2D(v_texture, v_texCoord).x;\n" - " lowp vec3 yuv = vec3(y_raw, u_unsigned, v_unsigned) + yuv_adj;\n" - " lowp vec3 rgb = yuv_matrix * yuv;\n" + " mediump vec2 ya_clamped =\n" + " max(ya_clamp_rect.xy, min(ya_clamp_rect.zw, v_yaTexCoord));\n" + " mediump float y_raw = texture2D(y_texture, ya_clamped).x;\n" + " mediump vec2 uv_clamped =\n" + " max(uv_clamp_rect.xy, min(uv_clamp_rect.zw, v_uvTexCoord));\n" + " mediump float u_unsigned = texture2D(u_texture, uv_clamped).x;\n" + " mediump float v_unsigned = texture2D(v_texture, uv_clamped).x;\n" + " mediump vec3 yuv = vec3(y_raw, u_unsigned, v_unsigned) + yuv_adj;\n" + " mediump vec3 rgb = yuv_matrix * yuv;\n" " gl_FragColor = vec4(rgb, 1.0) * alpha;\n" "}"; return shader; @@ -94,8 +105,12 @@ protected: virtual void initialize() Q_DECL_OVERRIDE { m_id_matrix = program()->uniformLocation("matrix"); - m_id_texScale = program()->uniformLocation("texScale"); - m_id_texOffset = program()->uniformLocation("texOffset"); + m_id_yaTexScale = program()->uniformLocation("yaTexScale"); + m_id_uvTexScale = program()->uniformLocation("uvTexScale"); + m_id_yaTexOffset = program()->uniformLocation("yaTexOffset"); + m_id_uvTexOffset = program()->uniformLocation("uvTexOffset"); + m_id_yaClampRect = program()->uniformLocation("ya_clamp_rect"); + m_id_uvClampRect = program()->uniformLocation("uv_clamp_rect"); m_id_yTexture = program()->uniformLocation("y_texture"); m_id_uTexture = program()->uniformLocation("u_texture"); m_id_vTexture = program()->uniformLocation("v_texture"); @@ -105,8 +120,12 @@ protected: } int m_id_matrix; - int m_id_texScale; - int m_id_texOffset; + int m_id_yaTexScale; + int m_id_uvTexScale; + int m_id_yaTexOffset; + int m_id_uvTexOffset; + int m_id_yaClampRect; + int m_id_uvClampRect; int m_id_yTexture; int m_id_uTexture; int m_id_vTexture; @@ -123,21 +142,28 @@ protected: virtual const char *fragmentShader() const Q_DECL_OVERRIDE { // Keep in sync with cc::FragmentShaderYUVAVideo static const char *shader = - "varying mediump vec2 v_texCoord;\n" + "varying mediump vec2 v_yaTexCoord;\n" + "varying mediump vec2 v_uvTexCoord;\n" "uniform sampler2D y_texture;\n" "uniform sampler2D u_texture;\n" "uniform sampler2D v_texture;\n" "uniform sampler2D a_texture;\n" - "uniform lowp float alpha;\n" - "uniform lowp vec3 yuv_adj;\n" - "uniform lowp mat3 yuv_matrix;\n" + "uniform mediump float alpha;\n" + "uniform mediump vec3 yuv_adj;\n" + "uniform mediump mat3 yuv_matrix;\n" + "uniform mediump vec4 ya_clamp_rect;\n" + "uniform mediump vec4 uv_clamp_rect;\n" "void main() {\n" - " lowp float y_raw = texture2D(y_texture, v_texCoord).x;\n" - " lowp float u_unsigned = texture2D(u_texture, v_texCoord).x;\n" - " lowp float v_unsigned = texture2D(v_texture, v_texCoord).x;\n" - " lowp float a_raw = texture2D(a_texture, v_texCoord).x;\n" - " lowp vec3 yuv = vec3(y_raw, u_unsigned, v_unsigned) + yuv_adj;\n" - " lowp vec3 rgb = yuv_matrix * yuv;\n" + " mediump vec2 ya_clamped =\n" + " max(ya_clamp_rect.xy, min(ya_clamp_rect.zw, v_yaTexCoord));\n" + " mediump float y_raw = texture2D(y_texture, ya_clamped).x;\n" + " mediump vec2 uv_clamped =\n" + " max(uv_clamp_rect.xy, min(uv_clamp_rect.zw, v_uvTexCoord));\n" + " mediump float u_unsigned = texture2D(u_texture, uv_clamped).x;\n" + " mediump float v_unsigned = texture2D(v_texture, uv_clamped).x;\n" + " mediump float a_raw = texture2D(a_texture, ya_clamped).x;\n" + " mediump vec3 yuv = vec3(y_raw, u_unsigned, v_unsigned) + yuv_adj;\n" + " mediump vec3 rgb = yuv_matrix * yuv;\n" " gl_FragColor = vec4(rgb, 1.0) * (alpha * a_raw);\n" "}"; return shader; @@ -156,6 +182,8 @@ void YUVVideoMaterialShader::updateState(const RenderState &state, QSGMaterial * { Q_UNUSED(oldMaterial); + // Keep logic in sync with logic in GLRenderer::DrawYUVVideoQuad: + YUVVideoMaterial *mat = static_cast<YUVVideoMaterial *>(newMaterial); program()->setUniformValue(m_id_yTexture, 0); program()->setUniformValue(m_id_uTexture, 1); @@ -170,18 +198,47 @@ void YUVVideoMaterialShader::updateState(const RenderState &state, QSGMaterial * glFuncs.glActiveTexture(GL_TEXTURE0); // Finish with 0 as default texture unit mat->m_yTexture->bind(); - program()->setUniformValue(m_id_texOffset, mat->m_texCoordRect.topLeft()); - program()->setUniformValue(m_id_texScale, mat->m_texCoordRect.size()); + const QSizeF yaSizeScale(1.0f / mat->m_yaTexSize.width(), 1.0f / mat->m_yaTexSize.height()); + const QSizeF uvSizeScale(1.0f / mat->m_uvTexSize.width(), 1.0f / mat->m_uvTexSize.height()); + + const QPointF yaTexOffset(mat->m_yaTexCoordRect.left() * yaSizeScale.width(), mat->m_yaTexCoordRect.top() * yaSizeScale.height()); + const QPointF uvTexOffset(mat->m_uvTexCoordRect.left() * uvSizeScale.width(), mat->m_uvTexCoordRect.top() * uvSizeScale.height()); + const QSizeF yaTexScale(mat->m_yaTexCoordRect.width() * yaSizeScale.width(), mat->m_yaTexCoordRect.height() * yaSizeScale.height()); + const QSizeF uvTexScale(mat->m_uvTexCoordRect.width() * uvSizeScale.width(), mat->m_uvTexCoordRect.height() * uvSizeScale.height()); + program()->setUniformValue(m_id_yaTexOffset, yaTexOffset); + program()->setUniformValue(m_id_uvTexOffset, uvTexOffset); + program()->setUniformValue(m_id_yaTexScale, yaTexScale); + program()->setUniformValue(m_id_uvTexScale, uvTexScale); + QRectF yaClampRect(yaTexOffset, yaTexScale); + QRectF uvClampRect(uvTexOffset, uvTexScale); + yaClampRect = yaClampRect.marginsRemoved(QMarginsF(yaSizeScale.width() * 0.5f, yaSizeScale.height() * 0.5f, + yaSizeScale.width() * 0.5f, yaSizeScale.height() * 0.5f)); + uvClampRect = uvClampRect.marginsRemoved(QMarginsF(uvSizeScale.width() * 0.5f, uvSizeScale.height() * 0.5f, + uvSizeScale.width() * 0.5f, uvSizeScale.height() * 0.5f)); + + const QVector4D yaClampV(yaClampRect.left(), yaClampRect.top(), yaClampRect.right(), yaClampRect.bottom()); + const QVector4D uvClampV(uvClampRect.left(), uvClampRect.top(), uvClampRect.right(), uvClampRect.bottom()); + program()->setUniformValue(m_id_yaClampRect, yaClampV); + program()->setUniformValue(m_id_uvClampRect, uvClampV); // These values are magic numbers that are used in the transformation from YUV // to RGB color values. They are taken from the following webpage: // http://www.fourcc.org/fccyvrgb.php - const float yuv_to_rgb[9] = { + const float yuv_to_rgb_rec601[9] = { 1.164f, 0.0f, 1.596f, 1.164f, -.391f, -.813f, 1.164f, 2.018f, 0.0f, }; - const QMatrix3x3 yuvMatrix(yuv_to_rgb); + const float yuv_to_rgb_rec709[9] = { + 1.164f, 0.0f, 1.793f, + 1.164f, -0.213f, -0.533f, + 1.164f, 2.112f, 0.0f, + }; + const float yuv_to_rgb_jpeg[9] = { + 1.f, 0.0f, 1.402f, + 1.f, -.34414f, -.71414f, + 1.f, 1.772f, 0.0f, + }; // These values map to 16, 128, and 128 respectively, and are computed // as a fraction over 256 (e.g. 16 / 256 = 0.0625). @@ -189,9 +246,35 @@ void YUVVideoMaterialShader::updateState(const RenderState &state, QSGMaterial * // Y - 16 : Gives 16 values of head and footroom for overshooting // U - 128 : Turns unsigned U into signed U [-128,127] // V - 128 : Turns unsigned V into signed V [-128,127] - const QVector3D yuvAdjust(-0.0625f, -0.5f, -0.5f); - program()->setUniformValue(m_id_yuvMatrix, yuvMatrix); - program()->setUniformValue(m_id_yuvAdjust, yuvAdjust); + const float yuv_adjust_constrained[3] = { + -0.0625f, -0.5f, -0.5f, + }; + + // Same as above, but without the head and footroom. + const float yuv_adjust_full[3] = { + 0.0f, -0.5f, -0.5f, + }; + + const float *yuv_to_rgb = 0; + const float *yuv_adjust = 0; + + switch (mat->m_colorSpace) { + case YUVVideoMaterial::REC_601: + yuv_to_rgb = yuv_to_rgb_rec601; + yuv_adjust = yuv_adjust_constrained; + break; + case YUVVideoMaterial::REC_709: + yuv_to_rgb = yuv_to_rgb_rec709; + yuv_adjust = yuv_adjust_constrained; + break; + case YUVVideoMaterial::JPEG: + yuv_to_rgb = yuv_to_rgb_jpeg; + yuv_adjust = yuv_adjust_full; + break; + } + + program()->setUniformValue(m_id_yuvMatrix, QMatrix3x3(yuv_to_rgb)); + program()->setUniformValue(m_id_yuvAdjust, QVector3D(yuv_adjust[0], yuv_adjust[1], yuv_adjust[2])); if (state.isOpacityDirty()) program()->setUniformValue(m_id_opacity, state.opacity()); @@ -217,11 +300,17 @@ void YUVAVideoMaterialShader::updateState(const RenderState &state, QSGMaterial } -YUVVideoMaterial::YUVVideoMaterial(QSGTexture *yTexture, QSGTexture *uTexture, QSGTexture *vTexture, const QRectF &texCoordRect) +YUVVideoMaterial::YUVVideoMaterial(QSGTexture *yTexture, QSGTexture *uTexture, QSGTexture *vTexture, + const QRectF &yaTexCoordRect, const QRectF &uvTexCoordRect, const QSizeF &yaTexSize, const QSizeF &uvTexSize, + YUVVideoMaterial::ColorSpace colorspace) : m_yTexture(yTexture) , m_uTexture(uTexture) , m_vTexture(vTexture) - , m_texCoordRect(texCoordRect) + , m_yaTexCoordRect(yaTexCoordRect) + , m_uvTexCoordRect(uvTexCoordRect) + , m_yaTexSize(yaTexSize) + , m_uvTexSize(uvTexSize) + , m_colorSpace(colorspace) { } @@ -240,8 +329,10 @@ int YUVVideoMaterial::compare(const QSGMaterial *other) const return m_vTexture->textureId() - m->m_vTexture->textureId(); } -YUVAVideoMaterial::YUVAVideoMaterial(QSGTexture *yTexture, QSGTexture *uTexture, QSGTexture *vTexture, QSGTexture *aTexture, const QRectF &texCoordRect) - : YUVVideoMaterial(yTexture, uTexture, vTexture, texCoordRect) +YUVAVideoMaterial::YUVAVideoMaterial(QSGTexture *yTexture, QSGTexture *uTexture, QSGTexture *vTexture, QSGTexture *aTexture, + const QRectF &yaTexCoordRect, const QRectF &uvTexCoordRect, const QSizeF &yaTexSize, const QSizeF &uvTexSize, + YUVVideoMaterial::ColorSpace colorspace) + : YUVVideoMaterial(yTexture, uTexture, vTexture, yaTexCoordRect, uvTexCoordRect, yaTexSize, uvTexSize, colorspace) , m_aTexture(aTexture) { setFlag(Blending, aTexture); @@ -260,15 +351,17 @@ int YUVAVideoMaterial::compare(const QSGMaterial *other) const return (m_aTexture ? m_aTexture->textureId() : 0) - (m->m_aTexture ? m->m_aTexture->textureId() : 0); } -YUVVideoNode::YUVVideoNode(QSGTexture *yTexture, QSGTexture *uTexture, QSGTexture *vTexture, QSGTexture *aTexture, const QRectF &texCoordRect) +YUVVideoNode::YUVVideoNode(QSGTexture *yTexture, QSGTexture *uTexture, QSGTexture *vTexture, QSGTexture *aTexture, + const QRectF &yaTexCoordRect, const QRectF &uvTexCoordRect, const QSizeF &yaTexSize, const QSizeF &uvTexSize, + YUVVideoMaterial::ColorSpace colorspace) : m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4) { setGeometry(&m_geometry); setFlag(QSGNode::OwnsMaterial); if (aTexture) - m_material = new YUVAVideoMaterial(yTexture, uTexture, vTexture, aTexture, texCoordRect); + m_material = new YUVAVideoMaterial(yTexture, uTexture, vTexture, aTexture, yaTexCoordRect, uvTexCoordRect, yaTexSize, uvTexSize, colorspace); else - m_material = new YUVVideoMaterial(yTexture, uTexture, vTexture, texCoordRect); + m_material = new YUVVideoMaterial(yTexture, uTexture, vTexture, yaTexCoordRect, uvTexCoordRect, yaTexSize, uvTexSize, colorspace); setMaterial(m_material); } diff --git a/src/core/yuv_video_node.h b/src/core/yuv_video_node.h index f96df56ce..457c2c7fe 100644 --- a/src/core/yuv_video_node.h +++ b/src/core/yuv_video_node.h @@ -50,7 +50,14 @@ QT_END_NAMESPACE class YUVVideoMaterial : public QSGMaterial { public: - YUVVideoMaterial(QSGTexture *yTexture, QSGTexture *uTexture, QSGTexture *vTexture, const QRectF &texCoordRect); + enum ColorSpace { + REC_601, // SDTV standard with restricted "studio swing" color range. + REC_709, // HDTV standard with restricted "studio swing" color range. + JPEG // Full color range [0, 255] JPEG color space. + }; + YUVVideoMaterial(QSGTexture *yTexture, QSGTexture *uTexture, QSGTexture *vTexture, + const QRectF &yaTexCoordRect, const QRectF &uvTexCoordRect, const QSizeF &yaTexSize, const QSizeF &uvTexSize, + ColorSpace colorspace); virtual QSGMaterialType *type() const Q_DECL_OVERRIDE { static QSGMaterialType theType; @@ -63,13 +70,20 @@ public: QSGTexture *m_yTexture; QSGTexture *m_uTexture; QSGTexture *m_vTexture; - QRectF m_texCoordRect; + QRectF m_yaTexCoordRect; + QRectF m_uvTexCoordRect; + QSizeF m_yaTexSize; + QSizeF m_uvTexSize; + ColorSpace m_colorSpace; + }; class YUVAVideoMaterial : public YUVVideoMaterial { public: - YUVAVideoMaterial(QSGTexture *yTexture, QSGTexture *uTexture, QSGTexture *vTexture, QSGTexture *aTexture, const QRectF &texCoordRect); + YUVAVideoMaterial(QSGTexture *yTexture, QSGTexture *uTexture, QSGTexture *vTexture, QSGTexture *aTexture, + const QRectF &yaTexCoordRect, const QRectF &uvTexCoordRect, const QSizeF &yaTexSize, const QSizeF &uvTexSize, + ColorSpace colorspace); virtual QSGMaterialType *type() const Q_DECL_OVERRIDE{ static QSGMaterialType theType; @@ -85,7 +99,9 @@ public: class YUVVideoNode : public QSGGeometryNode { public: - YUVVideoNode(QSGTexture *yTexture, QSGTexture *uTexture, QSGTexture *vTexture, QSGTexture *aTexture, const QRectF &texCoordRect); + YUVVideoNode(QSGTexture *yTexture, QSGTexture *uTexture, QSGTexture *vTexture, QSGTexture *aTexture, + const QRectF &yaTexCoordRect, const QRectF &uvTexCoordRect, const QSizeF &yaTexSize, const QSizeF &uvTexSize, + YUVVideoMaterial::ColorSpace colorspace); void setRect(const QRectF &rect); private: diff --git a/tools/buildscripts/gyp_qtwebengine b/tools/buildscripts/gyp_qtwebengine index 970cce54e..1fc7ab7a9 100755 --- a/tools/buildscripts/gyp_qtwebengine +++ b/tools/buildscripts/gyp_qtwebengine @@ -25,6 +25,12 @@ if sys.platform in ('cygwin', 'win32'): if os.path.isdir(gnuwin_tools_dir): os.environ['PATH'] = gnuwin_tools_dir + os.pathsep + os.environ['PATH'] +if 'VisualStudioVersion' in os.environ: + if os.environ['VisualStudioVersion'] == '12.0': + os.environ['GYP_MSVS_VERSION'] = '2013' + elif os.environ['VisualStudioVersion'] == '14.0': + os.environ['GYP_MSVS_VERSION'] = '2015' + sys.path.insert(1, script_dir) import gyp_helper sys.path.insert(1, os.path.join(chrome_src, 'tools', 'gyp', 'pylib')) @@ -140,6 +146,8 @@ if __name__ == '__main__': args.extend(['-D', 'linux_use_bundled_binutils=0']) args.extend(['-D', 'linux_use_gold_flags=0']) args.extend(['-D', 'clang_use_chrome_plugins=0']) + # We do not want to ship more external binary blobs, so let v8 embed its startup data. + args.extend(['-D', 'v8_use_external_startup_data=0']) # Trigger Qt-specific build conditions. args.extend(['-D', 'use_qt=1']) # Tweak the output location and format (hardcode ninja for now if not set) diff --git a/tools/qmake/mkspecs/features/configure.prf b/tools/qmake/mkspecs/features/configure.prf index 7b111b78f..dac33922f 100644 --- a/tools/qmake/mkspecs/features/configure.prf +++ b/tools/qmake/mkspecs/features/configure.prf @@ -23,10 +23,18 @@ defineTest(runConfigure) { linux:!config_libcap:skipBuild("libcap development package appears to be missing") linux:!config_khr:skipBuild("khronos development headers appear to be missing (mesa/libegl1-mesa-dev)") contains(QT_CONFIG, xcb) { - for(package, $$list("libdrm xcomposite xi xrandr")) { + for(package, $$list("libdrm xcomposite xi xrandr xscrnsaver")) { !packagesExist($$package):skipBuild("Unmet dependency: $$package") } } + + linux { + packagesExist(minizip, zlib): CONFIG += config_system_minizip + else: log("System zlib and minizip not found. Using Chromium's copies.$${EOL}") + packagesExist(libxml-2.0,libxslt): CONFIG += config_system_libxslt + else: log("System libxml2 and libxslt not found. Using Chromium's copies.$${EOL}") + } + isEmpty(skipBuildReason):cache(CONFIG, add, $$list(webengine_successfully_configured)) } diff --git a/tools/scripts/take_snapshot.py b/tools/scripts/take_snapshot.py index bd2ec4e56..363998357 100755 --- a/tools/scripts/take_snapshot.py +++ b/tools/scripts/take_snapshot.py @@ -78,7 +78,7 @@ def isInChromiumBlacklist(file_path): or file_path.startswith('third_party/android_tools') or '/tests/' in file_path or ('/test/' in file_path and - not '/webrtc/test/testsupport/' in file_path and + not '/webrtc/' in file_path and not file_path.startswith('net/test/') and not file_path.endswith('mock_chrome_application_mac.h') and not file_path.endswith('perftimer.h') and @@ -100,9 +100,9 @@ def isInChromiumBlacklist(file_path): not 'repack_locales' in file_path and not 'third_party/chromevox' in file_path and not 'media/desktop_media_list.h' in file_path and - not 'media/desktop_streams_registry.cc' in file_path and - not 'media/desktop_streams_registry.h' in file_path and - not 'common/localized_error' in file_path and + not 'media/desktop_streams_registry.' in file_path and + not 'common/chrome_switches.' in file_path and + not 'common/localized_error.' in file_path and not file_path.endswith('cf_resources.rc') and not file_path.endswith('version.py') and not file_path.endswith('.grd') and @@ -113,16 +113,24 @@ def isInChromiumBlacklist(file_path): or file_path.startswith('chromeos') or file_path.startswith('cloud_print') or (file_path.startswith('components') and + not file_path.startswith('components/device_event_log') and + not file_path.startswith('components/devtools_') and + not file_path.startswith('components/error_page') and + not file_path.startswith('components/mime_util') and + not file_path.startswith('components/printing') and + not file_path.startswith('components/resources') and + not file_path.startswith('components/scheduler') and + not file_path.startswith('components/strings') and not file_path.startswith('components/tracing') and not file_path.startswith('components/visitedlink') and - not file_path.startswith('components/error_page') and + not file_path.startswith('components/webcrypto') and not file_path.endswith('.grdp') and not 'components_strings' in file_path) or file_path.startswith('content/public/android/java') - or file_path.startswith('content/shell') + or (file_path.startswith('content/shell') and + not file_path.startswith('content/shell/common')) or file_path.startswith('courgette') or (file_path.startswith('extensions') and - # Included by generated sources of ui/accessibility/ax_enums.idl not 'browser/extension_function_registry.h' in file_path and not 'browser/extension_function_histogram_value.h' in file_path) or file_path.startswith('google_update') @@ -136,17 +144,11 @@ def isInChromiumBlacklist(file_path): or file_path.startswith('sync') or file_path.startswith('testing/android') or file_path.startswith('testing/buildbot') - or file_path.startswith('third_party/accessibility-developer-tools') - or file_path.startswith('third_party/GTM') or file_path.startswith('third_party/WebKit/LayoutTests') or file_path.startswith('third_party/WebKit/ManualTests') or file_path.startswith('third_party/WebKit/PerformanceTests') - or file_path.startswith('third_party/active_doc') - or file_path.startswith('third_party/android_crazy_linker') - or file_path.startswith('third_party/android_platform') - or file_path.startswith('third_party/android_testrunner') - or file_path.startswith('third_party/aosp') - or file_path.startswith('third_party/apache-mime4j') + or file_path.startswith('third_party/accessibility-audit') + or file_path.startswith('third_party/android_') or file_path.startswith('third_party/apache-win32') or file_path.startswith('third_party/apple_sample_code') or file_path.startswith('third_party/binutils') @@ -157,13 +159,10 @@ def isInChromiumBlacklist(file_path): or file_path.startswith('third_party/cld_2') or file_path.startswith('third_party/codesighs') or file_path.startswith('third_party/colorama') - or file_path.startswith('third_party/cros_dbus_cplusplus') or file_path.startswith('third_party/cros_system_api') or file_path.startswith('third_party/cygwin') or file_path.startswith('third_party/cython') or file_path.startswith('third_party/elfutils') - or file_path.startswith('third_party/eyesfree') - or file_path.startswith('third_party/findbugs') or file_path.startswith('third_party/google_input_tools') or file_path.startswith('third_party/gperf') or file_path.startswith('third_party/gnu_binutils') @@ -176,7 +175,6 @@ def isInChromiumBlacklist(file_path): or file_path.startswith('third_party/hunspell') or file_path.startswith('third_party/hunspell_dictionaries') or file_path.startswith('third_party/instrumented_libraries') - or file_path.startswith('third_party/jarjar') or file_path.startswith('third_party/jsr-305/src') or file_path.startswith('third_party/junit') or file_path.startswith('third_party/libphonenumber') @@ -188,7 +186,8 @@ def isInChromiumBlacklist(file_path): or file_path.startswith('third_party/markdown') or file_path.startswith('third_party/mingw-w64') or file_path.startswith('third_party/nacl_sdk_binaries') - or file_path.startswith('third_party/polymer') + or (file_path.startswith('third_party/polymer') and + not file_path.startswith('third_party/polymer/components-chromium/')) or file_path.startswith('third_party/pdfsqueeze') or file_path.startswith('third_party/pefile') or file_path.startswith('third_party/perl') @@ -196,8 +195,6 @@ def isInChromiumBlacklist(file_path): or file_path.startswith('third_party/psyco_win32') or file_path.startswith('third_party/python_26') or file_path.startswith('third_party/scons-2.0.1') - or file_path.startswith('third_party/syzygy') - or file_path.startswith('third_party/swig') or file_path.startswith('third_party/webgl') or file_path.startswith('third_party/trace-viewer') or file_path.startswith('third_party/xulrunner-sdk') diff --git a/tools/scripts/version_resolver.py b/tools/scripts/version_resolver.py index 419fb72d1..572c3dcba 100644 --- a/tools/scripts/version_resolver.py +++ b/tools/scripts/version_resolver.py @@ -51,8 +51,8 @@ import json import urllib2 import git_submodule as GitSubmodule -chromium_version = '40.0.2214.115' -chromium_branch = '2214' +chromium_version = '44.0.2403.47' +chromium_branch = '2403' ninja_version = 'v1.5.3' json_url = 'http://omahaproxy.appspot.com/all.json' @@ -64,6 +64,7 @@ upstream_src_dir = os.path.abspath(snapshot_src_dir + '_upstream') submodule_blacklist = [ 'third_party/WebKit/LayoutTests/w3c/csswg-test' , 'third_party/WebKit/LayoutTests/w3c/web-platform-tests' + , 'third_party/jsoncpp/source' , 'chrome/tools/test/reference_build/chrome_mac' , 'chrome/tools/test/reference_build/chrome_linux' , 'chrome/tools/test/reference_build/chrome_win' |