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

Side by Side Diff: extensions/browser/warning_service.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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/warning_service.h" 5 #include "extensions/browser/warning_service.h"
6 6
7 #include "content/public/browser/browser_thread.h" 7 #include "content/public/browser/browser_thread.h"
8 #include "extensions/browser/extension_registry.h" 8 #include "extensions/browser/extension_registry.h"
9 #include "extensions/browser/extensions_browser_client.h" 9 #include "extensions/browser/extensions_browser_client.h"
10 #include "extensions/browser/warning_service_factory.h" 10 #include "extensions/browser/warning_service_factory.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 void WarningService::AddObserver(Observer* observer) { 110 void WarningService::AddObserver(Observer* observer) {
111 observer_list_.AddObserver(observer); 111 observer_list_.AddObserver(observer);
112 } 112 }
113 113
114 void WarningService::RemoveObserver(Observer* observer) { 114 void WarningService::RemoveObserver(Observer* observer) {
115 observer_list_.RemoveObserver(observer); 115 observer_list_.RemoveObserver(observer);
116 } 116 }
117 117
118 void WarningService::NotifyWarningsChanged( 118 void WarningService::NotifyWarningsChanged(
119 const ExtensionIdSet& affected_extensions) { 119 const ExtensionIdSet& affected_extensions) {
120 FOR_EACH_OBSERVER(Observer, observer_list_, 120 for (auto& observer : observer_list_)
121 ExtensionWarningsChanged(affected_extensions)); 121 observer.ExtensionWarningsChanged(affected_extensions);
122 } 122 }
123 123
124 void WarningService::OnExtensionUnloaded( 124 void WarningService::OnExtensionUnloaded(
125 content::BrowserContext* browser_context, 125 content::BrowserContext* browser_context,
126 const Extension* extension, 126 const Extension* extension,
127 UnloadedExtensionInfo::Reason reason) { 127 UnloadedExtensionInfo::Reason reason) {
128 // Unloading one extension might have solved the problems of others. 128 // Unloading one extension might have solved the problems of others.
129 // Therefore, we clear warnings of this type for all extensions. 129 // Therefore, we clear warnings of this type for all extensions.
130 std::set<Warning::WarningType> warning_types = 130 std::set<Warning::WarningType> warning_types =
131 GetWarningTypesAffectingExtension(extension->id()); 131 GetWarningTypesAffectingExtension(extension->id());
132 ClearWarnings(warning_types); 132 ClearWarnings(warning_types);
133 } 133 }
134 134
135 } // namespace extensions 135 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/user_script_loader.cc ('k') | extensions/components/native_app_window/native_app_window_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698