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

Unified Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 13912016: [Autofill] Handle the Tab Key in the new UI (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Switch to ObserverList and AddTest Created 7 years, 8 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 | « content/browser/renderer_host/render_widget_host_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_impl.cc
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 1861547b675da8c5cc57c337586765c50e043a12..395bd1bb5c7bb5fcdfa7c2b5b301cec78d51f456 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -1241,15 +1241,14 @@ void RenderWidgetHostImpl::ForwardTouchEvent(
}
void RenderWidgetHostImpl::AddKeyboardListener(KeyboardListener* listener) {
- keyboard_listeners_.push_back(listener);
+ keyboard_listeners_.AddObserver(listener);
}
void RenderWidgetHostImpl::RemoveKeyboardListener(
KeyboardListener* listener) {
- // Ensure that the element is actually in the list.
- DCHECK(std::find(keyboard_listeners_.begin(), keyboard_listeners_.end(),
- listener) != keyboard_listeners_.end());
- keyboard_listeners_.remove(listener);
+ // Ensure that the element is actually an observer.
+ DCHECK(keyboard_listeners_.HasObserver(listener));
+ keyboard_listeners_.RemoveObserver(listener);
}
void RenderWidgetHostImpl::GetWebScreenInfo(WebKit::WebScreenInfo* result) {
@@ -2205,9 +2204,10 @@ bool RenderWidgetHostImpl::KeyPressListenersHandleEvent(
if (event.skip_in_browser || event.type != WebKeyboardEvent::RawKeyDown)
return false;
- for (std::list<KeyboardListener*>::iterator it = keyboard_listeners_.begin();
- it != keyboard_listeners_.end(); ++it) {
- if ((*it)->HandleKeyPressEvent(event))
+ ObserverList<KeyboardListener>::Iterator it(keyboard_listeners_);
+ KeyboardListener* listener;
+ while ((listener = it.GetNext()) != NULL) {
jam 2013/04/19 17:02:41 != NULL seems redundant?
csharp 2013/04/19 18:04:43 Yup, but all the instances in the code base that m
+ if (listener->HandleKeyPressEvent(event))
return true;
}
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698