OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 reinterpret_cast<const WebInputEvent*>(data); | 442 reinterpret_cast<const WebInputEvent*>(data); |
443 | 443 |
444 bool is_keyboard_shortcut = false; | 444 bool is_keyboard_shortcut = false; |
445 // is_keyboard_shortcut flag is only available for RawKeyDown events. | 445 // is_keyboard_shortcut flag is only available for RawKeyDown events. |
446 if (input_event->type == WebInputEvent::RawKeyDown) | 446 if (input_event->type == WebInputEvent::RawKeyDown) |
447 message.ReadBool(&iter, &is_keyboard_shortcut); | 447 message.ReadBool(&iter, &is_keyboard_shortcut); |
448 | 448 |
449 bool processed = false; | 449 bool processed = false; |
450 if (input_event->type != WebInputEvent::Char || !suppress_next_char_events_) { | 450 if (input_event->type != WebInputEvent::Char || !suppress_next_char_events_) { |
451 suppress_next_char_events_ = false; | 451 suppress_next_char_events_ = false; |
452 if (webwidget_) | 452 processed = OnBeforeHandleInputEvent(*input_event); |
| 453 if (!processed && webwidget_) |
453 processed = webwidget_->handleInputEvent(*input_event); | 454 processed = webwidget_->handleInputEvent(*input_event); |
454 } | 455 } |
455 | 456 |
456 // If this RawKeyDown event corresponds to a browser keyboard shortcut and | 457 // If this RawKeyDown event corresponds to a browser keyboard shortcut and |
457 // it's not processed by webkit, then we need to suppress the upcoming Char | 458 // it's not processed by webkit, then we need to suppress the upcoming Char |
458 // events. | 459 // events. |
459 if (!processed && is_keyboard_shortcut) | 460 if (!processed && is_keyboard_shortcut) |
460 suppress_next_char_events_ = true; | 461 suppress_next_char_events_ = true; |
461 | 462 |
462 IPC::Message* response = new ViewHostMsg_HandleInputEvent_ACK(routing_id_); | 463 IPC::Message* response = new ViewHostMsg_HandleInputEvent_ACK(routing_id_); |
(...skipping 12 matching lines...) Expand all Loading... |
475 // send us the same kind of event we are delaying the ack for. | 476 // send us the same kind of event we are delaying the ack for. |
476 Send(pending_input_event_ack_.release()); | 477 Send(pending_input_event_ack_.release()); |
477 } | 478 } |
478 pending_input_event_ack_.reset(response); | 479 pending_input_event_ack_.reset(response); |
479 } else { | 480 } else { |
480 Send(response); | 481 Send(response); |
481 } | 482 } |
482 | 483 |
483 handling_input_event_ = false; | 484 handling_input_event_ = false; |
484 | 485 |
| 486 // TOOD(yzshen): what is the consequence of sending these notifications? |
485 if (WebInputEvent::isKeyboardEventType(input_event->type)) | 487 if (WebInputEvent::isKeyboardEventType(input_event->type)) |
486 DidHandleKeyEvent(); | 488 DidHandleKeyEvent(); |
487 if (WebInputEvent::isMouseEventType(input_event->type)) | 489 if (WebInputEvent::isMouseEventType(input_event->type)) |
488 DidHandleMouseEvent(*(static_cast<const WebMouseEvent*>(input_event))); | 490 DidHandleMouseEvent(*(static_cast<const WebMouseEvent*>(input_event))); |
489 } | 491 } |
490 | 492 |
491 void RenderWidget::OnMouseCaptureLost() { | 493 void RenderWidget::OnMouseCaptureLost() { |
492 if (webwidget_) | 494 if (webwidget_) |
493 webwidget_->mouseCaptureLost(); | 495 webwidget_->mouseCaptureLost(); |
494 } | 496 } |
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1384 | 1386 |
1385 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) { | 1387 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) { |
1386 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin(); | 1388 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin(); |
1387 i != plugin_window_moves_.end(); ++i) { | 1389 i != plugin_window_moves_.end(); ++i) { |
1388 if (i->window == window) { | 1390 if (i->window == window) { |
1389 plugin_window_moves_.erase(i); | 1391 plugin_window_moves_.erase(i); |
1390 break; | 1392 break; |
1391 } | 1393 } |
1392 } | 1394 } |
1393 } | 1395 } |
OLD | NEW |