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", true); | 30 base::EndsWith(proxy.host_port_pair().host(), ".googlezip.net", |
| 31 base::CompareCase::SENSITIVE); |
31 } | 32 } |
32 | 33 |
33 // Removes any Data Reduction Proxies like *.googlezip.net from |proxy_list|. | 34 // Removes any Data Reduction Proxies like *.googlezip.net from |proxy_list|. |
34 // Returns the number of proxies that were removed from |proxy_list|. | 35 // Returns the number of proxies that were removed from |proxy_list|. |
35 size_t RemoveGooglezipDataReductionProxiesFromList(net::ProxyList* proxy_list) { | 36 size_t RemoveGooglezipDataReductionProxiesFromList(net::ProxyList* proxy_list) { |
36 bool found_googlezip_proxy = false; | 37 bool found_googlezip_proxy = false; |
37 for (const net::ProxyServer& proxy : proxy_list->GetAll()) { | 38 for (const net::ProxyServer& proxy : proxy_list->GetAll()) { |
38 if (IsGooglezipDataReductionProxy(proxy)) { | 39 if (IsGooglezipDataReductionProxy(proxy)) { |
39 found_googlezip_proxy = true; | 40 found_googlezip_proxy = true; |
40 break; | 41 break; |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 (config_state_ != ProxyPrefs::CONFIG_UNSET && | 425 (config_state_ != ProxyPrefs::CONFIG_UNSET && |
425 !pref_config_.Equals(new_config))) { | 426 !pref_config_.Equals(new_config))) { |
426 config_state_ = config_state; | 427 config_state_ = config_state; |
427 if (config_state_ != ProxyPrefs::CONFIG_UNSET) | 428 if (config_state_ != ProxyPrefs::CONFIG_UNSET) |
428 pref_config_ = new_config; | 429 pref_config_ = new_config; |
429 update_pending_ = true; | 430 update_pending_ = true; |
430 } | 431 } |
431 if (update_pending_) | 432 if (update_pending_) |
432 OnProxyConfigChanged(config_state, new_config); | 433 OnProxyConfigChanged(config_state, new_config); |
433 } | 434 } |
OLD | NEW |