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 6b81e1e0f6c5..7509c2b18b47 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 @@ -164,6 +164,10 @@ void ChromeInternalLogSource::Fetch(const 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 || diff --git chrome/browser/ui/webui/net_internals/net_internals_ui.cc chrome/browser/ui/webui/net_internals/net_internals_ui.cc index 442ee5b2a91f..23c3feb4dea3 100644 --- chrome/browser/ui/webui/net_internals/net_internals_ui.cc +++ chrome/browser/ui/webui/net_internals/net_internals_ui.cc @@ -515,41 +515,31 @@ void NetInternalsMessageHandler::OnClearBrowserCache( void NetInternalsMessageHandler::OnGetPrerenderInfo( const base::ListValue* list) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - SendJavascriptCommand( - "receivedPrerenderInfo", - chrome_browser_net::GetPrerenderInfo(Profile::FromWebUI(web_ui()))); + SendJavascriptCommand("receivedPrerenderInfo", nullptr); } void NetInternalsMessageHandler::OnGetHistoricNetworkStats( const base::ListValue* list) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - SendJavascriptCommand("receivedHistoricNetworkStats", - chrome_browser_net::GetHistoricNetworkStats( - Profile::FromWebUI(web_ui()))); + SendJavascriptCommand("receivedHistoricNetworkStats", nullptr); } void NetInternalsMessageHandler::OnGetSessionNetworkStats( const base::ListValue* list) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - SendJavascriptCommand( - "receivedSessionNetworkStats", - chrome_browser_net::GetSessionNetworkStats(Profile::FromWebUI(web_ui()))); + SendJavascriptCommand("receivedSessionNetworkStats", nullptr); } void NetInternalsMessageHandler::OnGetExtensionInfo( const base::ListValue* list) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - SendJavascriptCommand( - "receivedExtensionInfo", - chrome_browser_net::GetExtensionInfo(Profile::FromWebUI(web_ui()))); + SendJavascriptCommand("receivedExtensionInfo", nullptr); } void NetInternalsMessageHandler::OnGetDataReductionProxyInfo( const base::ListValue* list) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - SendJavascriptCommand("receivedDataReductionProxyInfo", - chrome_browser_net::GetDataReductionProxyInfo( - Profile::FromWebUI(web_ui()))); + SendJavascriptCommand("receivedDataReductionProxyInfo", nullptr); } //////////////////////////////////////////////////////////////////////////////// @@ -629,9 +619,17 @@ void NetInternalsMessageHandler::IOThreadImpl::OnRendererReady( PrePopulateEventList(); - // Register with network stack to observe events. - io_thread_->net_log()->AddObserver( - this, net::NetLogCaptureMode::IncludeCookiesAndCredentials()); + net::NetLog* net_log = nullptr; + if (io_thread_) + net_log = io_thread_->net_log(); + else + net_log = g_browser_process->net_log(); + + if (net_log) { + // Register with network stack to observe events. + net_log->AddObserver( + this, net::NetLogCaptureMode::IncludeCookiesAndCredentials()); + } } void NetInternalsMessageHandler::IOThreadImpl::OnGetNetInfo( @@ -1105,7 +1103,8 @@ void NetInternalsMessageHandler::IOThreadImpl::PrePopulateEventList() { std::set contexts; for (const auto& getter : context_getters_) contexts.insert(getter->GetURLRequestContext()); - contexts.insert(io_thread_->globals()->system_request_context); + if (io_thread_) + contexts.insert(io_thread_->globals()->system_request_context); // Add entries for ongoing network objects. CreateNetLogEntriesForActiveObjects(contexts, this); diff --git content/browser/resource_context_impl.cc content/browser/resource_context_impl.cc index 141a08305332..b16b4d61988d 100644 --- content/browser/resource_context_impl.cc +++ content/browser/resource_context_impl.cc @@ -58,6 +58,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 f45d227fe94a..32e37bd0a79e 100644 --- content/browser/webui/url_data_manager.cc +++ content/browser/webui/url_data_manager.cc @@ -150,6 +150,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 5ceb74d411fc..0c584d6e69b5 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;