add dns config flag

This commit is contained in:
Alexander Frick 2024-04-29 10:57:30 -05:00
parent 3666929ee7
commit 840ec41e77
2 changed files with 27 additions and 10 deletions

View file

@ -29,10 +29,14 @@
"Disable Thorium Top Bar Icons",
"Disables the custom colored top bar icons in Thorium, and restores the default grey Chromium icon colors.",
kOsDesktop, SINGLE_VALUE_TYPE("disable-thorium-icons")},
{"disable-thorium-dns-config",
"Disable Thorium Custom DNS Config",
"Disables the custom DNS configuration used by default in Thorium. Useful when this config breaks something, "
"due to external apps or a non-standard system DNS config setting.",
{"force-high-contrast",
"Enable High Contrast Mode",
"Enables high contrast mode for all Thorium instances.",
kOsAll, SINGLE_VALUE_TYPE(switches::kForceHighContrast)},
kOsDesktop, SINGLE_VALUE_TYPE(switches::kForceHighContrast)},
#if BUILDFLAG(IS_WIN)
{"disable-aero",

View file

@ -9,6 +9,7 @@
#include <string>
#include <utility>
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
@ -249,6 +250,7 @@ class DnsClientImpl : public DnsClient {
private:
std::optional<DnsConfig> BuildEffectiveConfig() const {
DnsConfig config;
if (!base::CommandLine::ForCurrentProcess()->HasSwitch("disable-thorium-dns-config")) {
// in Bromite it is sufficient to have secure DoH enabled to give the overrides priority
if (config_overrides_.dns_over_https_config && config_overrides_.secure_dns_mode) {
config = config_overrides_.ApplyOverrides(DnsConfig());
@ -260,6 +262,17 @@ class DnsClientImpl : public DnsClient {
config = config_overrides_.ApplyOverrides(system_config_.value());
}
} else {
if (config_overrides_.OverridesEverything()) {
config = config_overrides_.ApplyOverrides(DnsConfig());
} else {
if (!system_config_)
LOG(WARNING) << "BuildEffectiveConfig(): system configuration not set";
return std::nullopt;
config = config_overrides_.ApplyOverrides(system_config_.value());
}
}
UpdateConfigForDohUpgrade(&config);