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

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: Addressed comments. 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..c1010bfdd8110bd2e38b4575b1cb9beb49a0ac79 100644
--- a/chrome/browser/chromeos/proxy_config_service_impl.cc
+++ b/chrome/browser/chromeos/proxy_config_service_impl.cc
@@ -471,6 +471,27 @@ bool ProxyConfigServiceImpl::UISetProxyConfigBypassRules(
return true;
}
+void ProxyConfigServiceImpl::AddNotificationCallback(base::Closure callback) {
+ std::vector<base::Closure>::iterator iter = callbacks_.begin();
+ for (;iter != callbacks_.end(); ++iter) {
kuan 2011/11/10 14:27:25 s/;iter/; iter/
pastarmovj 2011/11/10 16:08:26 Done.
+ if (callback.Equals(*iter)) {
+ return;
+ }
kuan 2011/11/10 14:27:25 don't need curly braces
pastarmovj 2011/11/10 16:08:26 Done.
+ }
+ callbacks_.push_back(callback);
+}
+
+void ProxyConfigServiceImpl::RemoveNotificationCallback(
+ base::Closure callback) {
+ std::vector<base::Closure>::iterator iter = callbacks_.begin();
+ for (;iter != callbacks_.end(); ++iter) {
kuan 2011/11/10 14:27:25 s/;iter/; iter/
pastarmovj 2011/11/10 16:08:26 Done.
+ if (callback.Equals(*iter)) {
+ callbacks_.erase(iter);
+ return;
+ }
+ }
+}
+
void ProxyConfigServiceImpl::OnProxyConfigChanged(
ProxyPrefs::ConfigState config_state,
const net::ProxyConfig& config) {
@@ -762,6 +783,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);
+ } else {
+ iter->Run();
+ iter++;
kuan 2011/11/10 14:27:25 pre-increment
pastarmovj 2011/11/10 16:08:26 Done.
+ }
+ }
}
void ProxyConfigServiceImpl::ResetUICache() {

Powered by Google App Engine
This is Rietveld 408576698