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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 | 578 |
579 bool DataReductionProxySettings::DisableIfVPN() { | 579 bool DataReductionProxySettings::DisableIfVPN() { |
580 net::NetworkInterfaceList network_interfaces; | 580 net::NetworkInterfaceList network_interfaces; |
581 GetNetworkList(&network_interfaces, 0); | 581 GetNetworkList(&network_interfaces, 0); |
582 // VPNs use a "tun" interface, so the presence of a "tun" interface indicates | 582 // VPNs use a "tun" interface, so the presence of a "tun" interface indicates |
583 // a VPN is in use. | 583 // a VPN is in use. |
584 // TODO(kundaji): Verify this works on Windows. | 584 // TODO(kundaji): Verify this works on Windows. |
585 const std::string vpn_interface_name_prefix = "tun"; | 585 const std::string vpn_interface_name_prefix = "tun"; |
586 for (size_t i = 0; i < network_interfaces.size(); ++i) { | 586 for (size_t i = 0; i < network_interfaces.size(); ++i) { |
587 std::string interface_name = network_interfaces[i].name; | 587 std::string interface_name = network_interfaces[i].name; |
588 if (LowerCaseEqualsASCII( | 588 if (base::LowerCaseEqualsASCII( |
589 interface_name.begin(), | 589 interface_name.begin(), |
590 interface_name.begin() + vpn_interface_name_prefix.size(), | 590 interface_name.begin() + vpn_interface_name_prefix.size(), |
591 vpn_interface_name_prefix.c_str())) { | 591 vpn_interface_name_prefix.c_str())) { |
592 SetProxyConfigs(false, | 592 SetProxyConfigs(false, |
593 IsDataReductionProxyAlternativeEnabled(), | 593 IsDataReductionProxyAlternativeEnabled(), |
594 false, | 594 false, |
595 false); | 595 false); |
596 disabled_on_vpn_ = true; | 596 disabled_on_vpn_ = true; |
597 RecordNetworkChangeEvent(DISABLED_ON_VPN); | 597 RecordNetworkChangeEvent(DISABLED_ON_VPN); |
598 return true; | 598 return true; |
599 } | 599 } |
600 } | 600 } |
601 if (disabled_on_vpn_) { | 601 if (disabled_on_vpn_) { |
602 SetProxyConfigs(enabled_by_user_, | 602 SetProxyConfigs(enabled_by_user_, |
603 IsDataReductionProxyAlternativeEnabled(), | 603 IsDataReductionProxyAlternativeEnabled(), |
604 restricted_by_carrier_, | 604 restricted_by_carrier_, |
605 false); | 605 false); |
606 } | 606 } |
607 disabled_on_vpn_ = false; | 607 disabled_on_vpn_ = false; |
608 return false; | 608 return false; |
609 } | 609 } |
610 | 610 |
611 } // namespace data_reduction_proxy | 611 } // namespace data_reduction_proxy |
OLD | NEW |