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

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

Issue 667943003: Standardize usage of virtual/override/final in content/browser/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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 <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 public IPC::Listener { 99 public IPC::Listener {
100 public: 100 public:
101 // routing_id can be MSG_ROUTING_NONE, in which case the next available 101 // routing_id can be MSG_ROUTING_NONE, in which case the next available
102 // routing id is taken from the RenderProcessHost. 102 // routing id is taken from the RenderProcessHost.
103 // If this object outlives |delegate|, DetachDelegate() must be called when 103 // If this object outlives |delegate|, DetachDelegate() must be called when
104 // |delegate| goes away. 104 // |delegate| goes away.
105 RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate, 105 RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate,
106 RenderProcessHost* process, 106 RenderProcessHost* process,
107 int routing_id, 107 int routing_id,
108 bool hidden); 108 bool hidden);
109 virtual ~RenderWidgetHostImpl(); 109 ~RenderWidgetHostImpl() override;
110 110
111 // Similar to RenderWidgetHost::FromID, but returning the Impl object. 111 // Similar to RenderWidgetHost::FromID, but returning the Impl object.
112 static RenderWidgetHostImpl* FromID(int32 process_id, int32 routing_id); 112 static RenderWidgetHostImpl* FromID(int32 process_id, int32 routing_id);
113 113
114 // Returns all RenderWidgetHosts including swapped out ones for 114 // Returns all RenderWidgetHosts including swapped out ones for
115 // internal use. The public interface 115 // internal use. The public interface
116 // RendgerWidgetHost::GetRenderWidgetHosts only returns active ones. 116 // RendgerWidgetHost::GetRenderWidgetHosts only returns active ones.
117 static scoped_ptr<RenderWidgetHostIterator> GetAllRenderWidgetHosts(); 117 static scoped_ptr<RenderWidgetHostIterator> GetAllRenderWidgetHosts();
118 118
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 void UpdateTextDirection(blink::WebTextDirection direction) override;
130 virtual void NotifyTextDirection() override; 130 void NotifyTextDirection() override;
131 virtual void Focus() override; 131 void Focus() override;
132 virtual void Blur() override; 132 void Blur() override;
133 virtual void SetActive(bool active) override; 133 void SetActive(bool active) override;
134 virtual void CopyFromBackingStore( 134 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 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 void ForwardMouseEvent(const blink::WebMouseEvent& mouse_event) override;
145 const blink::WebMouseEvent& mouse_event) override; 145 void ForwardWheelEvent(const blink::WebMouseWheelEvent& wheel_event) override;
146 virtual void ForwardWheelEvent( 146 void ForwardKeyboardEvent(const NativeWebKeyboardEvent& key_event) override;
147 const blink::WebMouseWheelEvent& wheel_event) override; 147 RenderProcessHost* GetProcess() const override;
148 virtual void ForwardKeyboardEvent( 148 int GetRoutingID() const override;
149 const NativeWebKeyboardEvent& key_event) override; 149 RenderWidgetHostView* GetView() const override;
150 virtual RenderProcessHost* GetProcess() const override; 150 bool IsLoading() const override;
151 virtual int GetRoutingID() const override; 151 bool IsRenderView() const override;
152 virtual RenderWidgetHostView* GetView() const override; 152 void ResizeRectChanged(const gfx::Rect& new_rect) override;
153 virtual bool IsLoading() const override; 153 void RestartHangMonitorTimeout() override;
154 virtual bool IsRenderView() const override; 154 void SetIgnoreInputEvents(bool ignore_input_events) override;
155 virtual void ResizeRectChanged(const gfx::Rect& new_rect) override; 155 void WasResized() override;
156 virtual void RestartHangMonitorTimeout() override; 156 void AddKeyPressEventCallback(const KeyPressEventCallback& callback) override;
157 virtual void SetIgnoreInputEvents(bool ignore_input_events) override; 157 void RemoveKeyPressEventCallback(
158 virtual void WasResized() override;
159 virtual void AddKeyPressEventCallback(
160 const KeyPressEventCallback& callback) override; 158 const KeyPressEventCallback& callback) override;
161 virtual void RemoveKeyPressEventCallback( 159 void AddMouseEventCallback(const MouseEventCallback& callback) override;
162 const KeyPressEventCallback& callback) override; 160 void RemoveMouseEventCallback(const MouseEventCallback& callback) override;
163 virtual void AddMouseEventCallback( 161 void GetWebScreenInfo(blink::WebScreenInfo* result) override;
164 const MouseEventCallback& callback) override;
165 virtual void RemoveMouseEventCallback(
166 const MouseEventCallback& callback) override;
167 virtual void GetWebScreenInfo(blink::WebScreenInfo* result) override;
168 162
169 virtual SkColorType PreferredReadbackFormat() override; 163 SkColorType PreferredReadbackFormat() override;
170 164
171 // Forces redraw in the renderer and when the update reaches the browser 165 // Forces redraw in the renderer and when the update reaches the browser
172 // grabs snapshot from the compositor. Returns PNG-encoded snapshot. 166 // grabs snapshot from the compositor. Returns PNG-encoded snapshot.
173 void GetSnapshotFromBrowser( 167 void GetSnapshotFromBrowser(
174 const base::Callback<void(const unsigned char*,size_t)> callback); 168 const base::Callback<void(const unsigned char*,size_t)> callback);
175 169
176 const NativeWebKeyboardEvent* GetLastKeyboardEvent() const; 170 const NativeWebKeyboardEvent* GetLastKeyboardEvent() const;
177 171
178 // Notification that the screen info has changed. 172 // Notification that the screen info has changed.
179 void NotifyScreenInfoChanged(); 173 void NotifyScreenInfoChanged();
(...skipping 12 matching lines...) Expand all
192 186
193 // Called when a renderer object already been created for this host, and we 187 // 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 188 // 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. 189 // menus, and other times when the renderer initiates creating an object.
196 virtual void Init(); 190 virtual void Init();
197 191
198 // Tells the renderer to die and then calls Destroy(). 192 // Tells the renderer to die and then calls Destroy().
199 virtual void Shutdown(); 193 virtual void Shutdown();
200 194
201 // IPC::Listener 195 // IPC::Listener
202 virtual bool OnMessageReceived(const IPC::Message& msg) override; 196 bool OnMessageReceived(const IPC::Message& msg) override;
203 197
204 // Sends a message to the corresponding object in the renderer. 198 // Sends a message to the corresponding object in the renderer.
205 virtual bool Send(IPC::Message* msg) override; 199 bool Send(IPC::Message* msg) override;
206 200
207 // Indicates if the page has finished loading. 201 // Indicates if the page has finished loading.
208 virtual void SetIsLoading(bool is_loading); 202 virtual void SetIsLoading(bool is_loading);
209 203
210 // Called to notify the RenderWidget that it has been hidden or restored from 204 // Called to notify the RenderWidget that it has been hidden or restored from
211 // having been hidden. 205 // having been hidden.
212 virtual void WasHidden(); 206 virtual void WasHidden();
213 virtual void WasShown(const ui::LatencyInfo& latency_info); 207 virtual void WasShown(const ui::LatencyInfo& latency_info);
214 208
215 // Returns true if the RenderWidget is hidden. 209 // Returns true if the RenderWidget is hidden.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 const blink::WebMouseEvent& mouse_event, 265 const blink::WebMouseEvent& mouse_event,
272 const ui::LatencyInfo& ui_latency); 266 const ui::LatencyInfo& ui_latency);
273 void ForwardWheelEventWithLatencyInfo( 267 void ForwardWheelEventWithLatencyInfo(
274 const blink::WebMouseWheelEvent& wheel_event, 268 const blink::WebMouseWheelEvent& wheel_event,
275 const ui::LatencyInfo& ui_latency); 269 const ui::LatencyInfo& ui_latency);
276 270
277 // Enables/disables touch emulation using mouse event. See TouchEmulator. 271 // Enables/disables touch emulation using mouse event. See TouchEmulator.
278 void SetTouchEventEmulationEnabled(bool enabled); 272 void SetTouchEventEmulationEnabled(bool enabled);
279 273
280 // TouchEmulatorClient implementation. 274 // TouchEmulatorClient implementation.
281 virtual void ForwardGestureEvent( 275 void ForwardGestureEvent(
282 const blink::WebGestureEvent& gesture_event) override; 276 const blink::WebGestureEvent& gesture_event) override;
283 virtual void ForwardEmulatedTouchEvent( 277 void ForwardEmulatedTouchEvent(
284 const blink::WebTouchEvent& touch_event) override; 278 const blink::WebTouchEvent& touch_event) override;
285 virtual void SetCursor(const WebCursor& cursor) override; 279 void SetCursor(const WebCursor& cursor) override;
286 virtual void ShowContextMenuAtPoint(const gfx::Point& point) override; 280 void ShowContextMenuAtPoint(const gfx::Point& point) override;
287 281
288 // Queues a synthetic gesture for testing purposes. Invokes the on_complete 282 // Queues a synthetic gesture for testing purposes. Invokes the on_complete
289 // callback when the gesture is finished running. 283 // callback when the gesture is finished running.
290 void QueueSyntheticGesture( 284 void QueueSyntheticGesture(
291 scoped_ptr<SyntheticGesture> synthetic_gesture, 285 scoped_ptr<SyntheticGesture> synthetic_gesture,
292 const base::Callback<void(SyntheticGesture::Result)>& on_complete); 286 const base::Callback<void(SyntheticGesture::Result)>& on_complete);
293 287
294 void CancelUpdateTextDirection(); 288 void CancelUpdateTextDirection();
295 289
296 // Called when a mouse click/gesture tap activates the renderer. 290 // Called when a mouse click/gesture tap activates the renderer.
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 void SendScreenRects(); 424 void SendScreenRects();
431 425
432 // Suppreses future char events until a keydown. See 426 // Suppreses future char events until a keydown. See
433 // suppress_next_char_events_. 427 // suppress_next_char_events_.
434 void SuppressNextCharEvents(); 428 void SuppressNextCharEvents();
435 429
436 // Called by RenderWidgetHostView in response to OnSetNeedsFlushInput. 430 // Called by RenderWidgetHostView in response to OnSetNeedsFlushInput.
437 void FlushInput(); 431 void FlushInput();
438 432
439 // InputRouterClient 433 // InputRouterClient
440 virtual void SetNeedsFlush() override; 434 void SetNeedsFlush() override;
441 435
442 // Indicates whether the renderer drives the RenderWidgetHosts's size or the 436 // Indicates whether the renderer drives the RenderWidgetHosts's size or the
443 // other way around. 437 // other way around.
444 bool should_auto_resize() { return should_auto_resize_; } 438 bool should_auto_resize() { return should_auto_resize_; }
445 439
446 void ComputeTouchLatency(const ui::LatencyInfo& latency_info); 440 void ComputeTouchLatency(const ui::LatencyInfo& latency_info);
447 void FrameSwapped(const ui::LatencyInfo& latency_info); 441 void FrameSwapped(const ui::LatencyInfo& latency_info);
448 void DidReceiveRendererFrame(); 442 void DidReceiveRendererFrame();
449 443
450 // Returns the ID that uniquely describes this component to the latency 444 // Returns the ID that uniquely describes this component to the latency
(...skipping 26 matching lines...) Expand all
477 // or create it if it doesn't already exist. 471 // or create it if it doesn't already exist.
478 BrowserAccessibilityManager* GetOrCreateRootBrowserAccessibilityManager(); 472 BrowserAccessibilityManager* GetOrCreateRootBrowserAccessibilityManager();
479 473
480 base::TimeDelta GetEstimatedBrowserCompositeTime(); 474 base::TimeDelta GetEstimatedBrowserCompositeTime();
481 475
482 #if defined(OS_WIN) 476 #if defined(OS_WIN)
483 gfx::NativeViewAccessible GetParentNativeViewAccessible(); 477 gfx::NativeViewAccessible GetParentNativeViewAccessible();
484 #endif 478 #endif
485 479
486 protected: 480 protected:
487 virtual RenderWidgetHostImpl* AsRenderWidgetHostImpl() override; 481 RenderWidgetHostImpl* AsRenderWidgetHostImpl() override;
488 482
489 // Create a LatencyInfo struct with INPUT_EVENT_LATENCY_RWH_COMPONENT 483 // Create a LatencyInfo struct with INPUT_EVENT_LATENCY_RWH_COMPONENT
490 // component if it is not already in |original|. And if |original| is 484 // component if it is not already in |original|. And if |original| is
491 // not NULL, it is also merged into the resulting LatencyInfo. 485 // not NULL, it is also merged into the resulting LatencyInfo.
492 ui::LatencyInfo CreateRWHLatencyInfoIfNotExist( 486 ui::LatencyInfo CreateRWHLatencyInfoIfNotExist(
493 const ui::LatencyInfo* original, 487 const ui::LatencyInfo* original,
494 blink::WebInputEvent::Type type, 488 blink::WebInputEvent::Type type,
495 const ui::LatencyInfo::InputCoordinate* logical_coordinates, 489 const ui::LatencyInfo::InputCoordinate* logical_coordinates,
496 size_t logical_coordinates_size); 490 size_t logical_coordinates_size);
497 491
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 // BackingStore and can send an ACK to the renderer so it can paint onto it 630 // BackingStore and can send an ACK to the renderer so it can paint onto it
637 // again. 631 // again.
638 void DidUpdateBackingStore(const ViewHostMsg_UpdateRect_Params& params, 632 void DidUpdateBackingStore(const ViewHostMsg_UpdateRect_Params& params,
639 const base::TimeTicks& paint_start); 633 const base::TimeTicks& paint_start);
640 634
641 // Give key press listeners a chance to handle this key press. This allow 635 // Give key press listeners a chance to handle this key press. This allow
642 // widgets that don't have focus to still handle key presses. 636 // widgets that don't have focus to still handle key presses.
643 bool KeyPressListenersHandleEvent(const NativeWebKeyboardEvent& event); 637 bool KeyPressListenersHandleEvent(const NativeWebKeyboardEvent& event);
644 638
645 // InputRouterClient 639 // InputRouterClient
646 virtual InputEventAckState FilterInputEvent( 640 InputEventAckState FilterInputEvent(
647 const blink::WebInputEvent& event, 641 const blink::WebInputEvent& event,
648 const ui::LatencyInfo& latency_info) override; 642 const ui::LatencyInfo& latency_info) override;
649 virtual void IncrementInFlightEventCount() override; 643 void IncrementInFlightEventCount() override;
650 virtual void DecrementInFlightEventCount() override; 644 void DecrementInFlightEventCount() override;
651 virtual void OnHasTouchEventHandlers(bool has_handlers) override; 645 void OnHasTouchEventHandlers(bool has_handlers) override;
652 virtual void DidFlush() override; 646 void DidFlush() override;
653 virtual void DidOverscroll(const DidOverscrollParams& params) override; 647 void DidOverscroll(const DidOverscrollParams& params) override;
654 648
655 // InputAckHandler 649 // InputAckHandler
656 virtual void OnKeyboardEventAck(const NativeWebKeyboardEvent& event, 650 void OnKeyboardEventAck(const NativeWebKeyboardEvent& event,
657 InputEventAckState ack_result) override; 651 InputEventAckState ack_result) override;
658 virtual void OnWheelEventAck(const MouseWheelEventWithLatencyInfo& event, 652 void OnWheelEventAck(const MouseWheelEventWithLatencyInfo& event,
659 InputEventAckState ack_result) override; 653 InputEventAckState ack_result) override;
660 virtual void OnTouchEventAck(const TouchEventWithLatencyInfo& event, 654 void OnTouchEventAck(const TouchEventWithLatencyInfo& event,
661 InputEventAckState ack_result) override; 655 InputEventAckState ack_result) override;
662 virtual void OnGestureEventAck(const GestureEventWithLatencyInfo& event, 656 void OnGestureEventAck(const GestureEventWithLatencyInfo& event,
663 InputEventAckState ack_result) override; 657 InputEventAckState ack_result) override;
664 virtual void OnUnexpectedEventAck(UnexpectedEventAckType type) override; 658 void OnUnexpectedEventAck(UnexpectedEventAckType type) override;
665 659
666 void OnSyntheticGestureCompleted(SyntheticGesture::Result result); 660 void OnSyntheticGestureCompleted(SyntheticGesture::Result result);
667 661
668 // Called when there is a new auto resize (using a post to avoid a stack 662 // Called when there is a new auto resize (using a post to avoid a stack
669 // which may get in recursive loops). 663 // which may get in recursive loops).
670 void DelayedAutoResized(); 664 void DelayedAutoResized();
671 665
672 void WindowOldSnapshotReachedScreen(int snapshot_id); 666 void WindowOldSnapshotReachedScreen(int snapshot_id);
673 667
674 void WindowSnapshotReachedScreen(int snapshot_id); 668 void WindowSnapshotReachedScreen(int snapshot_id);
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 cc::RollingTimeDeltaHistory browser_composite_latency_history_; 841 cc::RollingTimeDeltaHistory browser_composite_latency_history_;
848 842
849 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_; 843 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_;
850 844
851 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); 845 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl);
852 }; 846 };
853 847
854 } // namespace content 848 } // namespace content
855 849
856 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ 850 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698