Simplify DoH probe and separate it from the UI

This change reduces code duplication by reusing DnsProbeRunner for
probing DoH servers in the UI.  It also extracts the probe logic
from the UI code, in order to reuse it in the forthcoming Android
DoH settings UI.

Change-Id: If6f6f1a8d7b6bb8f1d5810880d56dafbfdcf26f1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2150031
Auto-Submit: Ben Schwartz <[email protected]>
Reviewed-by: Eric Orth <[email protected]>
Reviewed-by: Esmael Elmoslimany <[email protected]>
Commit-Queue: Eric Orth <[email protected]>
Cr-Commit-Position: refs/heads/master@{#764137}
diff --git a/chrome/browser/net/dns_util.h b/chrome/browser/net/dns_util.h
index 89b155d73..c1c02e7a 100644
--- a/chrome/browser/net/dns_util.h
+++ b/chrome/browser/net/dns_util.h
@@ -8,6 +8,7 @@
 #include <vector>
 
 #include "base/strings/string_piece.h"
+#include "net/dns/dns_config_overrides.h"
 
 class PrefRegistrySimple;
 class PrefService;
@@ -22,6 +23,10 @@
 // stored preferences.
 bool IsValidDohTemplateGroup(base::StringPiece group);
 
+// Modifies |overrides| to use the DoH server specified by |server_template|.
+void ApplyDohTemplate(net::DnsConfigOverrides* overrides,
+                      base::StringPiece server_template);
+
 const char kDnsOverHttpsModeOff[] = "off";
 const char kDnsOverHttpsModeAutomatic[] = "automatic";
 const char kDnsOverHttpsModeSecure[] = "secure";