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

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.h

Issue 10823262: Refactoring: Extract gesture event filtering into helper class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more review comments Created 8 years, 4 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 | Annotate | Revision Log
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 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 28 matching lines...) Expand all
39 39
40 namespace WebKit { 40 namespace WebKit {
41 class WebInputEvent; 41 class WebInputEvent;
42 class WebMouseEvent; 42 class WebMouseEvent;
43 struct WebCompositionUnderline; 43 struct WebCompositionUnderline;
44 struct WebScreenInfo; 44 struct WebScreenInfo;
45 } 45 }
46 46
47 namespace content { 47 namespace content {
48 class BackingStore; 48 class BackingStore;
49 class GestureEventFilter;
49 class RenderWidgetHostDelegate; 50 class RenderWidgetHostDelegate;
50 class RenderWidgetHostViewPort; 51 class RenderWidgetHostViewPort;
51 class SmoothScrollGesture; 52 class SmoothScrollGesture;
52 class TapSuppressionController;
53 53
54 // This implements the RenderWidgetHost interface that is exposed to 54 // This implements the RenderWidgetHost interface that is exposed to
55 // embedders of content, and adds things only visible to content. 55 // embedders of content, and adds things only visible to content.
56 class CONTENT_EXPORT RenderWidgetHostImpl : virtual public RenderWidgetHost, 56 class CONTENT_EXPORT RenderWidgetHostImpl : virtual public RenderWidgetHost,
57 public IPC::Listener { 57 public IPC::Listener {
58 public: 58 public:
59 // routing_id can be MSG_ROUTING_NONE, in which case the next available 59 // routing_id can be MSG_ROUTING_NONE, in which case the next available
60 // routing id is taken from the RenderProcessHost. 60 // routing id is taken from the RenderProcessHost.
61 RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate, 61 RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate,
62 RenderProcessHost* process, 62 RenderProcessHost* process,
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 void ProcessTouchAck(WebKit::WebInputEvent::Type type, bool processed); 595 void ProcessTouchAck(WebKit::WebInputEvent::Type type, bool processed);
596 596
597 // Called when there is a new auto resize (using a post to avoid a stack 597 // Called when there is a new auto resize (using a post to avoid a stack
598 // which may get in recursive loops). 598 // which may get in recursive loops).
599 void DelayedAutoResized(); 599 void DelayedAutoResized();
600 600
601 // Called periodically to advance the active scroll gesture after being 601 // Called periodically to advance the active scroll gesture after being
602 // initiated by OnMsgBeginSmoothScroll. 602 // initiated by OnMsgBeginSmoothScroll.
603 void TickActiveSmoothScrollGesture(); 603 void TickActiveSmoothScrollGesture();
604 604
605 // Returns |true| if the given GestureFlingCancel should be discarded
606 // as unnecessary.
607 bool ShouldDiscardFlingCancelEvent(
608 const WebKit::WebGestureEvent& gesture_event);
609
610 // Our delegate, which wants to know mainly about keyboard events. 605 // Our delegate, which wants to know mainly about keyboard events.
611 RenderWidgetHostDelegate* delegate_; 606 RenderWidgetHostDelegate* delegate_;
612 607
613 // Created during construction but initialized during Init*(). Therefore, it 608 // Created during construction but initialized during Init*(). Therefore, it
614 // is guaranteed never to be NULL, but its channel may be NULL if the 609 // is guaranteed never to be NULL, but its channel may be NULL if the
615 // renderer crashed, so you must always check that. 610 // renderer crashed, so you must always check that.
616 RenderProcessHost* process_; 611 RenderProcessHost* process_;
617 612
618 // The ID of the corresponding object in the Renderer Instance. 613 // The ID of the corresponding object in the Renderer Instance.
619 int routing_id_; 614 int routing_id_;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 674
680 // (Similar to |next_mouse_move_|.) The next mouse wheel events to send. 675 // (Similar to |next_mouse_move_|.) The next mouse wheel events to send.
681 // Unlike mouse moves, mouse wheel events received while one is pending are 676 // Unlike mouse moves, mouse wheel events received while one is pending are
682 // coalesced (by accumulating deltas) if they match the previous event in 677 // coalesced (by accumulating deltas) if they match the previous event in
683 // modifiers. On the Mac, in particular, mouse wheel events are received at a 678 // modifiers. On the Mac, in particular, mouse wheel events are received at a
684 // high rate; not waiting for the ack results in jankiness, and using the same 679 // high rate; not waiting for the ack results in jankiness, and using the same
685 // mechanism as for mouse moves (just dropping old events when multiple ones 680 // mechanism as for mouse moves (just dropping old events when multiple ones
686 // would be queued) results in very slow scrolling. 681 // would be queued) results in very slow scrolling.
687 WheelEventQueue coalesced_mouse_wheel_events_; 682 WheelEventQueue coalesced_mouse_wheel_events_;
688 683
689 // (Similar to |mouse_wheel_pending_|.). True if gesture event was sent and
690 // we are waiting for a corresponding ack.
691 bool gesture_event_pending_;
692
693 typedef std::deque<WebKit::WebGestureEvent> GestureEventQueue;
694
695 // (Similar to |coalesced_mouse_wheel_events_|.) GestureScrollUpdate events
696 // are coalesced by merging deltas in a similar fashion as wheel events.
697 GestureEventQueue coalesced_gesture_events_;
698
699 // The time when an input event was sent to the RenderWidget. 684 // The time when an input event was sent to the RenderWidget.
700 base::TimeTicks input_event_start_time_; 685 base::TimeTicks input_event_start_time_;
701 686
702 // Keyboard event listeners. 687 // Keyboard event listeners.
703 std::list<KeyboardListener*> keyboard_listeners_; 688 std::list<KeyboardListener*> keyboard_listeners_;
704 689
705 // If true, then we should repaint when restoring even if we have a 690 // If true, then we should repaint when restoring even if we have a
706 // backingstore. This flag is set to true if we receive a paint message 691 // backingstore. This flag is set to true if we receive a paint message
707 // while is_hidden_ to true. Even though we tell the render widget to hide 692 // while is_hidden_ to true. Even though we tell the render widget to hide
708 // itself, a paint message could already be in flight at that point. 693 // itself, a paint message could already be in flight at that point.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 bool pending_mouse_lock_request_; 763 bool pending_mouse_lock_request_;
779 bool allow_privileged_mouse_lock_; 764 bool allow_privileged_mouse_lock_;
780 765
781 // Keeps track of whether the webpage has any touch event handler. If it does, 766 // Keeps track of whether the webpage has any touch event handler. If it does,
782 // then touch events are sent to the renderer. Otherwise, the touch events are 767 // then touch events are sent to the renderer. Otherwise, the touch events are
783 // not sent to the renderer. 768 // not sent to the renderer.
784 bool has_touch_handler_; 769 bool has_touch_handler_;
785 770
786 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_; 771 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_;
787 772
788 scoped_ptr<TapSuppressionController> tap_suppression_controller_; 773 scoped_ptr<SmoothScrollGesture> active_smooth_scroll_gesture_;
789 774
790 bool fling_in_progress_; 775 scoped_ptr<GestureEventFilter> gesture_event_filter_;
791
792 scoped_ptr<SmoothScrollGesture> active_smooth_scroll_gesture_;
793 776
794 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); 777 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl);
795 }; 778 };
796 779
797 } // namespace content 780 } // namespace content
798 781
799 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ 782 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/gesture_event_filter.cc ('k') | content/browser/renderer_host/render_widget_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698