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

Side by Side Diff: chrome/browser/supervised_user/supervised_user_pref_store.cc

Issue 2438513002: Remove FOR_EACH_OBSERVER macro usage in chrome/browser/supervised_user (Closed)
Patch Set: Created 4 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "chrome/browser/supervised_user/supervised_user_pref_store.h" 5 #include "chrome/browser/supervised_user/supervised_user_pref_store.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 159 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
160 switches::kEnableSupervisedUserManagedBookmarksFolder)) { 160 switches::kEnableSupervisedUserManagedBookmarksFolder)) {
161 // Reconstruct bookmarks from split settings. 161 // Reconstruct bookmarks from split settings.
162 prefs_->SetValue( 162 prefs_->SetValue(
163 bookmarks::prefs::kSupervisedBookmarks, 163 bookmarks::prefs::kSupervisedBookmarks,
164 SupervisedUserBookmarksHandler::BuildBookmarksTree(*settings)); 164 SupervisedUserBookmarksHandler::BuildBookmarksTree(*settings));
165 } 165 }
166 } 166 }
167 167
168 if (!old_prefs) { 168 if (!old_prefs) {
169 FOR_EACH_OBSERVER(Observer, observers_, OnInitializationCompleted(true)); 169 for (Observer& observer : observers_)
170 observer.OnInitializationCompleted(true);
170 return; 171 return;
171 } 172 }
172 173
173 std::vector<std::string> changed_prefs; 174 std::vector<std::string> changed_prefs;
174 prefs_->GetDifferingKeys(old_prefs.get(), &changed_prefs); 175 prefs_->GetDifferingKeys(old_prefs.get(), &changed_prefs);
175 176
176 // Send out change notifications. 177 // Send out change notifications.
177 for (const std::string& pref : changed_prefs) { 178 for (const std::string& pref : changed_prefs) {
178 FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(pref)); 179 for (Observer& observer : observers_)
180 observer.OnPrefValueChanged(pref);
179 } 181 }
180 } 182 }
181 183
182 // Callback to unsubscribe from the supervised user settings service. 184 // Callback to unsubscribe from the supervised user settings service.
183 void SupervisedUserPrefStore::Observe( 185 void SupervisedUserPrefStore::Observe(
184 int type, 186 int type,
185 const content::NotificationSource& src, 187 const content::NotificationSource& src,
186 const content::NotificationDetails& details) { 188 const content::NotificationDetails& details) {
187 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); 189 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type);
188 user_settings_subscription_.reset(); 190 user_settings_subscription_.reset();
189 } 191 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698