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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/browser/renderer_host/render_widget_host_impl.h" 5 #include "content/browser/renderer_host/render_widget_host_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 StartHangMonitorTimeout( 1234 StartHangMonitorTimeout(
1235 TimeDelta::FromMilliseconds(hung_renderer_delay_ms_)); 1235 TimeDelta::FromMilliseconds(hung_renderer_delay_ms_));
1236 } 1236 }
1237 1237
1238 void RenderWidgetHostImpl::ForwardTouchEvent( 1238 void RenderWidgetHostImpl::ForwardTouchEvent(
1239 const WebKit::WebTouchEvent& touch_event) { 1239 const WebKit::WebTouchEvent& touch_event) {
1240 touch_event_queue_->QueueEvent(touch_event); 1240 touch_event_queue_->QueueEvent(touch_event);
1241 } 1241 }
1242 1242
1243 void RenderWidgetHostImpl::AddKeyboardListener(KeyboardListener* listener) { 1243 void RenderWidgetHostImpl::AddKeyboardListener(KeyboardListener* listener) {
1244 keyboard_listeners_.push_back(listener); 1244 keyboard_listeners_.AddObserver(listener);
1245 } 1245 }
1246 1246
1247 void RenderWidgetHostImpl::RemoveKeyboardListener( 1247 void RenderWidgetHostImpl::RemoveKeyboardListener(
1248 KeyboardListener* listener) { 1248 KeyboardListener* listener) {
1249 // Ensure that the element is actually in the list. 1249 // Ensure that the element is actually an observer.
1250 DCHECK(std::find(keyboard_listeners_.begin(), keyboard_listeners_.end(), 1250 DCHECK(keyboard_listeners_.HasObserver(listener));
1251 listener) != keyboard_listeners_.end()); 1251 keyboard_listeners_.RemoveObserver(listener);
1252 keyboard_listeners_.remove(listener);
1253 } 1252 }
1254 1253
1255 void RenderWidgetHostImpl::GetWebScreenInfo(WebKit::WebScreenInfo* result) { 1254 void RenderWidgetHostImpl::GetWebScreenInfo(WebKit::WebScreenInfo* result) {
1256 if (GetView()) 1255 if (GetView())
1257 static_cast<RenderWidgetHostViewPort*>(GetView())->GetScreenInfo(result); 1256 static_cast<RenderWidgetHostViewPort*>(GetView())->GetScreenInfo(result);
1258 else 1257 else
1259 RenderWidgetHostViewPort::GetDefaultScreenInfo(result); 1258 RenderWidgetHostViewPort::GetDefaultScreenInfo(result);
1260 } 1259 }
1261 1260
1262 void RenderWidgetHostImpl::NotifyScreenInfoChanged() { 1261 void RenderWidgetHostImpl::NotifyScreenInfoChanged() {
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after
2198 2197
2199 void RenderWidgetHostImpl::SetIgnoreInputEvents(bool ignore_input_events) { 2198 void RenderWidgetHostImpl::SetIgnoreInputEvents(bool ignore_input_events) {
2200 ignore_input_events_ = ignore_input_events; 2199 ignore_input_events_ = ignore_input_events;
2201 } 2200 }
2202 2201
2203 bool RenderWidgetHostImpl::KeyPressListenersHandleEvent( 2202 bool RenderWidgetHostImpl::KeyPressListenersHandleEvent(
2204 const NativeWebKeyboardEvent& event) { 2203 const NativeWebKeyboardEvent& event) {
2205 if (event.skip_in_browser || event.type != WebKeyboardEvent::RawKeyDown) 2204 if (event.skip_in_browser || event.type != WebKeyboardEvent::RawKeyDown)
2206 return false; 2205 return false;
2207 2206
2208 for (std::list<KeyboardListener*>::iterator it = keyboard_listeners_.begin(); 2207 ObserverList<KeyboardListener>::Iterator it(keyboard_listeners_);
2209 it != keyboard_listeners_.end(); ++it) { 2208 KeyboardListener* listener;
2210 if ((*it)->HandleKeyPressEvent(event)) 2209 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
2210 if (listener->HandleKeyPressEvent(event))
2211 return true; 2211 return true;
2212 } 2212 }
2213 2213
2214 return false; 2214 return false;
2215 } 2215 }
2216 2216
2217 void RenderWidgetHostImpl::ProcessKeyboardEventAck(int type, bool processed) { 2217 void RenderWidgetHostImpl::ProcessKeyboardEventAck(int type, bool processed) {
2218 if (key_queue_.empty()) { 2218 if (key_queue_.empty()) {
2219 LOG(ERROR) << "Got a KeyEvent back from the renderer but we " 2219 LOG(ERROR) << "Got a KeyEvent back from the renderer but we "
2220 << "don't seem to have sent it to the renderer!"; 2220 << "don't seem to have sent it to the renderer!";
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
2467 return; 2467 return;
2468 2468
2469 OnRenderAutoResized(new_size); 2469 OnRenderAutoResized(new_size);
2470 } 2470 }
2471 2471
2472 void RenderWidgetHostImpl::DetachDelegate() { 2472 void RenderWidgetHostImpl::DetachDelegate() {
2473 delegate_ = NULL; 2473 delegate_ = NULL;
2474 } 2474 }
2475 2475
2476 } // namespace content 2476 } // namespace content
OLDNEW
« 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