From ff47f09a94a0a31edd40500985ff670e8f35cc2c Mon Sep 17 00:00:00 2001 From: Szabolcs David Date: Thu, 4 Dec 2014 07:07:32 -0800 Subject: Add a stub QuotaPermissionContext implementation This prevents the crash when the application requests persistent storage access using the Quota API (e.g. on http://codepen.io/matt-west/full/CrfKh). The request has been disallowed for now, because it should rely on user permission. Change-Id: I4ae057c9485d3f06f45a637c7eeda9dd69fe6b54 Reviewed-by: Andras Becsi --- src/core/content_browser_client_qt.cpp | 16 ++++++++++++++++ src/core/content_browser_client_qt.h | 1 + 2 files changed, 17 insertions(+) diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index ee403298b..4948d1d8d 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -42,6 +42,7 @@ #include "content/public/browser/browser_main_parts.h" #include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/media_observer.h" +#include "content/public/browser/quota_permission_context.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" @@ -294,6 +295,16 @@ void ShareGroupQtQuick::AboutToAddFirstContext() m_shareContextQtQuick = make_scoped_refptr(new QtShareGLContext(shareContext)); } +class QuotaPermissionContextQt : public content::QuotaPermissionContext { +public: + virtual void RequestQuotaPermission(const content::StorageQuotaParams ¶ms, int render_process_id, const PermissionCallback &callback) Q_DECL_OVERRIDE + { + Q_UNUSED(params); + Q_UNUSED(render_process_id); + callback.Run(QUOTA_PERMISSION_RESPONSE_DISALLOW); + } +}; + ContentBrowserClientQt::ContentBrowserClientQt() : m_browserMainParts(0) { @@ -374,6 +385,11 @@ void ContentBrowserClientQt::enableInspector(bool enable) } } +content::QuotaPermissionContext *ContentBrowserClientQt::CreateQuotaPermissionContext() +{ + return new QuotaPermissionContextQt; +} + void ContentBrowserClientQt::AllowCertificateError(int render_process_id, int render_frame_id, int cert_error, const net::SSLInfo& ssl_info, const GURL& request_url, ResourceType::Type resource_type, diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h index 4f216030c..f1ecf5825 100644 --- a/src/core/content_browser_client_qt.h +++ b/src/core/content_browser_client_qt.h @@ -80,6 +80,7 @@ public: virtual content::MediaObserver* GetMediaObserver() Q_DECL_OVERRIDE; virtual void OverrideWebkitPrefs(content::RenderViewHost *, const GURL &, WebPreferences *) Q_DECL_OVERRIDE; virtual content::AccessTokenStore *CreateAccessTokenStore() Q_DECL_OVERRIDE; + virtual content::QuotaPermissionContext *CreateQuotaPermissionContext() Q_DECL_OVERRIDE; virtual void AllowCertificateError( int render_process_id, int render_frame_id, -- cgit v1.2.3