Chromium Code Reviews| Index: chrome/browser/chromeos/proxy_config_service_impl.cc |
| diff --git a/chrome/browser/chromeos/proxy_config_service_impl.cc b/chrome/browser/chromeos/proxy_config_service_impl.cc |
| index c42f4ee099840b282d63ffe114037580a046ca38..ce7bc82afcdb4f8edd395e9592b63279ca7a1b7f 100644 |
| --- a/chrome/browser/chromeos/proxy_config_service_impl.cc |
| +++ b/chrome/browser/chromeos/proxy_config_service_impl.cc |
| @@ -471,6 +471,26 @@ bool ProxyConfigServiceImpl::UISetProxyConfigBypassRules( |
| return true; |
| } |
| +void ProxyConfigServiceImpl::AddNotificationCallback(base::Closure callback) { |
| + std::vector<base::Closure>::iterator iter = callbacks_.begin(); |
| + for (; iter != callbacks_.end(); ++iter) { |
| + if (callback.Equals(*iter)) |
| + return; |
| + } |
|
Mattias Nissler (ping if slow)
2011/11/11 12:10:46
std::find
pastarmovj
2011/11/11 15:17:31
After spending an hour playing with templates and
|
| + callbacks_.push_back(callback); |
| +} |
| + |
| +void ProxyConfigServiceImpl::RemoveNotificationCallback( |
| + base::Closure callback) { |
| + std::vector<base::Closure>::iterator iter = callbacks_.begin(); |
| + for (; iter != callbacks_.end(); ++iter) { |
| + if (callback.Equals(*iter)) { |
| + callbacks_.erase(iter); |
| + return; |
| + } |
| + } |
|
Mattias Nissler (ping if slow)
2011/11/11 12:10:46
std::find
pastarmovj
2011/11/11 15:17:31
Ditto.
|
| +} |
| + |
| void ProxyConfigServiceImpl::OnProxyConfigChanged( |
| ProxyPrefs::ConfigState config_state, |
| const net::ProxyConfig& config) { |
| @@ -762,6 +782,16 @@ void ProxyConfigServiceImpl::OnUISetCurrentNetwork(const Network* network) { |
| << ", " << ModeToString(current_ui_config_.mode) |
| << ", " << ConfigStateToString(current_ui_config_.state) |
| << ", modifiable:" << current_ui_config_.user_modifiable; |
| + // Notify whoever is interested in this change. |
| + std::vector<base::Closure>::iterator iter = callbacks_.begin(); |
| + while (iter != callbacks_.end()) { |
| + if (iter->is_null()) { |
| + iter = callbacks_.erase(iter); |
|
Mattias Nissler (ping if slow)
2011/11/11 12:10:46
You can't do that while still iterating.
pastarmovj
2011/11/11 15:17:31
All other iterators are invalidated true but the i
|
| + } else { |
| + iter->Run(); |
| + ++iter; |
| + } |
| + } |
| } |
| void ProxyConfigServiceImpl::ResetUICache() { |