OLD | NEW |
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 <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // Use RenderWidgetHostImpl::From(rwh) to downcast a | 119 // Use RenderWidgetHostImpl::From(rwh) to downcast a |
120 // RenderWidgetHost to a RenderWidgetHostImpl. Internally, this | 120 // RenderWidgetHost to a RenderWidgetHostImpl. Internally, this |
121 // uses RenderWidgetHost::AsRenderWidgetHostImpl(). | 121 // uses RenderWidgetHost::AsRenderWidgetHostImpl(). |
122 static RenderWidgetHostImpl* From(RenderWidgetHost* rwh); | 122 static RenderWidgetHostImpl* From(RenderWidgetHost* rwh); |
123 | 123 |
124 void set_hung_renderer_delay_ms(const base::TimeDelta& timeout) { | 124 void set_hung_renderer_delay_ms(const base::TimeDelta& timeout) { |
125 hung_renderer_delay_ms_ = timeout.InMilliseconds(); | 125 hung_renderer_delay_ms_ = timeout.InMilliseconds(); |
126 } | 126 } |
127 | 127 |
128 // RenderWidgetHost implementation. | 128 // RenderWidgetHost implementation. |
129 virtual void UpdateTextDirection(blink::WebTextDirection direction) OVERRIDE; | 129 virtual void UpdateTextDirection(blink::WebTextDirection direction) override; |
130 virtual void NotifyTextDirection() OVERRIDE; | 130 virtual void NotifyTextDirection() override; |
131 virtual void Focus() OVERRIDE; | 131 virtual void Focus() override; |
132 virtual void Blur() OVERRIDE; | 132 virtual void Blur() override; |
133 virtual void SetActive(bool active) OVERRIDE; | 133 virtual void SetActive(bool active) override; |
134 virtual void CopyFromBackingStore( | 134 virtual void CopyFromBackingStore( |
135 const gfx::Rect& src_rect, | 135 const gfx::Rect& src_rect, |
136 const gfx::Size& accelerated_dst_size, | 136 const gfx::Size& accelerated_dst_size, |
137 const base::Callback<void(bool, const SkBitmap&)>& callback, | 137 const base::Callback<void(bool, const SkBitmap&)>& callback, |
138 const SkColorType color_type) OVERRIDE; | 138 const SkColorType color_type) override; |
139 virtual bool CanCopyFromBackingStore() OVERRIDE; | 139 virtual bool CanCopyFromBackingStore() override; |
140 #if defined(OS_ANDROID) | 140 #if defined(OS_ANDROID) |
141 virtual void LockBackingStore() OVERRIDE; | 141 virtual void LockBackingStore() override; |
142 virtual void UnlockBackingStore() OVERRIDE; | 142 virtual void UnlockBackingStore() override; |
143 #endif | 143 #endif |
144 virtual void ForwardMouseEvent( | 144 virtual void ForwardMouseEvent( |
145 const blink::WebMouseEvent& mouse_event) OVERRIDE; | 145 const blink::WebMouseEvent& mouse_event) override; |
146 virtual void ForwardWheelEvent( | 146 virtual void ForwardWheelEvent( |
147 const blink::WebMouseWheelEvent& wheel_event) OVERRIDE; | 147 const blink::WebMouseWheelEvent& wheel_event) override; |
148 virtual void ForwardKeyboardEvent( | 148 virtual void ForwardKeyboardEvent( |
149 const NativeWebKeyboardEvent& key_event) OVERRIDE; | 149 const NativeWebKeyboardEvent& key_event) override; |
150 virtual RenderProcessHost* GetProcess() const OVERRIDE; | 150 virtual RenderProcessHost* GetProcess() const override; |
151 virtual int GetRoutingID() const OVERRIDE; | 151 virtual int GetRoutingID() const override; |
152 virtual RenderWidgetHostView* GetView() const OVERRIDE; | 152 virtual RenderWidgetHostView* GetView() const override; |
153 virtual bool IsLoading() const OVERRIDE; | 153 virtual bool IsLoading() const override; |
154 virtual bool IsRenderView() const OVERRIDE; | 154 virtual bool IsRenderView() const override; |
155 virtual void ResizeRectChanged(const gfx::Rect& new_rect) OVERRIDE; | 155 virtual void ResizeRectChanged(const gfx::Rect& new_rect) override; |
156 virtual void RestartHangMonitorTimeout() OVERRIDE; | 156 virtual void RestartHangMonitorTimeout() override; |
157 virtual void SetIgnoreInputEvents(bool ignore_input_events) OVERRIDE; | 157 virtual void SetIgnoreInputEvents(bool ignore_input_events) override; |
158 virtual void WasResized() OVERRIDE; | 158 virtual void WasResized() override; |
159 virtual void AddKeyPressEventCallback( | 159 virtual void AddKeyPressEventCallback( |
160 const KeyPressEventCallback& callback) OVERRIDE; | 160 const KeyPressEventCallback& callback) override; |
161 virtual void RemoveKeyPressEventCallback( | 161 virtual void RemoveKeyPressEventCallback( |
162 const KeyPressEventCallback& callback) OVERRIDE; | 162 const KeyPressEventCallback& callback) override; |
163 virtual void AddMouseEventCallback( | 163 virtual void AddMouseEventCallback( |
164 const MouseEventCallback& callback) OVERRIDE; | 164 const MouseEventCallback& callback) override; |
165 virtual void RemoveMouseEventCallback( | 165 virtual void RemoveMouseEventCallback( |
166 const MouseEventCallback& callback) OVERRIDE; | 166 const MouseEventCallback& callback) override; |
167 virtual void GetWebScreenInfo(blink::WebScreenInfo* result) OVERRIDE; | 167 virtual void GetWebScreenInfo(blink::WebScreenInfo* result) override; |
168 | 168 |
169 virtual SkColorType PreferredReadbackFormat() OVERRIDE; | 169 virtual SkColorType PreferredReadbackFormat() override; |
170 | 170 |
171 // Forces redraw in the renderer and when the update reaches the browser | 171 // Forces redraw in the renderer and when the update reaches the browser |
172 // grabs snapshot from the compositor. Returns PNG-encoded snapshot. | 172 // grabs snapshot from the compositor. Returns PNG-encoded snapshot. |
173 void GetSnapshotFromBrowser( | 173 void GetSnapshotFromBrowser( |
174 const base::Callback<void(const unsigned char*,size_t)> callback); | 174 const base::Callback<void(const unsigned char*,size_t)> callback); |
175 | 175 |
176 const NativeWebKeyboardEvent* GetLastKeyboardEvent() const; | 176 const NativeWebKeyboardEvent* GetLastKeyboardEvent() const; |
177 | 177 |
178 // Notification that the screen info has changed. | 178 // Notification that the screen info has changed. |
179 void NotifyScreenInfoChanged(); | 179 void NotifyScreenInfoChanged(); |
(...skipping 12 matching lines...) Expand all Loading... |
192 | 192 |
193 // Called when a renderer object already been created for this host, and we | 193 // Called when a renderer object already been created for this host, and we |
194 // just need to be attached to it. Used for window.open, <select> dropdown | 194 // just need to be attached to it. Used for window.open, <select> dropdown |
195 // menus, and other times when the renderer initiates creating an object. | 195 // menus, and other times when the renderer initiates creating an object. |
196 virtual void Init(); | 196 virtual void Init(); |
197 | 197 |
198 // Tells the renderer to die and then calls Destroy(). | 198 // Tells the renderer to die and then calls Destroy(). |
199 virtual void Shutdown(); | 199 virtual void Shutdown(); |
200 | 200 |
201 // IPC::Listener | 201 // IPC::Listener |
202 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 202 virtual bool OnMessageReceived(const IPC::Message& msg) override; |
203 | 203 |
204 // Sends a message to the corresponding object in the renderer. | 204 // Sends a message to the corresponding object in the renderer. |
205 virtual bool Send(IPC::Message* msg) OVERRIDE; | 205 virtual bool Send(IPC::Message* msg) override; |
206 | 206 |
207 // Indicates if the page has finished loading. | 207 // Indicates if the page has finished loading. |
208 virtual void SetIsLoading(bool is_loading); | 208 virtual void SetIsLoading(bool is_loading); |
209 | 209 |
210 // Called to notify the RenderWidget that it has been hidden or restored from | 210 // Called to notify the RenderWidget that it has been hidden or restored from |
211 // having been hidden. | 211 // having been hidden. |
212 virtual void WasHidden(); | 212 virtual void WasHidden(); |
213 virtual void WasShown(const ui::LatencyInfo& latency_info); | 213 virtual void WasShown(const ui::LatencyInfo& latency_info); |
214 | 214 |
215 // Returns true if the RenderWidget is hidden. | 215 // Returns true if the RenderWidget is hidden. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 const ui::LatencyInfo& ui_latency); | 272 const ui::LatencyInfo& ui_latency); |
273 void ForwardWheelEventWithLatencyInfo( | 273 void ForwardWheelEventWithLatencyInfo( |
274 const blink::WebMouseWheelEvent& wheel_event, | 274 const blink::WebMouseWheelEvent& wheel_event, |
275 const ui::LatencyInfo& ui_latency); | 275 const ui::LatencyInfo& ui_latency); |
276 | 276 |
277 // Enables/disables touch emulation using mouse event. See TouchEmulator. | 277 // Enables/disables touch emulation using mouse event. See TouchEmulator. |
278 void SetTouchEventEmulationEnabled(bool enabled); | 278 void SetTouchEventEmulationEnabled(bool enabled); |
279 | 279 |
280 // TouchEmulatorClient implementation. | 280 // TouchEmulatorClient implementation. |
281 virtual void ForwardGestureEvent( | 281 virtual void ForwardGestureEvent( |
282 const blink::WebGestureEvent& gesture_event) OVERRIDE; | 282 const blink::WebGestureEvent& gesture_event) override; |
283 virtual void ForwardEmulatedTouchEvent( | 283 virtual void ForwardEmulatedTouchEvent( |
284 const blink::WebTouchEvent& touch_event) OVERRIDE; | 284 const blink::WebTouchEvent& touch_event) override; |
285 virtual void SetCursor(const WebCursor& cursor) OVERRIDE; | 285 virtual void SetCursor(const WebCursor& cursor) override; |
286 virtual void ShowContextMenuAtPoint(const gfx::Point& point) OVERRIDE; | 286 virtual void ShowContextMenuAtPoint(const gfx::Point& point) override; |
287 | 287 |
288 // Queues a synthetic gesture for testing purposes. Invokes the on_complete | 288 // Queues a synthetic gesture for testing purposes. Invokes the on_complete |
289 // callback when the gesture is finished running. | 289 // callback when the gesture is finished running. |
290 void QueueSyntheticGesture( | 290 void QueueSyntheticGesture( |
291 scoped_ptr<SyntheticGesture> synthetic_gesture, | 291 scoped_ptr<SyntheticGesture> synthetic_gesture, |
292 const base::Callback<void(SyntheticGesture::Result)>& on_complete); | 292 const base::Callback<void(SyntheticGesture::Result)>& on_complete); |
293 | 293 |
294 void CancelUpdateTextDirection(); | 294 void CancelUpdateTextDirection(); |
295 | 295 |
296 // Called when a mouse click/gesture tap activates the renderer. | 296 // Called when a mouse click/gesture tap activates the renderer. |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 void SendScreenRects(); | 430 void SendScreenRects(); |
431 | 431 |
432 // Suppreses future char events until a keydown. See | 432 // Suppreses future char events until a keydown. See |
433 // suppress_next_char_events_. | 433 // suppress_next_char_events_. |
434 void SuppressNextCharEvents(); | 434 void SuppressNextCharEvents(); |
435 | 435 |
436 // Called by RenderWidgetHostView in response to OnSetNeedsFlushInput. | 436 // Called by RenderWidgetHostView in response to OnSetNeedsFlushInput. |
437 void FlushInput(); | 437 void FlushInput(); |
438 | 438 |
439 // InputRouterClient | 439 // InputRouterClient |
440 virtual void SetNeedsFlush() OVERRIDE; | 440 virtual void SetNeedsFlush() override; |
441 | 441 |
442 // Indicates whether the renderer drives the RenderWidgetHosts's size or the | 442 // Indicates whether the renderer drives the RenderWidgetHosts's size or the |
443 // other way around. | 443 // other way around. |
444 bool should_auto_resize() { return should_auto_resize_; } | 444 bool should_auto_resize() { return should_auto_resize_; } |
445 | 445 |
446 void ComputeTouchLatency(const ui::LatencyInfo& latency_info); | 446 void ComputeTouchLatency(const ui::LatencyInfo& latency_info); |
447 void FrameSwapped(const ui::LatencyInfo& latency_info); | 447 void FrameSwapped(const ui::LatencyInfo& latency_info); |
448 void DidReceiveRendererFrame(); | 448 void DidReceiveRendererFrame(); |
449 | 449 |
450 // Returns the ID that uniquely describes this component to the latency | 450 // Returns the ID that uniquely describes this component to the latency |
(...skipping 26 matching lines...) Expand all Loading... |
477 // or create it if it doesn't already exist. | 477 // or create it if it doesn't already exist. |
478 BrowserAccessibilityManager* GetOrCreateRootBrowserAccessibilityManager(); | 478 BrowserAccessibilityManager* GetOrCreateRootBrowserAccessibilityManager(); |
479 | 479 |
480 base::TimeDelta GetEstimatedBrowserCompositeTime(); | 480 base::TimeDelta GetEstimatedBrowserCompositeTime(); |
481 | 481 |
482 #if defined(OS_WIN) | 482 #if defined(OS_WIN) |
483 gfx::NativeViewAccessible GetParentNativeViewAccessible(); | 483 gfx::NativeViewAccessible GetParentNativeViewAccessible(); |
484 #endif | 484 #endif |
485 | 485 |
486 protected: | 486 protected: |
487 virtual RenderWidgetHostImpl* AsRenderWidgetHostImpl() OVERRIDE; | 487 virtual RenderWidgetHostImpl* AsRenderWidgetHostImpl() override; |
488 | 488 |
489 // Create a LatencyInfo struct with INPUT_EVENT_LATENCY_RWH_COMPONENT | 489 // Create a LatencyInfo struct with INPUT_EVENT_LATENCY_RWH_COMPONENT |
490 // component if it is not already in |original|. And if |original| is | 490 // component if it is not already in |original|. And if |original| is |
491 // not NULL, it is also merged into the resulting LatencyInfo. | 491 // not NULL, it is also merged into the resulting LatencyInfo. |
492 ui::LatencyInfo CreateRWHLatencyInfoIfNotExist( | 492 ui::LatencyInfo CreateRWHLatencyInfoIfNotExist( |
493 const ui::LatencyInfo* original, | 493 const ui::LatencyInfo* original, |
494 blink::WebInputEvent::Type type, | 494 blink::WebInputEvent::Type type, |
495 const ui::LatencyInfo::InputCoordinate* logical_coordinates, | 495 const ui::LatencyInfo::InputCoordinate* logical_coordinates, |
496 size_t logical_coordinates_size); | 496 size_t logical_coordinates_size); |
497 | 497 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 void DidUpdateBackingStore(const ViewHostMsg_UpdateRect_Params& params, | 637 void DidUpdateBackingStore(const ViewHostMsg_UpdateRect_Params& params, |
638 const base::TimeTicks& paint_start); | 638 const base::TimeTicks& paint_start); |
639 | 639 |
640 // Give key press listeners a chance to handle this key press. This allow | 640 // Give key press listeners a chance to handle this key press. This allow |
641 // widgets that don't have focus to still handle key presses. | 641 // widgets that don't have focus to still handle key presses. |
642 bool KeyPressListenersHandleEvent(const NativeWebKeyboardEvent& event); | 642 bool KeyPressListenersHandleEvent(const NativeWebKeyboardEvent& event); |
643 | 643 |
644 // InputRouterClient | 644 // InputRouterClient |
645 virtual InputEventAckState FilterInputEvent( | 645 virtual InputEventAckState FilterInputEvent( |
646 const blink::WebInputEvent& event, | 646 const blink::WebInputEvent& event, |
647 const ui::LatencyInfo& latency_info) OVERRIDE; | 647 const ui::LatencyInfo& latency_info) override; |
648 virtual void IncrementInFlightEventCount() OVERRIDE; | 648 virtual void IncrementInFlightEventCount() override; |
649 virtual void DecrementInFlightEventCount() OVERRIDE; | 649 virtual void DecrementInFlightEventCount() override; |
650 virtual void OnHasTouchEventHandlers(bool has_handlers) OVERRIDE; | 650 virtual void OnHasTouchEventHandlers(bool has_handlers) override; |
651 virtual void DidFlush() OVERRIDE; | 651 virtual void DidFlush() override; |
652 virtual void DidOverscroll(const DidOverscrollParams& params) OVERRIDE; | 652 virtual void DidOverscroll(const DidOverscrollParams& params) override; |
653 | 653 |
654 // InputAckHandler | 654 // InputAckHandler |
655 virtual void OnKeyboardEventAck(const NativeWebKeyboardEvent& event, | 655 virtual void OnKeyboardEventAck(const NativeWebKeyboardEvent& event, |
656 InputEventAckState ack_result) OVERRIDE; | 656 InputEventAckState ack_result) override; |
657 virtual void OnWheelEventAck(const MouseWheelEventWithLatencyInfo& event, | 657 virtual void OnWheelEventAck(const MouseWheelEventWithLatencyInfo& event, |
658 InputEventAckState ack_result) OVERRIDE; | 658 InputEventAckState ack_result) override; |
659 virtual void OnTouchEventAck(const TouchEventWithLatencyInfo& event, | 659 virtual void OnTouchEventAck(const TouchEventWithLatencyInfo& event, |
660 InputEventAckState ack_result) OVERRIDE; | 660 InputEventAckState ack_result) override; |
661 virtual void OnGestureEventAck(const GestureEventWithLatencyInfo& event, | 661 virtual void OnGestureEventAck(const GestureEventWithLatencyInfo& event, |
662 InputEventAckState ack_result) OVERRIDE; | 662 InputEventAckState ack_result) override; |
663 virtual void OnUnexpectedEventAck(UnexpectedEventAckType type) OVERRIDE; | 663 virtual void OnUnexpectedEventAck(UnexpectedEventAckType type) override; |
664 | 664 |
665 void OnSyntheticGestureCompleted(SyntheticGesture::Result result); | 665 void OnSyntheticGestureCompleted(SyntheticGesture::Result result); |
666 | 666 |
667 // Called when there is a new auto resize (using a post to avoid a stack | 667 // Called when there is a new auto resize (using a post to avoid a stack |
668 // which may get in recursive loops). | 668 // which may get in recursive loops). |
669 void DelayedAutoResized(); | 669 void DelayedAutoResized(); |
670 | 670 |
671 void WindowOldSnapshotReachedScreen(int snapshot_id); | 671 void WindowOldSnapshotReachedScreen(int snapshot_id); |
672 | 672 |
673 void WindowSnapshotReachedScreen(int snapshot_id); | 673 void WindowSnapshotReachedScreen(int snapshot_id); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 cc::RollingTimeDeltaHistory browser_composite_latency_history_; | 846 cc::RollingTimeDeltaHistory browser_composite_latency_history_; |
847 | 847 |
848 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_; | 848 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_; |
849 | 849 |
850 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); | 850 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); |
851 }; | 851 }; |
852 | 852 |
853 } // namespace content | 853 } // namespace content |
854 | 854 |
855 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ | 855 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ |
OLD | NEW |