OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.
h" | 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.
h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 | 579 |
580 bool DataReductionProxySettings::DisableIfVPN() { | 580 bool DataReductionProxySettings::DisableIfVPN() { |
581 net::NetworkInterfaceList network_interfaces; | 581 net::NetworkInterfaceList network_interfaces; |
582 GetNetworkList(&network_interfaces, 0); | 582 GetNetworkList(&network_interfaces, 0); |
583 // VPNs use a "tun" interface, so the presence of a "tun" interface indicates | 583 // VPNs use a "tun" interface, so the presence of a "tun" interface indicates |
584 // a VPN is in use. | 584 // a VPN is in use. |
585 // TODO(kundaji): Verify this works on Windows. | 585 // TODO(kundaji): Verify this works on Windows. |
586 const std::string vpn_interface_name_prefix = "tun"; | 586 const std::string vpn_interface_name_prefix = "tun"; |
587 for (size_t i = 0; i < network_interfaces.size(); ++i) { | 587 for (size_t i = 0; i < network_interfaces.size(); ++i) { |
588 std::string interface_name = network_interfaces[i].name; | 588 std::string interface_name = network_interfaces[i].name; |
589 if (base::LowerCaseEqualsASCII( | 589 if (LowerCaseEqualsASCII( |
590 interface_name.begin(), | 590 interface_name.begin(), |
591 interface_name.begin() + vpn_interface_name_prefix.size(), | 591 interface_name.begin() + vpn_interface_name_prefix.size(), |
592 vpn_interface_name_prefix.c_str())) { | 592 vpn_interface_name_prefix.c_str())) { |
593 SetProxyConfigs(false, | 593 SetProxyConfigs(false, |
594 IsDataReductionProxyAlternativeEnabled(), | 594 IsDataReductionProxyAlternativeEnabled(), |
595 false, | 595 false, |
596 false); | 596 false); |
597 disabled_on_vpn_ = true; | 597 disabled_on_vpn_ = true; |
598 RecordNetworkChangeEvent(DISABLED_ON_VPN); | 598 RecordNetworkChangeEvent(DISABLED_ON_VPN); |
599 return true; | 599 return true; |
600 } | 600 } |
601 } | 601 } |
602 if (disabled_on_vpn_) { | 602 if (disabled_on_vpn_) { |
603 SetProxyConfigs(enabled_by_user_, | 603 SetProxyConfigs(enabled_by_user_, |
604 IsDataReductionProxyAlternativeEnabled(), | 604 IsDataReductionProxyAlternativeEnabled(), |
605 restricted_by_carrier_, | 605 restricted_by_carrier_, |
606 false); | 606 false); |
607 } | 607 } |
608 disabled_on_vpn_ = false; | 608 disabled_on_vpn_ = false; |
609 return false; | 609 return false; |
610 } | 610 } |
611 | 611 |
612 } // namespace data_reduction_proxy | 612 } // namespace data_reduction_proxy |
OLD | NEW |