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

Side by Side Diff: content/browser/renderer_host/input/immediate_input_router.cc

Issue 63253002: Rename WebKit namespace to blink (part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/input/immediate_input_router.h" 5 #include "content/browser/renderer_host/input/immediate_input_router.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "content/browser/renderer_host/input/gesture_event_filter.h" 10 #include "content/browser/renderer_host/input/gesture_event_filter.h"
(...skipping 12 matching lines...) Expand all
23 #include "content/public/browser/notification_types.h" 23 #include "content/public/browser/notification_types.h"
24 #include "content/public/browser/user_metrics.h" 24 #include "content/public/browser/user_metrics.h"
25 #include "content/public/common/content_switches.h" 25 #include "content/public/common/content_switches.h"
26 #include "ipc/ipc_sender.h" 26 #include "ipc/ipc_sender.h"
27 #include "ui/events/event.h" 27 #include "ui/events/event.h"
28 #include "ui/events/keycodes/keyboard_codes.h" 28 #include "ui/events/keycodes/keyboard_codes.h"
29 29
30 using base::Time; 30 using base::Time;
31 using base::TimeDelta; 31 using base::TimeDelta;
32 using base::TimeTicks; 32 using base::TimeTicks;
33 using WebKit::WebGestureEvent; 33 using blink::WebGestureEvent;
34 using WebKit::WebInputEvent; 34 using blink::WebInputEvent;
35 using WebKit::WebKeyboardEvent; 35 using blink::WebKeyboardEvent;
36 using WebKit::WebMouseEvent; 36 using blink::WebMouseEvent;
37 using WebKit::WebMouseWheelEvent; 37 using blink::WebMouseWheelEvent;
38 38
39 namespace content { 39 namespace content {
40 namespace { 40 namespace {
41 41
42 GestureEventWithLatencyInfo MakeGestureEvent(WebInputEvent::Type type, 42 GestureEventWithLatencyInfo MakeGestureEvent(WebInputEvent::Type type,
43 double timestamp_seconds, 43 double timestamp_seconds,
44 int x, 44 int x,
45 int y, 45 int y,
46 int modifiers, 46 int modifiers,
47 const ui::LatencyInfo latency) { 47 const ui::LatencyInfo latency) {
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 if (!controller) 348 if (!controller)
349 return false; 349 return false;
350 350
351 OverscrollController::Disposition disposition = 351 OverscrollController::Disposition disposition =
352 controller->DispatchEvent(input_event, latency_info); 352 controller->DispatchEvent(input_event, latency_info);
353 353
354 bool consumed = disposition == OverscrollController::CONSUMED; 354 bool consumed = disposition == OverscrollController::CONSUMED;
355 355
356 if (disposition == OverscrollController::SHOULD_FORWARD_TO_GESTURE_FILTER) { 356 if (disposition == OverscrollController::SHOULD_FORWARD_TO_GESTURE_FILTER) {
357 DCHECK(WebInputEvent::isGestureEventType(input_event.type)); 357 DCHECK(WebInputEvent::isGestureEventType(input_event.type));
358 const WebKit::WebGestureEvent& gesture_event = 358 const blink::WebGestureEvent& gesture_event =
359 static_cast<const WebKit::WebGestureEvent&>(input_event); 359 static_cast<const blink::WebGestureEvent&>(input_event);
360 // An ACK is expected for the event, so mark it as consumed. 360 // An ACK is expected for the event, so mark it as consumed.
361 consumed = !gesture_event_filter_->ShouldForward( 361 consumed = !gesture_event_filter_->ShouldForward(
362 GestureEventWithLatencyInfo(gesture_event, latency_info)); 362 GestureEventWithLatencyInfo(gesture_event, latency_info));
363 } 363 }
364 364
365 if (consumed) { 365 if (consumed) {
366 InputEventAckState overscroll_ack = 366 InputEventAckState overscroll_ack =
367 WebInputEvent::isTouchEventType(input_event.type) ? 367 WebInputEvent::isTouchEventType(input_event.type) ?
368 INPUT_EVENT_ACK_STATE_NOT_CONSUMED : INPUT_EVENT_ACK_STATE_CONSUMED; 368 INPUT_EVENT_ACK_STATE_NOT_CONSUMED : INPUT_EVENT_ACK_STATE_CONSUMED;
369 ProcessInputEventAck(input_event.type, 369 ProcessInputEventAck(input_event.type,
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 } else if (WebInputEvent::isTouchEventType(event_type)) { 490 } else if (WebInputEvent::isTouchEventType(event_type)) {
491 ProcessTouchAck(ack_result, latency_info); 491 ProcessTouchAck(ack_result, latency_info);
492 } else if (WebInputEvent::isGestureEventType(event_type)) { 492 } else if (WebInputEvent::isGestureEventType(event_type)) {
493 ProcessGestureAck(event_type, ack_result, latency_info); 493 ProcessGestureAck(event_type, ack_result, latency_info);
494 } else if (event_type != WebInputEvent::Undefined) { 494 } else if (event_type != WebInputEvent::Undefined) {
495 ack_handler_->OnUnexpectedEventAck(InputAckHandler::BAD_ACK_MESSAGE); 495 ack_handler_->OnUnexpectedEventAck(InputAckHandler::BAD_ACK_MESSAGE);
496 } 496 }
497 } 497 }
498 498
499 void ImmediateInputRouter::ProcessKeyboardAck( 499 void ImmediateInputRouter::ProcessKeyboardAck(
500 WebKit::WebInputEvent::Type type, 500 blink::WebInputEvent::Type type,
501 InputEventAckState ack_result) { 501 InputEventAckState ack_result) {
502 if (key_queue_.empty()) { 502 if (key_queue_.empty()) {
503 ack_handler_->OnUnexpectedEventAck(InputAckHandler::UNEXPECTED_ACK); 503 ack_handler_->OnUnexpectedEventAck(InputAckHandler::UNEXPECTED_ACK);
504 } else if (key_queue_.front().type != type) { 504 } else if (key_queue_.front().type != type) {
505 // Something must be wrong. Clear the |key_queue_| and char event 505 // Something must be wrong. Clear the |key_queue_| and char event
506 // suppression so that we can resume from the error. 506 // suppression so that we can resume from the error.
507 key_queue_.clear(); 507 key_queue_.clear();
508 ack_handler_->OnUnexpectedEventAck(InputAckHandler::UNEXPECTED_EVENT_TYPE); 508 ack_handler_->OnUnexpectedEventAck(InputAckHandler::UNEXPECTED_EVENT_TYPE);
509 } else { 509 } else {
510 NativeWebKeyboardEvent front_item = key_queue_.front(); 510 NativeWebKeyboardEvent front_item = key_queue_.front();
511 key_queue_.pop_front(); 511 key_queue_.pop_front();
512 512
513 ack_handler_->OnKeyboardEventAck(front_item, ack_result); 513 ack_handler_->OnKeyboardEventAck(front_item, ack_result);
514 // WARNING: This ImmediateInputRouter can be deallocated at this point 514 // WARNING: This ImmediateInputRouter can be deallocated at this point
515 // (i.e. in the case of Ctrl+W, where the call to 515 // (i.e. in the case of Ctrl+W, where the call to
516 // HandleKeyboardEvent destroys this ImmediateInputRouter). 516 // HandleKeyboardEvent destroys this ImmediateInputRouter).
517 // TODO(jdduke): crbug.com/274029 - Make ack-triggered shutdown async. 517 // TODO(jdduke): crbug.com/274029 - Make ack-triggered shutdown async.
518 } 518 }
519 } 519 }
520 520
521 void ImmediateInputRouter::ProcessMouseAck(WebKit::WebInputEvent::Type type, 521 void ImmediateInputRouter::ProcessMouseAck(blink::WebInputEvent::Type type,
522 InputEventAckState ack_result) { 522 InputEventAckState ack_result) {
523 if (type != WebInputEvent::MouseMove) 523 if (type != WebInputEvent::MouseMove)
524 return; 524 return;
525 525
526 mouse_move_pending_ = false; 526 mouse_move_pending_ = false;
527 527
528 if (next_mouse_move_) { 528 if (next_mouse_move_) {
529 DCHECK(next_mouse_move_->event.type == WebInputEvent::MouseMove); 529 DCHECK(next_mouse_move_->event.type == WebInputEvent::MouseMove);
530 scoped_ptr<MouseEventWithLatencyInfo> next_mouse_move 530 scoped_ptr<MouseEventWithLatencyInfo> next_mouse_move
531 = next_mouse_move_.Pass(); 531 = next_mouse_move_.Pass();
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 break; 675 break;
676 } 676 }
677 } 677 }
678 678
679 bool ImmediateInputRouter::IsInOverscrollGesture() const { 679 bool ImmediateInputRouter::IsInOverscrollGesture() const {
680 OverscrollController* controller = client_->GetOverscrollController(); 680 OverscrollController* controller = client_->GetOverscrollController();
681 return controller && controller->overscroll_mode() != OVERSCROLL_NONE; 681 return controller && controller->overscroll_mode() != OVERSCROLL_NONE;
682 } 682 }
683 683
684 } // namespace content 684 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698