Skip to content

Commit

Permalink
add dns config flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex313031 committed Apr 29, 2024
1 parent a59afaa commit ee56188
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
7 changes: 6 additions & 1 deletion src/chrome/browser/thorium_flag_entries.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@
"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.",
kOsDesktop, SINGLE_VALUE_TYPE("disable-thorium-dns-config")},
{"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",
Expand Down
30 changes: 22 additions & 8 deletions src/net/dns/dns_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
#include <string>
#include <utility>

#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_macros.h"
#include "base/rand_util.h"
Expand Down Expand Up @@ -243,16 +245,28 @@ class DnsClientImpl : public DnsClient {
private:
std::optional<DnsConfig> BuildEffectiveConfig() const {
DnsConfig 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());
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());
} else {
if (!system_config_) {
LOG(WARNING) << "BuildEffectiveConfig(): no system configuration";
return std::nullopt;
}

config = config_overrides_.ApplyOverrides(system_config_.value());
}
} else {
if (!system_config_) {
LOG(WARNING) << "BuildEffectiveConfig(): no system configuration";
return std::nullopt;
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());
}

config = config_overrides_.ApplyOverrides(system_config_.value());
}

UpdateConfigForDohUpgrade(&config);
Expand Down

0 comments on commit ee56188

Please sign in to comment.