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

Unified Diff: components/renderer_context_menu/render_view_context_menu_base.cc

Issue 2410893006: Remove usage of base::ObserverList<T>::Iter::GetNext() in //components/renderer_context_menu. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/renderer_context_menu/render_view_context_menu_base.cc
diff --git a/components/renderer_context_menu/render_view_context_menu_base.cc b/components/renderer_context_menu/render_view_context_menu_base.cc
index 912932ab16e0c0cb6ae0d6022666746a546c1555..b743f9e42e4930e3f45a2824e35cd8c0f6d92e75 100644
--- a/components/renderer_context_menu/render_view_context_menu_base.cc
+++ b/components/renderer_context_menu/render_view_context_menu_base.cc
@@ -261,12 +261,9 @@ bool RenderViewContextMenuBase::IsCommandIdKnown(
bool* enabled) const {
// If this command is added by one of our observers, we dispatch
// it to the observer.
- base::ObserverListBase<RenderViewContextMenuObserver>::Iterator it(
- &observers_);
- RenderViewContextMenuObserver* observer;
- while ((observer = it.GetNext()) != NULL) {
- if (observer->IsCommandIdSupported(id)) {
- *enabled = observer->IsCommandIdEnabled(id);
+ for (auto& observer : observers_) {
+ if (observer.IsCommandIdSupported(id)) {
+ *enabled = observer.IsCommandIdEnabled(id);
return true;
}
}
@@ -285,12 +282,9 @@ bool RenderViewContextMenuBase::IsCommandIdKnown(
bool RenderViewContextMenuBase::IsCommandIdChecked(int id) const {
// If this command is is added by one of our observers, we dispatch it to the
// observer.
- base::ObserverListBase<RenderViewContextMenuObserver>::Iterator it(
- &observers_);
- RenderViewContextMenuObserver* observer;
- while ((observer = it.GetNext()) != NULL) {
- if (observer->IsCommandIdSupported(id))
- return observer->IsCommandIdChecked(id);
+ for (auto& observer : observers_) {
+ if (observer.IsCommandIdSupported(id))
+ return observer.IsCommandIdChecked(id);
}
// Custom items.
@@ -306,12 +300,9 @@ void RenderViewContextMenuBase::ExecuteCommand(int id, int event_flags) {
// If this command is is added by one of our observers, we dispatch
// it to the observer.
- base::ObserverListBase<RenderViewContextMenuObserver>::Iterator it(
- &observers_);
- RenderViewContextMenuObserver* observer;
- while ((observer = it.GetNext()) != NULL) {
- if (observer->IsCommandIdSupported(id))
- return observer->ExecuteCommand(id);
+ for (auto& observer : observers_) {
+ if (observer.IsCommandIdSupported(id))
+ return observer.ExecuteCommand(id);
}
// Process custom actions range.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698