Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: net/proxy/proxy_config_service_win.h

Issue 5971008: move base/object_watcher into base/win and add the win namespace. Fixup calle... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/network_change_notifier_win.h ('k') | net/proxy/proxy_config_service_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef NET_PROXY_PROXY_CONFIG_SERVICE_WIN_H_ 5 #ifndef NET_PROXY_PROXY_CONFIG_SERVICE_WIN_H_
6 #define NET_PROXY_PROXY_CONFIG_SERVICE_WIN_H_ 6 #define NET_PROXY_PROXY_CONFIG_SERVICE_WIN_H_
7 #pragma once 7 #pragma once
8 8
9 #include <windows.h> 9 #include <windows.h>
10 #include <winhttp.h> 10 #include <winhttp.h>
11 11
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
15 #include "base/object_watcher.h" 15 #include "base/win/object_watcher.h"
16 #include "net/proxy/polling_proxy_config_service.h" 16 #include "net/proxy/polling_proxy_config_service.h"
17 17
18 namespace net { 18 namespace net {
19 19
20 // Implementation of ProxyConfigService that retrieves the system proxy 20 // Implementation of ProxyConfigService that retrieves the system proxy
21 // settings. 21 // settings.
22 // 22 //
23 // It works by calling WinHttpGetIEProxyConfigForCurrentUser() to fetch the 23 // It works by calling WinHttpGetIEProxyConfigForCurrentUser() to fetch the
24 // Internet Explorer proxy settings. 24 // Internet Explorer proxy settings.
25 // 25 //
26 // We use two different strategies to notice when the configuration has 26 // We use two different strategies to notice when the configuration has
27 // changed: 27 // changed:
28 // 28 //
29 // (1) Watch the internet explorer settings registry keys for changes. When 29 // (1) Watch the internet explorer settings registry keys for changes. When
30 // one of the registry keys pertaining to proxy settings has changed, we 30 // one of the registry keys pertaining to proxy settings has changed, we
31 // call WinHttpGetIEProxyConfigForCurrentUser() again to read the 31 // call WinHttpGetIEProxyConfigForCurrentUser() again to read the
32 // configuration's new value. 32 // configuration's new value.
33 // 33 //
34 // (2) Do regular polling every 10 seconds during network activity to see if 34 // (2) Do regular polling every 10 seconds during network activity to see if
35 // WinHttpGetIEProxyConfigForCurrentUser() returns something different. 35 // WinHttpGetIEProxyConfigForCurrentUser() returns something different.
36 // 36 //
37 // Ideally strategy (1) should be sufficient to pick up all of the changes. 37 // Ideally strategy (1) should be sufficient to pick up all of the changes.
38 // However we still do the regular polling as a precaution in case the 38 // However we still do the regular polling as a precaution in case the
39 // implementation details of WinHttpGetIEProxyConfigForCurrentUser() ever 39 // implementation details of WinHttpGetIEProxyConfigForCurrentUser() ever
40 // change, or in case we got it wrong (and are not checking all possible 40 // change, or in case we got it wrong (and are not checking all possible
41 // registry dependencies). 41 // registry dependencies).
42 class ProxyConfigServiceWin : public PollingProxyConfigService, 42 class ProxyConfigServiceWin : public PollingProxyConfigService,
43 public base::ObjectWatcher::Delegate { 43 public base::win::ObjectWatcher::Delegate {
44 public: 44 public:
45 ProxyConfigServiceWin(); 45 ProxyConfigServiceWin();
46 virtual ~ProxyConfigServiceWin(); 46 virtual ~ProxyConfigServiceWin();
47 47
48 // Overrides a function from PollingProxyConfigService. 48 // Overrides a function from PollingProxyConfigService.
49 virtual void AddObserver(Observer* observer); 49 virtual void AddObserver(Observer* observer);
50 50
51 private: 51 private:
52 FRIEND_TEST_ALL_PREFIXES(ProxyConfigServiceWinTest, SetFromIEConfig); 52 FRIEND_TEST_ALL_PREFIXES(ProxyConfigServiceWinTest, SetFromIEConfig);
53 class KeyEntry; 53 class KeyEntry;
(...skipping 16 matching lines...) Expand all
70 static void SetFromIEConfig( 70 static void SetFromIEConfig(
71 ProxyConfig* config, 71 ProxyConfig* config,
72 const WINHTTP_CURRENT_USER_IE_PROXY_CONFIG& ie_config); 72 const WINHTTP_CURRENT_USER_IE_PROXY_CONFIG& ie_config);
73 73
74 KeyEntryList keys_to_watch_; 74 KeyEntryList keys_to_watch_;
75 }; 75 };
76 76
77 } // namespace net 77 } // namespace net
78 78
79 #endif // NET_PROXY_PROXY_CONFIG_SERVICE_WIN_H_ 79 #endif // NET_PROXY_PROXY_CONFIG_SERVICE_WIN_H_
OLDNEW
« no previous file with comments | « net/base/network_change_notifier_win.h ('k') | net/proxy/proxy_config_service_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698