summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/browser_context_adapter.cpp14
-rw-r--r--src/core/browser_context_adapter.h3
-rw-r--r--src/core/browser_context_qt.cpp9
-rw-r--r--src/core/browser_context_qt.h1
-rw-r--r--src/core/content_browser_client_qt.cpp17
-rw-r--r--src/core/content_browser_client_qt.h7
-rw-r--r--src/core/gyp_run.pro3
-rw-r--r--src/core/network_delegate_qt.cpp3
-rw-r--r--src/core/renderer/content_renderer_client_qt.cpp57
-rw-r--r--src/core/renderer/content_renderer_client_qt.h6
-rw-r--r--src/core/resource_bundle_qt.cpp9
-rw-r--r--src/core/type_conversion.h4
-rw-r--r--src/core/url_request_context_getter_qt.cpp9
-rw-r--r--src/core/url_request_context_getter_qt.h5
-rw-r--r--src/core/web_contents_adapter.cpp4
-rw-r--r--src/core/web_engine_context.cpp1
-rw-r--r--src/core/web_engine_settings.cpp2
-rw-r--r--src/core/web_engine_settings.h1
18 files changed, 104 insertions, 51 deletions
diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp
index 2d56dcff7..b06515c2f 100644
--- a/src/core/browser_context_adapter.cpp
+++ b/src/core/browser_context_adapter.cpp
@@ -78,12 +78,24 @@ BrowserContextAdapter* BrowserContextAdapter::offTheRecordContext()
return WebEngineContext::current()->offTheRecordBrowserContext();
}
-QString BrowserContextAdapter::path() const
+QString BrowserContextAdapter::dataPath() const
{
QString dataLocation = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
if (dataLocation.isEmpty())
dataLocation = QDir::homePath() % QDir::separator() % QChar::fromLatin1('.') % QCoreApplication::applicationName();
dataLocation.append(QDir::separator() % QLatin1String("QtWebEngine"));
+ dataLocation.append(QDir::separator() % QLatin1String("Default"));
return dataLocation;
}
+
+QString BrowserContextAdapter::cachePath() const
+{
+ QString cacheLocation = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
+ if (cacheLocation.isEmpty())
+ cacheLocation = QDir::homePath() % QDir::separator() % QChar::fromLatin1('.') % QCoreApplication::applicationName();
+
+ cacheLocation.append(QDir::separator() % QLatin1String("QtWebEngine"));
+ cacheLocation.append(QDir::separator() % QLatin1String("Default"));
+ return cacheLocation;
+}
diff --git a/src/core/browser_context_adapter.h b/src/core/browser_context_adapter.h
index 99022f98d..362ab79ee 100644
--- a/src/core/browser_context_adapter.h
+++ b/src/core/browser_context_adapter.h
@@ -58,7 +58,8 @@ public:
BrowserContextQt *browserContext();
bool isOffTheRecord() const { return m_offTheRecord; }
- QString path() const;
+ QString dataPath() const;
+ QString cachePath() const;
protected:
explicit BrowserContextAdapter(bool offTheRecord = false);
diff --git a/src/core/browser_context_qt.cpp b/src/core/browser_context_qt.cpp
index 4c17171d4..8dc4a3da2 100644
--- a/src/core/browser_context_qt.cpp
+++ b/src/core/browser_context_qt.cpp
@@ -62,7 +62,12 @@ BrowserContextQt::~BrowserContextQt()
base::FilePath BrowserContextQt::GetPath() const
{
- return base::FilePath(toFilePathString(m_adapter->path()));
+ return base::FilePath(toFilePathString(m_adapter->dataPath()));
+}
+
+base::FilePath BrowserContextQt::GetCachePath() const
+{
+ return base::FilePath(toFilePathString(m_adapter->cachePath()));
}
bool BrowserContextQt::IsOffTheRecord() const
@@ -123,7 +128,7 @@ content::PushMessagingService *BrowserContextQt::GetPushMessagingService()
net::URLRequestContextGetter *BrowserContextQt::CreateRequestContext(content::ProtocolHandlerMap *protocol_handlers)
{
- url_request_getter_ = new URLRequestContextGetterQt(GetPath(), protocol_handlers);
+ url_request_getter_ = new URLRequestContextGetterQt(GetPath(), GetCachePath(), protocol_handlers);
static_cast<ResourceContextQt*>(resourceContext.get())->set_url_request_context_getter(url_request_getter_.get());
return url_request_getter_.get();
}
diff --git a/src/core/browser_context_qt.h b/src/core/browser_context_qt.h
index 4e18c1a4a..634db6f3f 100644
--- a/src/core/browser_context_qt.h
+++ b/src/core/browser_context_qt.h
@@ -53,6 +53,7 @@ public:
virtual ~BrowserContextQt();
virtual base::FilePath GetPath() const Q_DECL_OVERRIDE;
+ base::FilePath GetCachePath() const;
virtual bool IsOffTheRecord() const Q_DECL_OVERRIDE;
virtual net::URLRequestContextGetter *GetRequestContext() Q_DECL_OVERRIDE;
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index f10dd7500..2aca88d6a 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -371,3 +371,20 @@ void ContentBrowserClientQt::AllowCertificateError(int render_process_id, int re
QExplicitlySharedDataPointer<CertificateErrorController> errorController(new CertificateErrorController(new CertificateErrorControllerPrivate(cert_error, ssl_info, request_url, resource_type, overridable, strict_enforcement, callback)));
contentsDelegate->allowCertificateError(errorController);
}
+
+void ContentBrowserClientQt::RequestGeolocationPermission(content::WebContents *webContents,
+ int bridge_id,
+ const GURL &requesting_frame,
+ bool user_gesture,
+ base::Callback<void(bool)> result_callback,
+ base::Closure *cancel_callback)
+{
+ Q_UNUSED(webContents);
+ Q_UNUSED(bridge_id);
+ Q_UNUSED(requesting_frame);
+ Q_UNUSED(user_gesture);
+ Q_UNUSED(cancel_callback);
+
+ // TODO: Add geolocation support
+ result_callback.Run(false);
+}
diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h
index 3a70e2427..ed328d1bf 100644
--- a/src/core/content_browser_client_qt.h
+++ b/src/core/content_browser_client_qt.h
@@ -90,6 +90,13 @@ public:
bool strict_enforcement,
const base::Callback<void(bool)>& callback,
content::CertificateRequestResultType* result) Q_DECL_OVERRIDE;
+ virtual void RequestGeolocationPermission(
+ content::WebContents *webContents,
+ int bridge_id,
+ const GURL &requesting_frame,
+ bool user_gesture,
+ base::Callback<void(bool)> result_callback,
+ base::Closure *cancel_callback) Q_DECL_OVERRIDE;
virtual net::URLRequestContextGetter *CreateRequestContext(content::BrowserContext *content_browser_context, content::ProtocolHandlerMap *protocol_handlers, content::URLRequestInterceptorScopedVector request_interceptorss) Q_DECL_OVERRIDE;
diff --git a/src/core/gyp_run.pro b/src/core/gyp_run.pro
index f79972a2e..137b600b9 100644
--- a/src/core/gyp_run.pro
+++ b/src/core/gyp_run.pro
@@ -61,6 +61,7 @@ cross_compile {
!isEmpty(MARMV) {
MARMV = $$split(MARMV,)
MARMV = $$member(MARMV, 0)
+ lessThan(MARMV, 6): error("$$MARCH architecture is not supported")
GYP_ARGS += "-D arm_version=\"$$MARMV\""
}
@@ -69,7 +70,7 @@ cross_compile {
# If the toolchain does not explicitly specify to use NEON instructions
# we use arm_neon_optional for ARMv7 and newer and let chromium decide
# about the mfpu option.
- contains(MFPU, "neon"): GYP_ARGS += "-D arm_fpu=\"$$MFPU\" -D arm_neon=1"
+ contains(MFPU, "neon")|contains(MFPU, "neon-vfpv4"): GYP_ARGS += "-D arm_fpu=\"$$MFPU\" -D arm_neon=1"
else:!lessThan(MARMV, 7): GYP_ARGS += "-D arm_neon=0 -D arm_neon_optional=1"
else: GYP_ARGS += "-D arm_fpu=\"$$MFPU\" -D arm_neon=0 -D arm_neon_optional=0"
}
diff --git a/src/core/network_delegate_qt.cpp b/src/core/network_delegate_qt.cpp
index 81ab4b6bc..f14d2cb39 100644
--- a/src/core/network_delegate_qt.cpp
+++ b/src/core/network_delegate_qt.cpp
@@ -130,6 +130,9 @@ void NetworkDelegateQt::CompleteURLRequestOnIOThread(net::URLRequest *request,
if (!m_activeRequests.contains(request))
return;
+ if (request->status().status() == net::URLRequestStatus::CANCELED)
+ return;
+
int error = net::OK;
switch (navigationRequestAction) {
case WebContentsAdapterClient::AcceptRequest:
diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp
index 6d4315b64..bfc5c389f 100644
--- a/src/core/renderer/content_renderer_client_qt.cpp
+++ b/src/core/renderer/content_renderer_client_qt.cpp
@@ -39,6 +39,7 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/common/localized_error.h"
#include "components/visitedlink/renderer/visitedlink_slave.h"
+#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_thread.h"
#include "content/public/renderer/render_view.h"
#include "net/base/net_errors.h"
@@ -46,6 +47,7 @@
#include "third_party/WebKit/public/platform/WebURLRequest.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/webui/jstemplate_builder.h"
+#include "webkit/common/webpreferences.h"
#include "renderer/qt_render_view_observer.h"
@@ -84,37 +86,40 @@ bool ContentRendererClientQt::HasErrorPage(int httpStatusCode, std::string *erro
return true;
}
+bool ContentRendererClientQt::ShouldSuppressErrorPage(content::RenderFrame *frame, const GURL &)
+{
+ return !(frame->GetWebkitPreferences().enable_error_page);
+}
+
// To tap into the chromium localized strings. Ripped from the chrome layer (highly simplified).
-void ContentRendererClientQt::GetNavigationErrorStrings(content::RenderView* render_view, blink::WebFrame *frame, const blink::WebURLRequest &failed_request, const blink::WebURLError &error, std::string *error_html, base::string16 *error_description)
+void ContentRendererClientQt::GetNavigationErrorStrings(content::RenderView* renderView, blink::WebFrame *frame, const blink::WebURLRequest &failedRequest, const blink::WebURLError &error, std::string *errorHtml, base::string16 *errorDescription)
{
Q_UNUSED(frame)
-
- const bool isPost = EqualsASCII(failed_request.httpMethod(), "POST");
-
- if (error_html) {
- // Use a local error page.
- int resource_id;
- base::DictionaryValue error_strings;
-
- const std::string locale = content::RenderThread::Get()->GetLocale();
- // TODO(elproxy): We could potentially get better diagnostics here by first calling NetErrorHelper::GetErrorStringsForDnsProbe
- LocalizedError::GetStrings(error.reason, error.domain.utf8(),
- error.unreachableURL, isPost, error.staleCopyInCache && !isPost,
- locale, render_view->GetAcceptLanguages(), scoped_ptr<LocalizedError::ErrorPageParams>(),
- &error_strings);
- resource_id = IDR_NET_ERROR_HTML;
-
-
- const base::StringPiece template_html(ui::ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id));
- if (template_html.empty())
- NOTREACHED() << "unable to load template. ID: " << resource_id;
- else // "t" is the id of the templates root node.
- *error_html = webui::GetTemplatesHtml(template_html, &error_strings, "t");
+ const bool isPost = EqualsASCII(failedRequest.httpMethod(), "POST");
+
+ if (errorHtml) {
+ // Use a local error page.
+ int resourceId;
+ base::DictionaryValue errorStrings;
+
+ const std::string locale = content::RenderThread::Get()->GetLocale();
+ // TODO(elproxy): We could potentially get better diagnostics here by first calling
+ // NetErrorHelper::GetErrorStringsForDnsProbe, but that one is harder to untangle.
+ LocalizedError::GetStrings(error.reason, error.domain.utf8(), error.unreachableURL, isPost
+ , error.staleCopyInCache && !isPost, locale, renderView->GetAcceptLanguages()
+ , scoped_ptr<LocalizedError::ErrorPageParams>(), &errorStrings);
+ resourceId = IDR_NET_ERROR_HTML;
+
+
+ const base::StringPiece template_html(ui::ResourceBundle::GetSharedInstance().GetRawDataResource(resourceId));
+ if (template_html.empty())
+ NOTREACHED() << "unable to load template. ID: " << resourceId;
+ else // "t" is the id of the templates root node.
+ *errorHtml = webui::GetTemplatesHtml(template_html, &errorStrings, "t");
}
- if (error_description) {
- *error_description = LocalizedError::GetErrorDetails(error, isPost);
- }
+ if (errorDescription)
+ *errorDescription = LocalizedError::GetErrorDetails(error, isPost);
}
unsigned long long ContentRendererClientQt::VisitedLinkHash(const char *canonicalUrl, size_t length)
diff --git a/src/core/renderer/content_renderer_client_qt.h b/src/core/renderer/content_renderer_client_qt.h
index 386495e20..4e3c70cf8 100644
--- a/src/core/renderer/content_renderer_client_qt.h
+++ b/src/core/renderer/content_renderer_client_qt.h
@@ -50,10 +50,10 @@ public:
virtual void RenderThreadStarted() Q_DECL_OVERRIDE;
virtual void RenderViewCreated(content::RenderView *render_view) Q_DECL_OVERRIDE;
- virtual bool ShouldSuppressErrorPage(content::RenderFrame *, const GURL &) Q_DECL_OVERRIDE { return false; }
+ virtual bool ShouldSuppressErrorPage(content::RenderFrame *, const GURL &) Q_DECL_OVERRIDE;
virtual bool HasErrorPage(int httpStatusCode, std::string *errorDomain) Q_DECL_OVERRIDE;
- virtual void GetNavigationErrorStrings(content::RenderView* render_view, blink::WebFrame* frame, const blink::WebURLRequest& failed_request
- , const blink::WebURLError& error, std::string* error_html, base::string16* error_description) Q_DECL_OVERRIDE;
+ virtual void GetNavigationErrorStrings(content::RenderView* renderView, blink::WebFrame* frame, const blink::WebURLRequest& failedRequest
+ , const blink::WebURLError& error, std::string* errorHtml, base::string16* errorDescription) Q_DECL_OVERRIDE;
virtual unsigned long long VisitedLinkHash(const char *canonicalUrl, size_t length) Q_DECL_OVERRIDE;
virtual bool IsLinkVisited(unsigned long long linkHash) Q_DECL_OVERRIDE;
diff --git a/src/core/resource_bundle_qt.cpp b/src/core/resource_bundle_qt.cpp
index 2487cdbd1..d69ae05e1 100644
--- a/src/core/resource_bundle_qt.cpp
+++ b/src/core/resource_bundle_qt.cpp
@@ -47,15 +47,6 @@ void ResourceBundle::LoadCommonResources()
AddDataPackFromPath(WebEngineLibraryInfo::getPath(QT_RESOURCES_PAK), SCALE_FACTOR_100P);
}
-// As GetLocaleFilePath is excluded for Mac in resource_bundle.cc,
-// we have to add a replacement for it using the inverted logic.
-#if defined(OS_MACOSX)
-base::FilePath ResourceBundle::GetLocaleFilePath(const std::string& /*app_locale*/, bool /*test_file_exists*/)
-{
- return base::FilePath();
-}
-#endif
-
gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl)
{
LOG(WARNING) << "Unable to load image with id " << resource_id;
diff --git a/src/core/type_conversion.h b/src/core/type_conversion.h
index 8d33b5ffa..9d9cdd675 100644
--- a/src/core/type_conversion.h
+++ b/src/core/type_conversion.h
@@ -121,11 +121,13 @@ inline QColor toQt(const SkColor &c)
inline QMatrix4x4 toQt(const SkMatrix44 &m)
{
- return QMatrix4x4(
+ QMatrix4x4 qtMatrix(
m.get(0, 0), m.get(0, 1), m.get(0, 2), m.get(0, 3),
m.get(1, 0), m.get(1, 1), m.get(1, 2), m.get(1, 3),
m.get(2, 0), m.get(2, 1), m.get(2, 2), m.get(2, 3),
m.get(3, 0), m.get(3, 1), m.get(3, 2), m.get(3, 3));
+ qtMatrix.optimize();
+ return qtMatrix;
}
inline QDateTime toQt(base::Time time)
diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp
index 8d44d0ad1..8ec600a85 100644
--- a/src/core/url_request_context_getter_qt.cpp
+++ b/src/core/url_request_context_getter_qt.cpp
@@ -69,9 +69,10 @@ static const char kQrcSchemeQt[] = "qrc";
using content::BrowserThread;
-URLRequestContextGetterQt::URLRequestContextGetterQt(const base::FilePath &basePath, content::ProtocolHandlerMap *protocolHandlers)
+URLRequestContextGetterQt::URLRequestContextGetterQt(const base::FilePath &dataPath, const base::FilePath &cachePath, content::ProtocolHandlerMap *protocolHandlers)
: m_ignoreCertificateErrors(false)
- , m_basePath(basePath)
+ , m_dataPath(dataPath)
+ , m_cachePath(cachePath)
{
std::swap(m_protocolHandlers, *protocolHandlers);
@@ -93,7 +94,7 @@ net::URLRequestContext *URLRequestContextGetterQt::GetURLRequestContext()
m_urlRequestContext->set_network_delegate(m_networkDelegate.get());
- base::FilePath cookiesPath = m_basePath.Append(FILE_PATH_LITERAL("Cookies"));
+ base::FilePath cookiesPath = m_dataPath.Append(FILE_PATH_LITERAL("Cookies"));
content::CookieStoreConfig cookieStoreConfig(cookiesPath, content::CookieStoreConfig::PERSISTANT_SESSION_COOKIES, NULL, NULL);
scoped_refptr<net::CookieStore> cookieStore = content::CreateCookieStore(cookieStoreConfig);
@@ -119,7 +120,7 @@ net::URLRequestContext *URLRequestContextGetterQt::GetURLRequestContext()
net::HttpAuthHandlerFactory::CreateDefault(host_resolver.get()));
m_storage->set_http_server_properties(scoped_ptr<net::HttpServerProperties>(new net::HttpServerPropertiesImpl));
- base::FilePath cache_path = m_basePath.Append(FILE_PATH_LITERAL("Cache"));
+ base::FilePath cache_path = m_cachePath.Append(FILE_PATH_LITERAL("Cache"));
net::HttpCache::DefaultBackend* main_backend =
new net::HttpCache::DefaultBackend(
net::DISK_CACHE,
diff --git a/src/core/url_request_context_getter_qt.h b/src/core/url_request_context_getter_qt.h
index 50335291e..6c9ac6d59 100644
--- a/src/core/url_request_context_getter_qt.h
+++ b/src/core/url_request_context_getter_qt.h
@@ -58,7 +58,7 @@ class ProxyConfigService;
class URLRequestContextGetterQt : public net::URLRequestContextGetter {
public:
- explicit URLRequestContextGetterQt(const base::FilePath &, content::ProtocolHandlerMap *protocolHandlers);
+ explicit URLRequestContextGetterQt(const base::FilePath &, const base::FilePath &, content::ProtocolHandlerMap *protocolHandlers);
virtual net::URLRequestContext *GetURLRequestContext() Q_DECL_OVERRIDE;
virtual scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() const Q_DECL_OVERRIDE;
@@ -67,7 +67,8 @@ private:
virtual ~URLRequestContextGetterQt() {}
bool m_ignoreCertificateErrors;
- base::FilePath m_basePath;
+ base::FilePath m_dataPath;
+ base::FilePath m_cachePath;
content::ProtocolHandlerMap m_protocolHandlers;
scoped_ptr<net::ProxyConfigService> m_proxyConfigService;
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index 0f71bbbee..dd9f800db 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -448,7 +448,7 @@ void WebContentsAdapter::setContent(const QByteArray &data, const QString &mimeT
QUrl WebContentsAdapter::activeUrl() const
{
Q_D(const WebContentsAdapter);
- return toQt(d->webContents->GetVisibleURL());
+ return toQt(d->webContents->GetLastCommittedURL());
}
QUrl WebContentsAdapter::requestedUrl() const
@@ -612,6 +612,8 @@ void WebContentsAdapter::serializeNavigationHistory(QDataStream &output)
void WebContentsAdapter::setZoomFactor(qreal factor)
{
Q_D(WebContentsAdapter);
+ if (factor < content::kMinimumZoomFactor || factor > content::kMaximumZoomFactor)
+ return;
content::HostZoomMap::SetZoomLevel(d->webContents.get(), content::ZoomFactorToZoomLevel(static_cast<double>(factor)));
}
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index c2e2da740..d4659f0be 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -147,6 +147,7 @@ WebEngineContext::WebEngineContext()
parsedCommandLine->AppendSwitch(switches::kEnableDelegatedRenderer);
parsedCommandLine->AppendSwitch(switches::kEnableThreadedCompositing);
parsedCommandLine->AppendSwitch(switches::kInProcessGPU);
+ parsedCommandLine->AppendSwitch(switches::kDisableDesktopNotifications);
#if defined(OS_WIN)
parsedCommandLine->AppendSwitch(switches::kDisableD3D11);
diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp
index 03f746f41..9b070d3b2 100644
--- a/src/core/web_engine_settings.cpp
+++ b/src/core/web_engine_settings.cpp
@@ -213,6 +213,7 @@ void WebEngineSettings::initDefaults()
m_attributes.insert(LocalContentCanAccessFileUrls, true);
m_attributes.insert(HyperlinkAuditingEnabled, false);
m_attributes.insert(ScrollAnimatorEnabled, false);
+ m_attributes.insert(ErrorPageEnabled, true);
// Default fonts
QFont defaultFont;
@@ -276,6 +277,7 @@ void WebEngineSettings::applySettingsToWebPreferences(WebPreferences *prefs)
prefs->allow_file_access_from_file_urls = testAttribute(LocalContentCanAccessFileUrls);
prefs->hyperlink_auditing_enabled = testAttribute(HyperlinkAuditingEnabled);
prefs->enable_scroll_animator = testAttribute(ScrollAnimatorEnabled);
+ prefs->enable_error_page = testAttribute(ErrorPageEnabled);
// Fonts settings.
prefs->standard_font_family_map[webkit_glue::kCommonScript] = toString16(fontFamily(StandardFont));
diff --git a/src/core/web_engine_settings.h b/src/core/web_engine_settings.h
index b8d661fcc..c098f8ef4 100644
--- a/src/core/web_engine_settings.h
+++ b/src/core/web_engine_settings.h
@@ -74,6 +74,7 @@ public:
LocalContentCanAccessFileUrls,
HyperlinkAuditingEnabled,
ScrollAnimatorEnabled,
+ ErrorPageEnabled,
};
// Must match the values from the public API in qwebenginesettings.h.