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

Side by Side Diff: extensions/browser/extension_pref_value_map.cc

Issue 2424593002: Reduce FOR_EACH_OBSERVER usage in extensions (Closed)
Patch Set: script_observers_ 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
« no previous file with comments | « extensions/browser/extension_icon_image.cc ('k') | extensions/browser/extension_prefs.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "extensions/browser/extension_pref_value_map.h" 5 #include "extensions/browser/extension_pref_value_map.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "components/prefs/pref_value_map.h" 9 #include "components/prefs/pref_value_map.h"
10 10
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 std::string ExtensionPrefValueMap::GetExtensionControllingPref( 371 std::string ExtensionPrefValueMap::GetExtensionControllingPref(
372 const std::string& pref_key) const { 372 const std::string& pref_key) const {
373 ExtensionEntryMap::const_iterator winner = 373 ExtensionEntryMap::const_iterator winner =
374 GetEffectivePrefValueController(pref_key, false, NULL); 374 GetEffectivePrefValueController(pref_key, false, NULL);
375 if (winner == entries_.end()) 375 if (winner == entries_.end())
376 return std::string(); 376 return std::string();
377 return winner->first; 377 return winner->first;
378 } 378 }
379 379
380 void ExtensionPrefValueMap::NotifyInitializationCompleted() { 380 void ExtensionPrefValueMap::NotifyInitializationCompleted() {
381 FOR_EACH_OBSERVER(ExtensionPrefValueMap::Observer, observers_, 381 for (auto& observer : observers_)
382 OnInitializationCompleted()); 382 observer.OnInitializationCompleted();
383 } 383 }
384 384
385 void ExtensionPrefValueMap::NotifyPrefValueChanged( 385 void ExtensionPrefValueMap::NotifyPrefValueChanged(
386 const std::set<std::string>& keys) { 386 const std::set<std::string>& keys) {
387 for (const auto& key : keys) 387 for (const auto& key : keys)
388 NotifyPrefValueChanged(key); 388 NotifyPrefValueChanged(key);
389 } 389 }
390 390
391 void ExtensionPrefValueMap::NotifyPrefValueChanged(const std::string& key) { 391 void ExtensionPrefValueMap::NotifyPrefValueChanged(const std::string& key) {
392 FOR_EACH_OBSERVER(ExtensionPrefValueMap::Observer, observers_, 392 for (auto& observer : observers_)
393 OnPrefValueChanged(key)); 393 observer.OnPrefValueChanged(key);
394 } 394 }
395 395
396 void ExtensionPrefValueMap::NotifyOfDestruction() { 396 void ExtensionPrefValueMap::NotifyOfDestruction() {
397 FOR_EACH_OBSERVER(ExtensionPrefValueMap::Observer, observers_, 397 for (auto& observer : observers_)
398 OnExtensionPrefValueMapDestruction()); 398 observer.OnExtensionPrefValueMapDestruction();
399 } 399 }
OLDNEW
« no previous file with comments | « extensions/browser/extension_icon_image.cc ('k') | extensions/browser/extension_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698