From 85d26a2919a016ae76c6d83af28281cffd8a3aa1 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Mon, 10 Nov 2014 16:49:05 -0800 Subject: Add a stub AccessTokenStore implementation. Callers inside Chromium expect an implementation of AccessTokenStore to exist. This fixes crashes with the geolocation-based APIs, exposed on e.g. google.com when faking an Android UA (as well as other places, probably). Change-Id: I45e6b483e096d5165fefd86927cdf34e799cc4d9 Reviewed-by: Pierre Rossi --- src/core/access_token_store_qt.cpp | 56 +++++++++++++++++++++++++++++++++ src/core/access_token_store_qt.h | 57 ++++++++++++++++++++++++++++++++++ src/core/content_browser_client_qt.cpp | 6 ++++ src/core/content_browser_client_qt.h | 1 + src/core/core_gyp_generator.pro | 2 ++ 5 files changed, 122 insertions(+) create mode 100644 src/core/access_token_store_qt.cpp create mode 100644 src/core/access_token_store_qt.h diff --git a/src/core/access_token_store_qt.cpp b/src/core/access_token_store_qt.cpp new file mode 100644 index 000000000..85a91c3f7 --- /dev/null +++ b/src/core/access_token_store_qt.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 "access_token_store_qt.h" + +#include + +AccessTokenStoreQt::AccessTokenStoreQt() +{ +} + +AccessTokenStoreQt::~AccessTokenStoreQt() +{ +} + +void AccessTokenStoreQt::LoadAccessTokens(const LoadAccessTokensCallbackType& callback) +{ +} + +void AccessTokenStoreQt::SaveAccessToken(const GURL& server_url, const base::string16& access_token) +{ +} + diff --git a/src/core/access_token_store_qt.h b/src/core/access_token_store_qt.h new file mode 100644 index 000000000..2a76681f0 --- /dev/null +++ b/src/core/access_token_store_qt.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 ACCESS_TOKEN_STORE_QT_H +#define ACCESS_TOKEN_STORE_QT_H + +#include "content/public/browser/access_token_store.h" + +#include // Needed for Q_DECL_OVERRIDE + +class AccessTokenStoreQt : public content::AccessTokenStore +{ +public: + AccessTokenStoreQt(); + ~AccessTokenStoreQt(); + + virtual void LoadAccessTokens(const LoadAccessTokensCallbackType& callback) Q_DECL_OVERRIDE; + virtual void SaveAccessToken(const GURL& server_url, const base::string16& access_token) Q_DECL_OVERRIDE; + +private: + DISALLOW_COPY_AND_ASSIGN(AccessTokenStoreQt); +}; + +#endif // ACCESS_TOKEN_STORE_QT_H diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 3ead5314f..ee403298b 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -62,6 +62,7 @@ #include "media_capture_devices_dispatcher.h" #include "resource_dispatcher_host_delegate_qt.h" #include "web_contents_delegate_qt.h" +#include "access_token_store_qt.h" #include #include @@ -347,6 +348,11 @@ void ContentBrowserClientQt::OverrideWebkitPrefs(content::RenderViewHost *rvh, c static_cast(webContents->GetDelegate())->overrideWebPreferences(webContents, web_prefs); } +content::AccessTokenStore *ContentBrowserClientQt::CreateAccessTokenStore() +{ + return new AccessTokenStoreQt; +} + BrowserContextQt* ContentBrowserClientQt::browser_context() { Q_ASSERT(m_browserMainParts); return static_cast(m_browserMainParts)->browser_context(); diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h index dd5d9f3a1..4f216030c 100644 --- a/src/core/content_browser_client_qt.h +++ b/src/core/content_browser_client_qt.h @@ -79,6 +79,7 @@ public: virtual gfx::GLShareGroup* GetInProcessGpuShareGroup() Q_DECL_OVERRIDE; 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 void AllowCertificateError( int render_process_id, int render_frame_id, diff --git a/src/core/core_gyp_generator.pro b/src/core/core_gyp_generator.pro index c50d56df4..38aba3a76 100644 --- a/src/core/core_gyp_generator.pro +++ b/src/core/core_gyp_generator.pro @@ -33,6 +33,7 @@ RESOURCES += devtools.qrc INCLUDEPATH += $$[QT_INSTALL_HEADERS] $$PWD SOURCES = \ + access_token_store_qt.cpp \ browser_accessibility_manager_qt.cpp \ browser_accessibility_qt.cpp \ browser_context_qt.cpp \ @@ -80,6 +81,7 @@ SOURCES = \ yuv_video_node.cpp HEADERS = \ + access_token_store_qt.h \ browser_accessibility_manager_qt.h \ browser_accessibility_qt.h \ browser_context_qt.h \ -- cgit v1.2.3