diff --git chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc index dfe0f29dc772..606f07a1d1ed 100644 --- chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc +++ chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc @@ -18,6 +18,7 @@ #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/common/channel_info.h" +#include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "components/browser_sync/profile_sync_service.h" #include "components/prefs/pref_service.h" @@ -224,6 +225,10 @@ void ChromeInternalLogSource::Fetch(SysLogsSourceCallback callback) { } void ChromeInternalLogSource::PopulateSyncLogs(SystemLogsResponse* response) { + // CEF should avoid loading ProfileSyncServiceFactory which depends on a lot + // of unnecessary Chrome-specific factories. + return; + // We are only interested in sync logs for the primary user profile. Profile* profile = ProfileManager::GetPrimaryUserProfile(); if (!profile || @@ -268,6 +273,12 @@ void ChromeInternalLogSource::PopulateExtensionInfoLogs( if (!profile) return; + // CEF should avoid accessing ExtensionRegistry when extensions are disabled. + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kDisableExtensions)) { + return; + } + extensions::ExtensionRegistry* extension_registry = extensions::ExtensionRegistry::Get(profile); std::string extensions_list; diff --git chrome/browser/memory_details.cc chrome/browser/memory_details.cc index 3280b5e9fd6b..13ef1b99191e 100644 --- chrome/browser/memory_details.cc +++ chrome/browser/memory_details.cc @@ -17,6 +17,7 @@ #include "base/task/post_task.h" #include "build/build_config.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_switches.h" #include "components/nacl/common/nacl_process_type.h" #include "components/strings/grit/components_strings.h" #include "content/public/browser/browser_child_process_host_iterator.h" @@ -252,8 +253,11 @@ void MemoryDetails::CollectChildInfoOnUIThread() { #if BUILDFLAG(ENABLE_EXTENSIONS) // Determine if this is an extension process. + // CEF should avoid accessing ExtensionRegistry when extensions are disabled. bool process_is_for_extensions = false; - if (render_process_host) { + if (render_process_host && + !base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kDisableExtensions)) { content::BrowserContext* context = render_process_host->GetBrowserContext(); extensions::ExtensionRegistry* extension_registry = diff --git content/browser/resource_context_impl.cc content/browser/resource_context_impl.cc index 261e9343b8a2..0fe566c705a4 100644 --- content/browser/resource_context_impl.cc +++ content/browser/resource_context_impl.cc @@ -56,6 +56,10 @@ URLDataManagerBackend* GetURLDataManagerForResourceContext( context->GetUserData(kURLDataManagerBackendKeyName)); } +const void* GetURLDataManagerBackendUserDataKey() { + return kURLDataManagerBackendKeyName; +} + void InitializeResourceContext(BrowserContext* browser_context) { ResourceContext* resource_context = browser_context->GetResourceContext(); diff --git content/browser/resource_context_impl.h content/browser/resource_context_impl.h index 903cc543a242..5bd30ae82974 100644 --- content/browser/resource_context_impl.h +++ content/browser/resource_context_impl.h @@ -28,6 +28,8 @@ CONTENT_EXPORT StreamContext* GetStreamContextForResourceContext( URLDataManagerBackend* GetURLDataManagerForResourceContext( ResourceContext* context); +CONTENT_EXPORT const void* GetURLDataManagerBackendUserDataKey(); + // Initialize the above data on the ResourceContext from a given BrowserContext. CONTENT_EXPORT void InitializeResourceContext(BrowserContext* browser_context); diff --git content/browser/webui/url_data_manager.cc content/browser/webui/url_data_manager.cc index a9f5cfc95d4a..d5281ccab3b4 100644 --- content/browser/webui/url_data_manager.cc +++ content/browser/webui/url_data_manager.cc @@ -156,6 +156,11 @@ void URLDataManager::UpdateWebUIDataSource( ->UpdateWebUIDataSource(source_name, std::move(update)); } +// static +const void* URLDataManager::GetUserDataKey() { + return kURLDataManagerKeyName; +} + // static bool URLDataManager::IsScheduledForDeletion( const URLDataSourceImpl* data_source) { diff --git content/browser/webui/url_data_manager.h content/browser/webui/url_data_manager.h index 95cff69e1b42..7fd849867829 100644 --- content/browser/webui/url_data_manager.h +++ content/browser/webui/url_data_manager.h @@ -69,6 +69,8 @@ class CONTENT_EXPORT URLDataManager : public base::SupportsUserData::Data { const std::string& source_name, std::unique_ptr update); + static const void* GetUserDataKey(); + private: friend class URLDataSourceImpl; friend struct DeleteURLDataSource;