| Index: net/base/network_change_notifier.cc
|
| diff --git a/net/base/network_change_notifier.cc b/net/base/network_change_notifier.cc
|
| index 3ec6369fc47019b1e0933d0938c7e0d40d8edfe8..86bc2539e6078a6db369b022981988f83b5c9ff6 100644
|
| --- a/net/base/network_change_notifier.cc
|
| +++ b/net/base/network_change_notifier.cc
|
| @@ -776,6 +776,12 @@ void NetworkChangeNotifier::NotifyObserversOfNetworkChangeForTests(
|
| }
|
|
|
| // static
|
| +void NetworkChangeNotifier::NotifyObserversOfInitialDNSConfigReadForTests() {
|
| + if (g_network_change_notifier)
|
| + g_network_change_notifier->NotifyObserversOfInitialDNSConfigReadImpl();
|
| +}
|
| +
|
| +// static
|
| void NetworkChangeNotifier::SetTestNotificationsOnly(bool test_only) {
|
| if (g_network_change_notifier)
|
| g_network_change_notifier->test_notifications_only_ = test_only;
|
| @@ -941,6 +947,14 @@ void NetworkChangeNotifier::NotifyObserversOfDNSChange() {
|
| }
|
|
|
| // static
|
| +void NetworkChangeNotifier::NotifyObserversOfInitialDNSConfigRead() {
|
| + if (g_network_change_notifier &&
|
| + !g_network_change_notifier->test_notifications_only_) {
|
| + g_network_change_notifier->NotifyObserversOfInitialDNSConfigReadImpl();
|
| + }
|
| +}
|
| +
|
| +// static
|
| void NetworkChangeNotifier::SetDnsConfig(const DnsConfig& config) {
|
| if (!g_network_change_notifier)
|
| return;
|
| @@ -948,6 +962,20 @@ void NetworkChangeNotifier::SetDnsConfig(const DnsConfig& config) {
|
| NotifyObserversOfDNSChange();
|
| }
|
|
|
| +// static
|
| +void NetworkChangeNotifier::SetInitialDnsConfig(const DnsConfig& config) {
|
| + if (!g_network_change_notifier)
|
| + return;
|
| +#if DCHECK_IS_ON()
|
| + // Verify we've never received a valid DnsConfig previously.
|
| + DnsConfig old_config;
|
| + g_network_change_notifier->network_state_->GetDnsConfig(&old_config);
|
| + DCHECK(!old_config.IsValid());
|
| +#endif
|
| + g_network_change_notifier->network_state_->SetDnsConfig(config);
|
| + NotifyObserversOfInitialDNSConfigRead();
|
| +}
|
| +
|
| void NetworkChangeNotifier::NotifyObserversOfIPAddressChangeImpl() {
|
| ip_address_observer_list_->Notify(FROM_HERE,
|
| &IPAddressObserver::OnIPAddressChanged);
|
| @@ -969,6 +997,11 @@ void NetworkChangeNotifier::NotifyObserversOfDNSChangeImpl() {
|
| resolver_state_observer_list_->Notify(FROM_HERE, &DNSObserver::OnDNSChanged);
|
| }
|
|
|
| +void NetworkChangeNotifier::NotifyObserversOfInitialDNSConfigReadImpl() {
|
| + resolver_state_observer_list_->Notify(FROM_HERE,
|
| + &DNSObserver::OnInitialDNSConfigRead);
|
| +}
|
| +
|
| void NetworkChangeNotifier::NotifyObserversOfMaxBandwidthChangeImpl(
|
| double max_bandwidth_mbps) {
|
| max_bandwidth_observer_list_->Notify(
|
| @@ -987,4 +1020,7 @@ NetworkChangeNotifier::DisableForTest::~DisableForTest() {
|
| g_network_change_notifier = network_change_notifier_;
|
| }
|
|
|
| +void NetworkChangeNotifier::DNSObserver::OnInitialDNSConfigRead() {
|
| +}
|
| +
|
| } // namespace net
|
|
|