fix: provide paths for all NetworkContextFilePaths keys (#31777)
* fix: provide paths for all NetworkContextFilePaths keys * chore: include chrome features header * chore: build browser_features * yolo * add pref service * fix: include sandbox policy features * fix pref key * fix: gate pref key to OS_WIN Co-authored-by: VerteDinde <khammond@slack-corp.com>
This commit is contained in:
parent
65e4f75058
commit
246884c4fb
4 changed files with 59 additions and 1 deletions
|
@ -18,6 +18,7 @@
|
|||
#include "chrome/common/chrome_paths.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "components/os_crypt/os_crypt.h"
|
||||
#include "components/prefs/pref_service.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/network_service_instance.h"
|
||||
#include "content/public/common/content_features.h"
|
||||
|
@ -50,6 +51,14 @@
|
|||
|
||||
namespace {
|
||||
|
||||
#if defined(OS_WIN)
|
||||
namespace {
|
||||
|
||||
const char kNetworkServiceSandboxEnabled[] = "net.network_service_sandbox";
|
||||
|
||||
}
|
||||
#endif // defined(OS_WIN)
|
||||
|
||||
// The global instance of the SystemNetworkContextmanager.
|
||||
SystemNetworkContextManager* g_system_network_context_manager = nullptr;
|
||||
|
||||
|
@ -220,6 +229,19 @@ void SystemNetworkContextManager::DeleteInstance() {
|
|||
delete g_system_network_context_manager;
|
||||
}
|
||||
|
||||
// c.f.
|
||||
// https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/net/system_network_context_manager.cc;l=730-740;drc=15a616c8043551a7cb22c4f73a88e83afb94631c;bpv=1;bpt=1
|
||||
bool SystemNetworkContextManager::IsNetworkSandboxEnabled() {
|
||||
#if defined(OS_WIN)
|
||||
auto* local_state = g_browser_process->local_state();
|
||||
if (local_state && local_state->HasPrefPath(kNetworkServiceSandboxEnabled)) {
|
||||
return local_state->GetBoolean(kNetworkServiceSandboxEnabled);
|
||||
}
|
||||
#endif // defined(OS_WIN)
|
||||
// If no policy is specified, then delegate to global sandbox configuration.
|
||||
return sandbox::policy::features::IsNetworkSandboxEnabled();
|
||||
}
|
||||
|
||||
SystemNetworkContextManager::SystemNetworkContextManager(
|
||||
PrefService* pref_service)
|
||||
: proxy_config_monitor_(pref_service) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue