mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add PDF extension support (issue #1565)
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/extensions/extension_system.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "components/keyed_service/content/browser_context_dependency_manager.h"
|
||||
@@ -15,16 +17,7 @@ base::AtomicRefCount CefBrowserContext::DebugObjCt = 0;
|
||||
#endif
|
||||
|
||||
CefBrowserContext::CefBrowserContext()
|
||||
: resource_context_(new CefResourceContext) {
|
||||
BrowserContextDependencyManager::GetInstance()->CreateBrowserContextServices(
|
||||
this);
|
||||
|
||||
// Spell checking support and possibly other subsystems retrieve the
|
||||
// PrefService associated with a BrowserContext via UserPrefs::Get().
|
||||
PrefService* pref_service = CefContentBrowserClient::Get()->pref_service();
|
||||
DCHECK(pref_service);
|
||||
user_prefs::UserPrefs::Set(this, pref_service);
|
||||
|
||||
: extension_system_(NULL) {
|
||||
#ifndef NDEBUG
|
||||
base::AtomicRefCountInc(&DebugObjCt);
|
||||
#endif
|
||||
@@ -47,6 +40,33 @@ CefBrowserContext::~CefBrowserContext() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void CefBrowserContext::Initialize() {
|
||||
const bool extensions_enabled = extensions::ExtensionsEnabled();
|
||||
if (extensions_enabled) {
|
||||
// Create the custom ExtensionSystem first because other KeyedServices
|
||||
// depend on it.
|
||||
extension_system_ = static_cast<extensions::CefExtensionSystem*>(
|
||||
extensions::ExtensionSystem::Get(this));
|
||||
extension_system_->InitForRegularProfile(true);
|
||||
}
|
||||
|
||||
resource_context_.reset(new CefResourceContext(
|
||||
IsOffTheRecord(),
|
||||
extensions_enabled ? extension_system_->info_map() : NULL));
|
||||
|
||||
BrowserContextDependencyManager::GetInstance()->CreateBrowserContextServices(
|
||||
this);
|
||||
|
||||
// Spell checking support and possibly other subsystems retrieve the
|
||||
// PrefService associated with a BrowserContext via UserPrefs::Get().
|
||||
PrefService* pref_service = CefContentBrowserClient::Get()->pref_service();
|
||||
DCHECK(pref_service);
|
||||
user_prefs::UserPrefs::Set(this, pref_service);
|
||||
|
||||
if (extensions_enabled)
|
||||
extension_system_->Init();
|
||||
}
|
||||
|
||||
content::ResourceContext* CefBrowserContext::GetResourceContext() {
|
||||
return resource_context_.get();
|
||||
}
|
||||
|
Reference in New Issue
Block a user