OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/net/pref_proxy_config_tracker_impl.h" | 5 #include "chrome/browser/net/pref_proxy_config_tracker_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/prefs/pref_registry_simple.h" | 9 #include "base/prefs/pref_registry_simple.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
14 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
15 #include "components/pref_registry/pref_registry_syncable.h" | 15 #include "components/pref_registry/pref_registry_syncable.h" |
16 #include "components/proxy_config/proxy_config_dictionary.h" | 16 #include "components/proxy_config/proxy_config_dictionary.h" |
17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
18 #include "content/public/browser/notification_details.h" | 18 #include "content/public/browser/notification_details.h" |
19 #include "content/public/browser/notification_source.h" | 19 #include "content/public/browser/notification_source.h" |
20 #include "net/proxy/proxy_list.h" | 20 #include "net/proxy/proxy_list.h" |
21 #include "net/proxy/proxy_server.h" | 21 #include "net/proxy/proxy_server.h" |
22 | 22 |
23 using content::BrowserThread; | 23 using content::BrowserThread; |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 // Determine if |proxy| is of the form "*.googlezip.net". | 27 // Determine if |proxy| is of the form "*.googlezip.net". |
28 bool IsGooglezipDataReductionProxy(const net::ProxyServer& proxy) { | 28 bool IsGooglezipDataReductionProxy(const net::ProxyServer& proxy) { |
29 return proxy.is_valid() && !proxy.is_direct() && | 29 return proxy.is_valid() && !proxy.is_direct() && |
30 base::EndsWith(proxy.host_port_pair().host(), ".googlezip.net", | 30 base::EndsWith(proxy.host_port_pair().host(), ".googlezip.net", true); |
31 base::CompareCase::SENSITIVE); | |
32 } | 31 } |
33 | 32 |
34 // Removes any Data Reduction Proxies like *.googlezip.net from |proxy_list|. | 33 // Removes any Data Reduction Proxies like *.googlezip.net from |proxy_list|. |
35 // Returns the number of proxies that were removed from |proxy_list|. | 34 // Returns the number of proxies that were removed from |proxy_list|. |
36 size_t RemoveGooglezipDataReductionProxiesFromList(net::ProxyList* proxy_list) { | 35 size_t RemoveGooglezipDataReductionProxiesFromList(net::ProxyList* proxy_list) { |
37 bool found_googlezip_proxy = false; | 36 bool found_googlezip_proxy = false; |
38 for (const net::ProxyServer& proxy : proxy_list->GetAll()) { | 37 for (const net::ProxyServer& proxy : proxy_list->GetAll()) { |
39 if (IsGooglezipDataReductionProxy(proxy)) { | 38 if (IsGooglezipDataReductionProxy(proxy)) { |
40 found_googlezip_proxy = true; | 39 found_googlezip_proxy = true; |
41 break; | 40 break; |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 (config_state_ != ProxyPrefs::CONFIG_UNSET && | 424 (config_state_ != ProxyPrefs::CONFIG_UNSET && |
426 !pref_config_.Equals(new_config))) { | 425 !pref_config_.Equals(new_config))) { |
427 config_state_ = config_state; | 426 config_state_ = config_state; |
428 if (config_state_ != ProxyPrefs::CONFIG_UNSET) | 427 if (config_state_ != ProxyPrefs::CONFIG_UNSET) |
429 pref_config_ = new_config; | 428 pref_config_ = new_config; |
430 update_pending_ = true; | 429 update_pending_ = true; |
431 } | 430 } |
432 if (update_pending_) | 431 if (update_pending_) |
433 OnProxyConfigChanged(config_state, new_config); | 432 OnProxyConfigChanged(config_state, new_config); |
434 } | 433 } |
OLD | NEW |