summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2018-06-15 11:19:32 +0200
committerMichal Klocek <michal.klocek@qt.io>2018-07-06 13:53:03 +0000
commita83fd13f62673ce439bdfea55238f9d8ef8676ce (patch)
treec0d776725235ca6c2d51b709d186db89618b7d86
parent153b0d9acf3531d28d790fc98dbaf9ad24a3fae5 (diff)
Finalize change from BrowserContext to Profile
Changes 6c319ce and af313cb splited BrowserContextQt into ProfileQt and ProfileIODataQt. Finalize the change and rename leftover browserContext references to follow the initial change. Change-Id: I845142b1edb67ec4b94439be1e6cfc841dd3f55c Reviewed-by: Kai Koehne <kai.koehne@qt.io>
-rw-r--r--src/core/browser_context_adapter.cpp74
-rw-r--r--src/core/browser_context_adapter.h4
-rw-r--r--src/core/content_browser_client_qt.cpp2
-rw-r--r--src/core/devtools_frontend_qt.cpp2
-rw-r--r--src/core/download_manager_delegate_qt.cpp6
-rw-r--r--src/core/profile_io_data_qt.cpp2
-rw-r--r--src/core/visited_links_manager_qt.cpp8
-rw-r--r--src/core/web_contents_adapter.cpp12
-rw-r--r--src/core/web_contents_adapter.h2
-rw-r--r--src/core/web_contents_delegate_qt.cpp2
-rw-r--r--src/webengine/api/qquickwebengineview.cpp2
11 files changed, 58 insertions, 58 deletions
diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp
index d4f003397..7d74d06c0 100644
--- a/src/core/browser_context_adapter.cpp
+++ b/src/core/browser_context_adapter.cpp
@@ -84,17 +84,17 @@ BrowserContextAdapter::BrowserContextAdapter(const QString &storageName):
{
WebEngineContext::current()->addBrowserContext(this);
// creation of profile requires webengine context
- m_browserContext.reset(new ProfileQt(this));
- content::BrowserContext::Initialize(m_browserContext.data(), toFilePath(dataPath()));
+ m_profile.reset(new ProfileQt(this));
+ content::BrowserContext::Initialize(m_profile.data(), toFilePath(dataPath()));
// fixme: this should not be here
- m_browserContext->m_profileIOData->initializeOnUIThread();
+ m_profile->m_profileIOData->initializeOnUIThread();
}
BrowserContextAdapter::~BrowserContextAdapter()
{
WebEngineContext::current()->removeBrowserContext(this);
if (m_downloadManagerDelegate) {
- m_browserContext->GetDownloadManager(m_browserContext.data())->Shutdown();
+ m_profile->GetDownloadManager(m_profile.data())->Shutdown();
m_downloadManagerDelegate.reset();
}
}
@@ -105,8 +105,8 @@ void BrowserContextAdapter::setStorageName(const QString &storageName)
return;
m_name = storageName;
if (!m_offTheRecord) {
- if (m_browserContext->m_urlRequestContextGetter.get())
- m_browserContext->m_profileIOData->updateStorageSettings();
+ if (m_profile->m_urlRequestContextGetter.get())
+ m_profile->m_profileIOData->updateStorageSettings();
if (m_visitedLinksManager)
resetVisitedLinksManager();
}
@@ -117,15 +117,15 @@ void BrowserContextAdapter::setOffTheRecord(bool offTheRecord)
if (offTheRecord == m_offTheRecord)
return;
m_offTheRecord = offTheRecord;
- if (m_browserContext->m_urlRequestContextGetter.get())
- m_browserContext->m_profileIOData->updateStorageSettings();
+ if (m_profile->m_urlRequestContextGetter.get())
+ m_profile->m_profileIOData->updateStorageSettings();
if (m_visitedLinksManager)
resetVisitedLinksManager();
}
-ProfileQt *BrowserContextAdapter::browserContext()
+ProfileQt *BrowserContextAdapter::profile()
{
- return m_browserContext.data();
+ return m_profile.data();
}
VisitedLinksManagerQt *BrowserContextAdapter::visitedLinksManager()
@@ -159,8 +159,8 @@ void BrowserContextAdapter::setRequestInterceptor(QWebEngineUrlRequestIntercepto
if (m_requestInterceptor == interceptor)
return;
m_requestInterceptor = interceptor;
- if (m_browserContext->m_urlRequestContextGetter.get())
- m_browserContext->m_profileIOData->updateRequestInterceptor();
+ if (m_profile->m_urlRequestContextGetter.get())
+ m_profile->m_profileIOData->updateRequestInterceptor();
}
void BrowserContextAdapter::addClient(BrowserContextAdapterClient *adapterClient)
@@ -215,8 +215,8 @@ void BrowserContextAdapter::setDataPath(const QString &path)
return;
m_dataPath = path;
if (!m_offTheRecord) {
- if (m_browserContext->m_urlRequestContextGetter.get())
- m_browserContext->m_profileIOData->updateStorageSettings();
+ if (m_profile->m_urlRequestContextGetter.get())
+ m_profile->m_profileIOData->updateStorageSettings();
if (m_visitedLinksManager)
resetVisitedLinksManager();
}
@@ -238,8 +238,8 @@ void BrowserContextAdapter::setCachePath(const QString &path)
if (m_cachePath == path)
return;
m_cachePath = path;
- if (!m_offTheRecord && m_browserContext->m_urlRequestContextGetter.get())
- m_browserContext->m_profileIOData->updateHttpCache();
+ if (!m_offTheRecord && m_profile->m_urlRequestContextGetter.get())
+ m_profile->m_profileIOData->updateHttpCache();
}
QString BrowserContextAdapter::cookiesPath() const
@@ -292,11 +292,11 @@ void BrowserContextAdapter::setHttpUserAgent(const QString &userAgent)
std::vector<content::WebContentsImpl *> list = content::WebContentsImpl::GetAllWebContents();
for (content::WebContentsImpl *web_contents : list)
- if (web_contents->GetBrowserContext() == m_browserContext.data())
+ if (web_contents->GetBrowserContext() == m_profile.data())
web_contents->SetUserAgentOverride(m_httpUserAgent.toStdString(), true);
- if (m_browserContext->m_urlRequestContextGetter.get())
- m_browserContext->m_profileIOData->updateUserAgent();
+ if (m_profile->m_urlRequestContextGetter.get())
+ m_profile->m_profileIOData->updateUserAgent();
}
BrowserContextAdapter::HttpCacheType BrowserContextAdapter::httpCacheType() const
@@ -314,8 +314,8 @@ void BrowserContextAdapter::setHttpCacheType(BrowserContextAdapter::HttpCacheTyp
m_httpCacheType = newhttpCacheType;
if (oldCacheType == httpCacheType())
return;
- if (!m_offTheRecord && m_browserContext->m_urlRequestContextGetter.get())
- m_browserContext->m_profileIOData->updateHttpCache();
+ if (!m_offTheRecord && m_profile->m_urlRequestContextGetter.get())
+ m_profile->m_profileIOData->updateHttpCache();
}
BrowserContextAdapter::PersistentCookiesPolicy BrowserContextAdapter::persistentCookiesPolicy() const
@@ -331,8 +331,8 @@ void BrowserContextAdapter::setPersistentCookiesPolicy(BrowserContextAdapter::Pe
m_persistentCookiesPolicy = newPersistentCookiesPolicy;
if (oldPolicy == persistentCookiesPolicy())
return;
- if (!m_offTheRecord && m_browserContext->m_urlRequestContextGetter.get())
- m_browserContext->m_profileIOData->updateCookieStore();
+ if (!m_offTheRecord && m_profile->m_urlRequestContextGetter.get())
+ m_profile->m_profileIOData->updateCookieStore();
}
BrowserContextAdapter::VisitedLinksPolicy BrowserContextAdapter::visitedLinksPolicy() const
@@ -386,8 +386,8 @@ void BrowserContextAdapter::setHttpCacheMaxSize(int maxSize)
if (m_httpCacheMaxSize == maxSize)
return;
m_httpCacheMaxSize = maxSize;
- if (!m_offTheRecord && m_browserContext->m_urlRequestContextGetter.get())
- m_browserContext->m_profileIOData->updateHttpCache();
+ if (!m_offTheRecord && m_profile->m_urlRequestContextGetter.get())
+ m_profile->m_profileIOData->updateHttpCache();
}
const QHash<QByteArray, QWebEngineUrlSchemeHandler *> &BrowserContextAdapter::customUrlSchemeHandlers() const
@@ -402,8 +402,8 @@ const QList<QByteArray> BrowserContextAdapter::customUrlSchemes() const
void BrowserContextAdapter::updateCustomUrlSchemeHandlers()
{
- if (m_browserContext->m_urlRequestContextGetter.get())
- m_browserContext->m_profileIOData->updateJobFactory();
+ if (m_profile->m_urlRequestContextGetter.get())
+ m_profile->m_profileIOData->updateJobFactory();
}
bool BrowserContextAdapter::removeCustomUrlSchemeHandler(QWebEngineUrlSchemeHandler *handler)
@@ -452,12 +452,12 @@ UserResourceControllerHost *BrowserContextAdapter::userResourceController()
void BrowserContextAdapter::permissionRequestReply(const QUrl &origin, PermissionType type, bool reply)
{
- static_cast<PermissionManagerQt*>(browserContext()->GetPermissionManager())->permissionRequestReply(origin, type, reply);
+ static_cast<PermissionManagerQt*>(profile()->GetPermissionManager())->permissionRequestReply(origin, type, reply);
}
bool BrowserContextAdapter::checkPermission(const QUrl &origin, PermissionType type)
{
- return static_cast<PermissionManagerQt*>(browserContext()->GetPermissionManager())->checkPermission(origin, type);
+ return static_cast<PermissionManagerQt*>(profile()->GetPermissionManager())->checkPermission(origin, type);
}
QString BrowserContextAdapter::httpAcceptLanguageWithoutQualities() const
@@ -485,20 +485,20 @@ void BrowserContextAdapter::setHttpAcceptLanguage(const QString &httpAcceptLangu
std::vector<content::WebContentsImpl *> list = content::WebContentsImpl::GetAllWebContents();
for (content::WebContentsImpl *web_contents : list) {
- if (web_contents->GetBrowserContext() == m_browserContext.data()) {
+ if (web_contents->GetBrowserContext() == m_profile.data()) {
content::RendererPreferences* rendererPrefs = web_contents->GetMutableRendererPrefs();
rendererPrefs->accept_languages = httpAcceptLanguageWithoutQualities().toStdString();
web_contents->GetRenderViewHost()->SyncRendererPrefs();
}
}
- if (m_browserContext->m_urlRequestContextGetter.get())
- m_browserContext->m_profileIOData->updateUserAgent();
+ if (m_profile->m_urlRequestContextGetter.get())
+ m_profile->m_profileIOData->updateUserAgent();
}
void BrowserContextAdapter::clearHttpCache()
{
- content::BrowsingDataRemover *remover = content::BrowserContext::GetBrowsingDataRemover(m_browserContext.data());
+ content::BrowsingDataRemover *remover = content::BrowserContext::GetBrowsingDataRemover(m_profile.data());
remover->Remove(base::Time(), base::Time::Max(),
content::BrowsingDataRemover::DATA_TYPE_CACHE,
content::BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB | content::BrowsingDataRemover::ORIGIN_TYPE_PROTECTED_WEB);
@@ -507,14 +507,14 @@ void BrowserContextAdapter::clearHttpCache()
void BrowserContextAdapter::setSpellCheckLanguages(const QStringList &languages)
{
#if QT_CONFIG(webengine_spellchecker)
- m_browserContext->setSpellCheckLanguages(languages);
+ m_profile->setSpellCheckLanguages(languages);
#endif
}
QStringList BrowserContextAdapter::spellCheckLanguages() const
{
#if QT_CONFIG(webengine_spellchecker)
- return m_browserContext->spellCheckLanguages();
+ return m_profile->spellCheckLanguages();
#else
return QStringList();
#endif
@@ -523,14 +523,14 @@ QStringList BrowserContextAdapter::spellCheckLanguages() const
void BrowserContextAdapter::setSpellCheckEnabled(bool enabled)
{
#if QT_CONFIG(webengine_spellchecker)
- m_browserContext->setSpellCheckEnabled(enabled);
+ m_profile->setSpellCheckEnabled(enabled);
#endif
}
bool BrowserContextAdapter::isSpellCheckEnabled() const
{
#if QT_CONFIG(webengine_spellchecker)
- return m_browserContext->isSpellCheckEnabled();
+ return m_profile->isSpellCheckEnabled();
#else
return false;
#endif
diff --git a/src/core/browser_context_adapter.h b/src/core/browser_context_adapter.h
index 19fed8951..da9f37645 100644
--- a/src/core/browser_context_adapter.h
+++ b/src/core/browser_context_adapter.h
@@ -99,7 +99,7 @@ public:
void pauseDownload(quint32 downloadId);
void resumeDownload(quint32 downloadId);
- ProfileQt *browserContext();
+ ProfileQt *profile();
QString storageName() const { return m_name; }
void setStorageName(const QString &storageName);
@@ -191,7 +191,7 @@ private:
QString m_name;
bool m_offTheRecord;
- QScopedPointer<ProfileQt> m_browserContext;
+ QScopedPointer<ProfileQt> m_profile;
QScopedPointer<VisitedLinksManagerQt> m_visitedLinksManager;
QScopedPointer<DownloadManagerDelegateQt> m_downloadManagerDelegate;
QScopedPointer<UserResourceControllerHost> m_userResourceController;
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index 7ae6bb5a5..3566cae51 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -726,7 +726,7 @@ scoped_refptr<net::URLRequestContextGetter> GetSystemRequestContextOnUIThread()
{
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
return scoped_refptr<net::URLRequestContextGetter>(
- BrowserContextAdapter::defaultContext()->browserContext()->GetRequestContext());
+ BrowserContextAdapter::defaultContext()->profile()->GetRequestContext());
}
void ContentBrowserClientQt::GetGeolocationRequestContext(
diff --git a/src/core/devtools_frontend_qt.cpp b/src/core/devtools_frontend_qt.cpp
index ecfa4b6b9..02473079f 100644
--- a/src/core/devtools_frontend_qt.cpp
+++ b/src/core/devtools_frontend_qt.cpp
@@ -174,7 +174,7 @@ DevToolsFrontendQt *DevToolsFrontendQt::Show(QSharedPointer<WebContentsAdapter>
if (!frontendAdapter->isInitialized()) {
scoped_refptr<content::SiteInstance> site =
- content::SiteInstance::CreateForURL(frontendAdapter->browserContext(), GURL(GetFrontendURL()));
+ content::SiteInstance::CreateForURL(frontendAdapter->profile(), GURL(GetFrontendURL()));
frontendAdapter->initialize(site.get());
}
diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp
index 138439281..0a40d4284 100644
--- a/src/core/download_manager_delegate_qt.cpp
+++ b/src/core/download_manager_delegate_qt.cpp
@@ -86,7 +86,7 @@ void DownloadManagerDelegateQt::cancelDownload(const content::DownloadTargetCall
void DownloadManagerDelegateQt::cancelDownload(quint32 downloadId)
{
- content::DownloadManager* dlm = content::BrowserContext::GetDownloadManager(m_contextAdapter->browserContext());
+ content::DownloadManager* dlm = content::BrowserContext::GetDownloadManager(m_contextAdapter->profile());
download::DownloadItem *download = dlm->GetDownload(downloadId);
if (download)
download->Cancel(/* user_cancel */ true);
@@ -94,7 +94,7 @@ void DownloadManagerDelegateQt::cancelDownload(quint32 downloadId)
void DownloadManagerDelegateQt::pauseDownload(quint32 downloadId)
{
- content::DownloadManager* dlm = content::BrowserContext::GetDownloadManager(m_contextAdapter->browserContext());
+ content::DownloadManager* dlm = content::BrowserContext::GetDownloadManager(m_contextAdapter->profile());
download::DownloadItem *download = dlm->GetDownload(downloadId);
if (download)
download->Pause();
@@ -102,7 +102,7 @@ void DownloadManagerDelegateQt::pauseDownload(quint32 downloadId)
void DownloadManagerDelegateQt::resumeDownload(quint32 downloadId)
{
- content::DownloadManager* dlm = content::BrowserContext::GetDownloadManager(m_contextAdapter->browserContext());
+ content::DownloadManager* dlm = content::BrowserContext::GetDownloadManager(m_contextAdapter->profile());
download::DownloadItem *download = dlm->GetDownload(downloadId);
if (download)
download->Resume();
diff --git a/src/core/profile_io_data_qt.cpp b/src/core/profile_io_data_qt.cpp
index bcf25f4e8..3ed4f2650 100644
--- a/src/core/profile_io_data_qt.cpp
+++ b/src/core/profile_io_data_qt.cpp
@@ -624,7 +624,7 @@ void ProfileIODataQt::updateHttpCache()
if (m_httpCacheType == BrowserContextAdapter::NoCache) {
content::BrowsingDataRemover *remover =
- content::BrowserContext::GetBrowsingDataRemover(m_browserContextAdapter->browserContext());
+ content::BrowserContext::GetBrowsingDataRemover(m_browserContextAdapter->profile());
remover->Remove(base::Time(), base::Time::Max(),
content::BrowsingDataRemover::DATA_TYPE_CACHE,
content::BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB |
diff --git a/src/core/visited_links_manager_qt.cpp b/src/core/visited_links_manager_qt.cpp
index d5e2d6f40..abde6c2c3 100644
--- a/src/core/visited_links_manager_qt.cpp
+++ b/src/core/visited_links_manager_qt.cpp
@@ -109,11 +109,11 @@ static void ensureDirectoryExists(const base::FilePath &path)
VisitedLinksManagerQt::VisitedLinksManagerQt(BrowserContextAdapter *adapter)
: m_delegate(new VisitedLinkDelegateQt)
{
- Q_ASSERT(adapter && adapter->browserContext());
- ProfileQt *browserContext = adapter->browserContext();
+ Q_ASSERT(adapter && adapter->profile());
+ ProfileQt *profile = adapter->profile();
if (adapter->persistVisitedLinks())
- ensureDirectoryExists(browserContext->GetPath());
- m_visitedLinkMaster.reset(new visitedlink::VisitedLinkMaster(browserContext, m_delegate.data(), adapter->persistVisitedLinks()));
+ ensureDirectoryExists(profile->GetPath());
+ m_visitedLinkMaster.reset(new visitedlink::VisitedLinkMaster(profile, m_delegate.data(), adapter->persistVisitedLinks()));
m_visitedLinkMaster->Init();
}
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index ab96ae10e..e239e853a 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -358,13 +358,13 @@ QSharedPointer<WebContentsAdapter> WebContentsAdapter::createFromSerializedNavig
{
int currentIndex;
std::vector<std::unique_ptr<content::NavigationEntry>> entries;
- deserializeNavigationHistory(input, &currentIndex, &entries, adapterClient->browserContextAdapter()->browserContext());
+ deserializeNavigationHistory(input, &currentIndex, &entries, adapterClient->browserContextAdapter()->profile());
if (currentIndex == -1)
return QSharedPointer<WebContentsAdapter>();
// Unlike WebCore, Chromium only supports Restoring to a new WebContents instance.
- content::WebContents* newWebContents = createBlankWebContents(adapterClient, adapterClient->browserContextAdapter()->browserContext());
+ content::WebContents* newWebContents = createBlankWebContents(adapterClient, adapterClient->browserContextAdapter()->profile());
content::NavigationController &controller = newWebContents->GetController();
controller.Restore(currentIndex, content::RestoreType::LAST_SESSION_EXITED_CLEANLY, &entries);
@@ -427,7 +427,7 @@ void WebContentsAdapter::initialize(content::SiteInstance *site)
// Create our own if a WebContents wasn't provided at construction.
if (!m_webContents) {
- content::WebContents::CreateParams create_params(m_browserContextAdapter->browserContext(), site);
+ content::WebContents::CreateParams create_params(m_browserContextAdapter->profile(), site);
create_params.initial_size = gfx::Size(kTestWindowWidth, kTestWindowHeight);
create_params.context = reinterpret_cast<gfx::NativeView>(m_adapterClient);
m_webContents.reset(content::WebContents::Create(create_params));
@@ -555,7 +555,7 @@ void WebContentsAdapter::load(const QWebEngineHttpRequest &request)
GURL gurl = toGurl(request.url());
if (!isInitialized()) {
scoped_refptr<content::SiteInstance> site =
- content::SiteInstance::CreateForURL(m_browserContextAdapter->browserContext(), gurl);
+ content::SiteInstance::CreateForURL(m_browserContextAdapter->profile(), gurl);
initialize(site.get());
}
@@ -885,9 +885,9 @@ qreal WebContentsAdapter::currentZoomFactor() const
return content::ZoomLevelToZoomFactor(content::HostZoomMap::GetZoomLevel(m_webContents.get()));
}
-ProfileQt* WebContentsAdapter::browserContext()
+ProfileQt* WebContentsAdapter::profile()
{
- return m_browserContextAdapter ? m_browserContextAdapter->browserContext() : m_webContents ?
+ return m_browserContextAdapter ? m_browserContextAdapter->profile() : m_webContents ?
static_cast<ProfileQt*>(m_webContents->GetBrowserContext()) : nullptr;
}
diff --git a/src/core/web_contents_adapter.h b/src/core/web_contents_adapter.h
index f0a716250..a5ed1f471 100644
--- a/src/core/web_contents_adapter.h
+++ b/src/core/web_contents_adapter.h
@@ -188,7 +188,7 @@ public:
void dpiScaleChanged();
void backgroundColorChanged();
QAccessibleInterface *browserAccessible();
- ProfileQt* browserContext();
+ ProfileQt* profile();
BrowserContextAdapter* browserContextAdapter();
QWebChannel *webChannel() const;
void setWebChannel(QWebChannel *, uint worldId);
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index fb7071b7a..8afb7ea70 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -122,7 +122,7 @@ content::WebContents *WebContentsDelegateQt::OpenURLFromTab(content::WebContents
if (params.disposition != WindowOpenDisposition::CURRENT_TAB) {
QSharedPointer<WebContentsAdapter> targetAdapter = createWindow(0, params.disposition, gfx::Rect(), params.user_gesture);
if (targetAdapter) {
- if (targetAdapter->browserContext() != source->GetBrowserContext()) {
+ if (targetAdapter->profile() != source->GetBrowserContext()) {
target_site_instance = nullptr;
referrer = content::Referrer();
}
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index 8d5d843bf..7e5897157 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -913,7 +913,7 @@ void QQuickWebEngineViewPrivate::setProfile(QQuickWebEngineProfile *profile)
Q_EMIT q->profileChanged();
m_settings->setParentSettings(profile->settings());
- if (adapter->browserContext() != browserContextAdapter()->browserContext()) {
+ if (adapter->profile() != browserContextAdapter()->profile()) {
// When the profile changes we need to create a new WebContentAdapter and reload the active URL.
bool wasInitialized = adapter->isInitialized();
QUrl activeUrl = adapter->activeUrl();