summaryrefslogtreecommitdiffstats
path: root/src/core/profile_qt.cpp
diff options
context:
space:
mode:
authorMichael BrĂ¼ning <michael.bruning@qt.io>2019-02-05 14:50:22 +0100
committerMichael BrĂ¼ning <michael.bruning@qt.io>2019-02-05 16:56:24 +0100
commit7aa06a1614b7ca6508d96ee2e8ef0f4c49038a6f (patch)
tree4331533a6c0fa7a843c831d66e62472a7f8a4d30 /src/core/profile_qt.cpp
parent5e92adf5f85c4ec8340d5b7e92166a5e4f8e9883 (diff)
parentf17f815878d1d3f02f464347d2807555cab00a88 (diff)
Merge remote-tracking branch 'origin/dev' into 5.13
Conflicts: src/core/content_browser_client_qt.cpp src/core/content_browser_client_qt.h Change-Id: I3da791a82dab56fd7535ba1e4c0ab1d9ca74f547
Diffstat (limited to 'src/core/profile_qt.cpp')
-rw-r--r--src/core/profile_qt.cpp55
1 files changed, 53 insertions, 2 deletions
diff --git a/src/core/profile_qt.cpp b/src/core/profile_qt.cpp
index d98bb5c9c..0ede1df55 100644
--- a/src/core/profile_qt.cpp
+++ b/src/core/profile_qt.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtWebEngine module of the Qt Toolkit.
@@ -71,11 +71,24 @@
#include "components/spellcheck/browser/pref_names.h"
#endif
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+#include "components/guest_view/browser/guest_view_manager.h"
+#include "extensions/browser/extension_protocols.h"
+#include "extensions/browser/pref_names.h"
+#include "extensions/browser/process_manager.h"
+#include "extensions/common/constants.h"
+
+#include "extensions/extension_system_qt.h"
+#endif
+
namespace QtWebEngineCore {
ProfileQt::ProfileQt(ProfileAdapter *profileAdapter)
: m_profileIOData(new ProfileIODataQt(this)),
m_profileAdapter(profileAdapter)
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+ , m_extensionSystem(nullptr)
+#endif // BUILDFLAG(ENABLE_EXTENSIONS)
{
PrefServiceFactory factory;
factory.set_user_prefs(new InMemoryPrefStore);
@@ -94,6 +107,23 @@ ProfileQt::ProfileQt(ProfileAdapter *profileAdapter)
#endif // QT_CONFIG(webengine_spellchecker)
registry->RegisterBooleanPref(prefs::kShowInternalAccessibilityTree, false);
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+ registry->RegisterDictionaryPref(extensions::pref_names::kExtensions);
+ registry->RegisterListPref(extensions::pref_names::kInstallAllowList);
+ registry->RegisterListPref(extensions::pref_names::kInstallDenyList);
+ registry->RegisterDictionaryPref(extensions::pref_names::kInstallForceList);
+ registry->RegisterDictionaryPref(extensions::pref_names::kInstallLoginScreenAppList);
+ registry->RegisterListPref(extensions::pref_names::kAllowedTypes);
+ registry->RegisterBooleanPref(extensions::pref_names::kStorageGarbageCollect, false);
+ registry->RegisterInt64Pref(extensions::pref_names::kLastUpdateCheck, 0);
+ registry->RegisterInt64Pref(extensions::pref_names::kNextUpdateCheck, 0);
+ registry->RegisterListPref(extensions::pref_names::kAllowedInstallSites);
+ registry->RegisterStringPref(extensions::pref_names::kLastChromeVersion, std::string());
+ registry->RegisterListPref(extensions::pref_names::kNativeMessagingBlacklist);
+ registry->RegisterListPref(extensions::pref_names::kNativeMessagingWhitelist);
+ registry->RegisterBooleanPref(extensions::pref_names::kNativeMessagingUserLevelHosts, true);
+#endif // BUILDFLAG(ENABLE_EXTENSIONS)
+
m_prefService = factory.Create(registry);
user_prefs::UserPrefs::Set(this, m_prefService.get());
@@ -102,6 +132,11 @@ ProfileQt::ProfileQt(ProfileAdapter *profileAdapter)
// ProfileQt object is allocated at the same address as a previously
// destroyed one. Needs to be called after WebEngineContext initialization.
BrowserContextDependencyManager::GetInstance()->MarkBrowserContextLive(this);
+
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+ m_extensionSystem = static_cast<extensions::ExtensionSystemQt*>(extensions::ExtensionSystem::Get(this));
+ m_extensionSystem->InitForRegularProfile(true);
+#endif
}
ProfileQt::~ProfileQt()
@@ -168,7 +203,9 @@ content::DownloadManagerDelegate *ProfileQt::GetDownloadManagerDelegate()
content::BrowserPluginGuestManager *ProfileQt::GetGuestManager()
{
- return nullptr;
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+ return guest_view::GuestViewManager::FromBrowserContext(this);
+#endif
}
storage::SpecialStoragePolicy *ProfileQt::GetSpecialStoragePolicy()
@@ -222,6 +259,12 @@ net::URLRequestContextGetter *ProfileQt::CreateRequestContext(
{
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(!m_urlRequestContextGetter.get());
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+ extensions::InfoMap* extension_info_map = GetExtensionSystem()->info_map();
+ (*protocol_handlers)[extensions::kExtensionScheme] =
+ extensions::CreateExtensionProtocolHandler(IsOffTheRecord(),extension_info_map);
+#endif
+
m_profileIOData->setRequestContextData(protocol_handlers, std::move(request_interceptors));
m_profileIOData->updateStorageSettings();
m_urlRequestContextGetter = new URLRequestContextGetterQt(m_profileIOData.get());
@@ -278,4 +321,12 @@ bool ProfileQt::isSpellCheckEnabled() const
return m_prefService->GetBoolean(spellcheck::prefs::kSpellCheckEnable);
}
#endif // QT_CONFIG(webengine_spellchecker)
+
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+extensions::ExtensionSystemQt* ProfileQt::GetExtensionSystem()
+{
+ return m_extensionSystem;
+}
+#endif // BUILDFLAG(ENABLE_EXTENSIONS)
+
} // namespace QtWebEngineCore