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