OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/proxy/proxy_config_service_win.h" | 5 #include "net/proxy/proxy_config_service_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <winhttp.h> | 8 #include <winhttp.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/profiler/scoped_tracker.h" | |
15 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
16 #include "base/strings/string_tokenizer.h" | 15 #include "base/strings/string_tokenizer.h" |
17 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
18 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
19 #include "base/threading/thread_restrictions.h" | 18 #include "base/threading/thread_restrictions.h" |
20 #include "base/win/registry.h" | 19 #include "base/win/registry.h" |
21 #include "base/win/scoped_handle.h" | 20 #include "base/win/scoped_handle.h" |
22 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
23 #include "net/proxy/proxy_config.h" | 22 #include "net/proxy/proxy_config.h" |
24 | 23 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 55 |
57 void ProxyConfigServiceWin::AddObserver(Observer* observer) { | 56 void ProxyConfigServiceWin::AddObserver(Observer* observer) { |
58 // Lazily-initialize our registry watcher. | 57 // Lazily-initialize our registry watcher. |
59 StartWatchingRegistryForChanges(); | 58 StartWatchingRegistryForChanges(); |
60 | 59 |
61 // Let the super-class do its work now. | 60 // Let the super-class do its work now. |
62 PollingProxyConfigService::AddObserver(observer); | 61 PollingProxyConfigService::AddObserver(observer); |
63 } | 62 } |
64 | 63 |
65 void ProxyConfigServiceWin::StartWatchingRegistryForChanges() { | 64 void ProxyConfigServiceWin::StartWatchingRegistryForChanges() { |
66 // TODO(eroman): Remove once crbug.com/454983 is solved. | |
67 tracked_objects::ScopedTracker tracking_profile( | |
68 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
69 "454983 ProxyConfigServiceWin::StartWatchingRegistryForChanges")); | |
70 | |
71 if (!keys_to_watch_.empty()) | 65 if (!keys_to_watch_.empty()) |
72 return; // Already initialized. | 66 return; // Already initialized. |
73 | 67 |
74 // The registry functions below will end up going to disk. Do this on another | 68 // The registry functions below will end up going to disk. Do this on another |
75 // thread to avoid slowing the IO thread. http://crbug.com/61453 | 69 // thread to avoid slowing the IO thread. http://crbug.com/61453 |
76 base::ThreadRestrictions::ScopedAllowIO allow_io; | 70 base::ThreadRestrictions::ScopedAllowIO allow_io; |
77 | 71 |
78 // There are a number of different places where proxy settings can live | 72 // There are a number of different places where proxy settings can live |
79 // in the registry. In some cases it appears in a binary value, in other | 73 // in the registry. In some cases it appears in a binary value, in other |
80 // cases string values. Furthermore winhttp and wininet appear to have | 74 // cases string values. Furthermore winhttp and wininet appear to have |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 std::string bypass_url_domain = proxy_server_bypass_list.token(); | 163 std::string bypass_url_domain = proxy_server_bypass_list.token(); |
170 config->proxy_rules().bypass_rules.AddRuleFromString(bypass_url_domain); | 164 config->proxy_rules().bypass_rules.AddRuleFromString(bypass_url_domain); |
171 } | 165 } |
172 } | 166 } |
173 if (ie_config.lpszAutoConfigUrl) | 167 if (ie_config.lpszAutoConfigUrl) |
174 config->set_pac_url(GURL(ie_config.lpszAutoConfigUrl)); | 168 config->set_pac_url(GURL(ie_config.lpszAutoConfigUrl)); |
175 config->set_source(PROXY_CONFIG_SOURCE_SYSTEM); | 169 config->set_source(PROXY_CONFIG_SOURCE_SYSTEM); |
176 } | 170 } |
177 | 171 |
178 } // namespace net | 172 } // namespace net |
OLD | NEW |