blob: c1c02e7a07db5f44e2f796657e2e2f9b7a10c6c0 [file] [log] [blame]
dalyk272d4b02019-08-14 00:37:511// Copyright 2019 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_NET_DNS_UTIL_H_
6#define CHROME_BROWSER_NET_DNS_UTIL_H_
7
Ben Schwartz4e1468612020-03-31 21:23:458#include <vector>
9
10#include "base/strings/string_piece.h"
Ben Schwartz78ff2568f2020-04-30 05:15:1811#include "net/dns/dns_config_overrides.h"
dalyk272d4b02019-08-14 00:37:5112
Martin Šrámek5921f6312020-03-25 09:31:4713class PrefRegistrySimple;
14class PrefService;
15
Steven Binglerdd2307b2019-08-27 20:44:3616namespace chrome_browser_net {
17
Ben Schwartz4e1468612020-03-31 21:23:4518// Implements the whitespace-delimited group syntax for DoH templates.
19std::vector<base::StringPiece> SplitDohTemplateGroup(base::StringPiece group);
20
21// Returns true if a group of templates are all valid per
22// net::dns_util::IsValidDohTemplate(). This should be checked before updating
23// stored preferences.
24bool IsValidDohTemplateGroup(base::StringPiece group);
25
Ben Schwartz78ff2568f2020-04-30 05:15:1826// Modifies |overrides| to use the DoH server specified by |server_template|.
27void ApplyDohTemplate(net::DnsConfigOverrides* overrides,
28 base::StringPiece server_template);
29
Steven Binglerace5fd22019-08-20 21:01:2030const char kDnsOverHttpsModeOff[] = "off";
31const char kDnsOverHttpsModeAutomatic[] = "automatic";
32const char kDnsOverHttpsModeSecure[] = "secure";
33
dalyk0180bcf2020-02-27 01:22:0034// Forced management description types. We will check for the override cases in
35// the order they are listed in the enum.
36enum class SecureDnsUiManagementMode {
37 // Chrome did not override the secure DNS settings.
38 kNoOverride,
39 // Secure DNS was disabled due to detection of a managed environment.
40 kDisabledManaged,
41 // Secure DNS was disabled due to detection of OS-level parental controls.
42 kDisabledParentalControls,
43};
44
Martin Šrámek5921f6312020-03-25 09:31:4745// Registers the backup preference required for the DNS probes setting reset.
46// TODO(crbug.com/1062698): Remove this once the privacy settings redesign
47// is fully launched.
48void RegisterDNSProbesSettingBackupPref(PrefRegistrySimple* registry);
49
50// Backs up the unneeded preference controlling DNS and captive portal probes
51// once the privacy settings redesign is enabled, or restores the backup
52// in case the feature is rolled back.
53// TODO(crbug.com/1062698): Remove this once the privacy settings redesign
54// is fully launched.
55void MigrateDNSProbesSettingToOrFromBackup(PrefService* prefs);
56
Steven Binglerdd2307b2019-08-27 20:44:3657} // namespace chrome_browser_net
58
dalyk272d4b02019-08-14 00:37:5159#endif // CHROME_BROWSER_NET_DNS_UTIL_H_