diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-07 19:41:36 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-07 19:41:36 +0000 |
commit | 6688a4965904d54c252f563e0b0165232e28173c (patch) | |
tree | c43df23b1dd27166539c73924d34e17f81d60a35 /net/proxy/proxy_config_service_mac.h | |
parent | ab6d1223c9e957d9f179327cd6016ac1780d23fe (diff) | |
download | chromium_src-6688a4965904d54c252f563e0b0165232e28173c.zip chromium_src-6688a4965904d54c252f563e0b0165232e28173c.tar.gz chromium_src-6688a4965904d54c252f563e0b0165232e28173c.tar.bz2 |
Reland r58230.
Simple 2-line fix.
BUG=53138
TEST=Make sure ethernet is plugged in. Run Chrome. Unplug ethernet. Does not crash.
Review URL: http://codereview.chromium.org/3371001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58736 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/proxy_config_service_mac.h')
-rw-r--r-- | net/proxy/proxy_config_service_mac.h | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/net/proxy/proxy_config_service_mac.h b/net/proxy/proxy_config_service_mac.h index fd2d524..68a7d22 100644 --- a/net/proxy/proxy_config_service_mac.h +++ b/net/proxy/proxy_config_service_mac.h @@ -15,8 +15,7 @@ namespace net { -class ProxyConfigServiceMac : public ProxyConfigService, - public NetworkConfigWatcherMac { +class ProxyConfigServiceMac : public ProxyConfigService { public: // Constructs a ProxyConfigService that watches the Mac OS system settings. // This instance is expected to be operated and deleted on |io_loop| @@ -30,17 +29,39 @@ class ProxyConfigServiceMac : public ProxyConfigService, virtual void RemoveObserver(Observer* observer); virtual bool GetLatestProxyConfig(ProxyConfig* config); - protected: - // NetworkConfigWatcherMac implementation: - virtual void SetDynamicStoreNotificationKeys(SCDynamicStoreRef store); - virtual void OnNetworkConfigChange(CFArrayRef changed_keys); - private: class Helper; + // Forwarder just exists to keep the NetworkConfigWatcherMac API out of + // ProxyConfigServiceMac's public API. + class Forwarder : public NetworkConfigWatcherMac::Delegate { + public: + explicit Forwarder(ProxyConfigServiceMac* net_config_watcher) + : net_config_watcher_(net_config_watcher) {} + + // NetworkConfigWatcherMac::Delegate implementation: + virtual void SetDynamicStoreNotificationKeys(SCDynamicStoreRef store) { + net_config_watcher_->SetDynamicStoreNotificationKeys(store); + } + virtual void OnNetworkConfigChange(CFArrayRef changed_keys) { + net_config_watcher_->OnNetworkConfigChange(changed_keys); + } + + private: + ProxyConfigServiceMac* const net_config_watcher_; + DISALLOW_COPY_AND_ASSIGN(Forwarder); + }; + + // NetworkConfigWatcherMac::Delegate implementation: + void SetDynamicStoreNotificationKeys(SCDynamicStoreRef store); + void OnNetworkConfigChange(CFArrayRef changed_keys); + // Called when the proxy configuration has changed, to notify the observers. void OnProxyConfigChanged(const ProxyConfig& new_config); + Forwarder forwarder_; + const NetworkConfigWatcherMac config_watcher_; + ObserverList<Observer> observers_; // Holds the last system proxy settings that we fetched. |