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

Unified Diff: chrome/browser/chromeos/proxy_config_service_impl.cc

Issue 8467012: Refactor proxy handling for ChromeOS to not go through the CrosSettings interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: One file slipped away. Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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() {

Powered by Google App Engine
This is Rietveld 408576698