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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 void ResizeRectChanged(const gfx::Rect& new_rect) override; | 162 void ResizeRectChanged(const gfx::Rect& new_rect) override; |
163 void RestartHangMonitorTimeout() override; | 163 void RestartHangMonitorTimeout() override; |
164 void DisableHangMonitorForTesting() override; | 164 void DisableHangMonitorForTesting() override; |
165 void SetIgnoreInputEvents(bool ignore_input_events) override; | 165 void SetIgnoreInputEvents(bool ignore_input_events) override; |
166 void WasResized() override; | 166 void WasResized() override; |
167 void AddKeyPressEventCallback(const KeyPressEventCallback& callback) override; | 167 void AddKeyPressEventCallback(const KeyPressEventCallback& callback) override; |
168 void RemoveKeyPressEventCallback( | 168 void RemoveKeyPressEventCallback( |
169 const KeyPressEventCallback& callback) override; | 169 const KeyPressEventCallback& callback) override; |
170 void AddMouseEventCallback(const MouseEventCallback& callback) override; | 170 void AddMouseEventCallback(const MouseEventCallback& callback) override; |
171 void RemoveMouseEventCallback(const MouseEventCallback& callback) override; | 171 void RemoveMouseEventCallback(const MouseEventCallback& callback) override; |
| 172 void AddInputEventObserver( |
| 173 RenderWidgetHost::InputEventObserver* observer) override; |
| 174 void RemoveInputEventObserver( |
| 175 RenderWidgetHost::InputEventObserver* observer) override; |
172 void GetWebScreenInfo(blink::WebScreenInfo* result) override; | 176 void GetWebScreenInfo(blink::WebScreenInfo* result) override; |
173 bool GetScreenColorProfile(std::vector<char>* color_profile) override; | 177 bool GetScreenColorProfile(std::vector<char>* color_profile) override; |
174 void HandleCompositorProto(const std::vector<uint8_t>& proto) override; | 178 void HandleCompositorProto(const std::vector<uint8_t>& proto) override; |
175 | 179 |
176 // Notification that the screen info has changed. | 180 // Notification that the screen info has changed. |
177 void NotifyScreenInfoChanged(); | 181 void NotifyScreenInfoChanged(); |
178 | 182 |
179 // Forces redraw in the renderer and when the update reaches the browser | 183 // Forces redraw in the renderer and when the update reaches the browser |
180 // grabs snapshot from the compositor. Returns PNG-encoded snapshot. | 184 // grabs snapshot from the compositor. Returns PNG-encoded snapshot. |
181 using GetSnapshotFromBrowserCallback = | 185 using GetSnapshotFromBrowserCallback = |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 // a page load. This stops |new_content_rendering_timeout_|, or prevents | 293 // a page load. This stops |new_content_rendering_timeout_|, or prevents |
290 // the timer from running if the load commit message hasn't been received | 294 // the timer from running if the load commit message hasn't been received |
291 // yet. | 295 // yet. |
292 void OnFirstPaintAfterLoad(); | 296 void OnFirstPaintAfterLoad(); |
293 | 297 |
294 // Forwards the given message to the renderer. These are called by the view | 298 // Forwards the given message to the renderer. These are called by the view |
295 // when it has received a message. | 299 // when it has received a message. |
296 void ForwardGestureEventWithLatencyInfo( | 300 void ForwardGestureEventWithLatencyInfo( |
297 const blink::WebGestureEvent& gesture_event, | 301 const blink::WebGestureEvent& gesture_event, |
298 const ui::LatencyInfo& ui_latency) override; | 302 const ui::LatencyInfo& ui_latency) override; |
299 void ForwardTouchEventWithLatencyInfo( | 303 void ForwardTouchEventWithLatencyInfo(const blink::WebTouchEvent& touch_event, |
300 const blink::WebTouchEvent& touch_event, | 304 const ui::LatencyInfo& ui_latency); |
301 const ui::LatencyInfo& ui_latency); | 305 void ForwardMouseEventWithLatencyInfo(const blink::WebMouseEvent& mouse_event, |
302 void ForwardMouseEventWithLatencyInfo( | 306 const ui::LatencyInfo& ui_latency); |
303 const blink::WebMouseEvent& mouse_event, | |
304 const ui::LatencyInfo& ui_latency); | |
305 virtual void ForwardWheelEventWithLatencyInfo( | 307 virtual void ForwardWheelEventWithLatencyInfo( |
306 const blink::WebMouseWheelEvent& wheel_event, | 308 const blink::WebMouseWheelEvent& wheel_event, |
307 const ui::LatencyInfo& ui_latency); // Virtual for testing. | 309 const ui::LatencyInfo& ui_latency); // Virtual for testing. |
308 | 310 |
309 // Enables/disables touch emulation using mouse event. See TouchEmulator. | 311 // Enables/disables touch emulation using mouse event. See TouchEmulator. |
310 void SetTouchEventEmulationEnabled( | 312 void SetTouchEventEmulationEnabled(bool enabled, |
311 bool enabled, ui::GestureProviderConfigType config_type); | 313 ui::GestureProviderConfigType config_type); |
312 | 314 |
313 // TouchEmulatorClient implementation. | 315 // TouchEmulatorClient implementation. |
314 void ForwardEmulatedGestureEvent( | 316 void ForwardEmulatedGestureEvent( |
315 const blink::WebGestureEvent& gesture_event) override; | 317 const blink::WebGestureEvent& gesture_event) override; |
316 void ForwardEmulatedTouchEvent( | 318 void ForwardEmulatedTouchEvent( |
317 const blink::WebTouchEvent& touch_event) override; | 319 const blink::WebTouchEvent& touch_event) override; |
318 void SetCursor(const WebCursor& cursor) override; | 320 void SetCursor(const WebCursor& cursor) override; |
319 void ShowContextMenuAtPoint(const gfx::Point& point) override; | 321 void ShowContextMenuAtPoint(const gfx::Point& point) override; |
320 | 322 |
321 // Queues a synthetic gesture for testing purposes. Invokes the on_complete | 323 // Queues a synthetic gesture for testing purposes. Invokes the on_complete |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 // (on Windows); | 356 // (on Windows); |
355 // * when it receives a "commit" signal of GtkIMContext (on Linux); | 357 // * when it receives a "commit" signal of GtkIMContext (on Linux); |
356 // * when insertText of NSTextInput is called (on Mac). | 358 // * when insertText of NSTextInput is called (on Mac). |
357 void ImeConfirmComposition(const base::string16& text, | 359 void ImeConfirmComposition(const base::string16& text, |
358 const gfx::Range& replacement_range, | 360 const gfx::Range& replacement_range, |
359 bool keep_selection); | 361 bool keep_selection); |
360 | 362 |
361 // Cancels an ongoing composition. | 363 // Cancels an ongoing composition. |
362 void ImeCancelComposition(); | 364 void ImeCancelComposition(); |
363 | 365 |
364 bool ignore_input_events() const { | 366 bool ignore_input_events() const { return ignore_input_events_; } |
365 return ignore_input_events_; | |
366 } | |
367 | 367 |
368 // Whether forwarded WebInputEvents should be dropped. | 368 // Whether forwarded WebInputEvents should be dropped. |
369 bool ShouldDropInputEvents() const; | 369 bool ShouldDropInputEvents() const; |
370 | 370 |
371 bool has_touch_handler() const { return has_touch_handler_; } | 371 bool has_touch_handler() const { return has_touch_handler_; } |
372 | 372 |
373 // Set the RenderView background transparency. | 373 // Set the RenderView background transparency. |
374 void SetBackgroundOpaque(bool opaque); | 374 void SetBackgroundOpaque(bool opaque); |
375 | 375 |
376 // Notifies the renderer that the next key event is bound to one or more | 376 // Notifies the renderer that the next key event is bound to one or more |
377 // pre-defined edit commands | 377 // pre-defined edit commands |
378 void SetEditCommandsForNextKeyEvent( | 378 void SetEditCommandsForNextKeyEvent(const std::vector<EditCommand>& commands); |
379 const std::vector<EditCommand>& commands); | |
380 | 379 |
381 // Executes the edit command. | 380 // Executes the edit command. |
382 void ExecuteEditCommand(const std::string& command, | 381 void ExecuteEditCommand(const std::string& command, const std::string& value); |
383 const std::string& value); | |
384 | 382 |
385 // Tells the renderer to scroll the currently focused node into rect only if | 383 // Tells the renderer to scroll the currently focused node into rect only if |
386 // the currently focused node is a Text node (textfield, text area or content | 384 // the currently focused node is a Text node (textfield, text area or content |
387 // editable divs). | 385 // editable divs). |
388 void ScrollFocusedEditableNodeIntoRect(const gfx::Rect& rect); | 386 void ScrollFocusedEditableNodeIntoRect(const gfx::Rect& rect); |
389 | 387 |
390 // Requests the renderer to move the caret selection towards the point. | 388 // Requests the renderer to move the caret selection towards the point. |
391 void MoveCaret(const gfx::Point& point); | 389 void MoveCaret(const gfx::Point& point); |
392 | 390 |
393 // Called when the reponse to a pending mouse lock request has arrived. | 391 // Called when the reponse to a pending mouse lock request has arrived. |
394 // Returns true if |allowed| is true and the mouse has been successfully | 392 // Returns true if |allowed| is true and the mouse has been successfully |
395 // locked. | 393 // locked. |
396 bool GotResponseToLockMouseRequest(bool allowed); | 394 bool GotResponseToLockMouseRequest(bool allowed); |
397 | 395 |
398 // Tells the RenderWidget about the latest vsync parameters. | 396 // Tells the RenderWidget about the latest vsync parameters. |
399 void UpdateVSyncParameters(base::TimeTicks timebase, | 397 void UpdateVSyncParameters(base::TimeTicks timebase, |
400 base::TimeDelta interval); | 398 base::TimeDelta interval); |
401 | 399 |
402 // Called by the view in response to OnSwapCompositorFrame. | 400 // Called by the view in response to OnSwapCompositorFrame. |
403 static void SendSwapCompositorFrameAck( | 401 static void SendSwapCompositorFrameAck(int32_t route_id, |
404 int32_t route_id, | 402 uint32_t output_surface_id, |
405 uint32_t output_surface_id, | 403 int renderer_host_id, |
406 int renderer_host_id, | 404 const cc::CompositorFrameAck& ack); |
407 const cc::CompositorFrameAck& ack); | |
408 | 405 |
409 // Called by the view to return resources to the compositor. | 406 // Called by the view to return resources to the compositor. |
410 static void SendReclaimCompositorResources(int32_t route_id, | 407 static void SendReclaimCompositorResources(int32_t route_id, |
411 uint32_t output_surface_id, | 408 uint32_t output_surface_id, |
412 int renderer_host_id, | 409 int renderer_host_id, |
413 const cc::CompositorFrameAck& ack); | 410 const cc::CompositorFrameAck& ack); |
414 | 411 |
415 void set_allow_privileged_mouse_lock(bool allow) { | 412 void set_allow_privileged_mouse_lock(bool allow) { |
416 allow_privileged_mouse_lock_ = allow; | 413 allow_privileged_mouse_lock_ = allow; |
417 } | 414 } |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 bool waiting_for_screen_rects_ack_; | 692 bool waiting_for_screen_rects_ack_; |
696 gfx::Rect last_view_screen_rect_; | 693 gfx::Rect last_view_screen_rect_; |
697 gfx::Rect last_window_screen_rect_; | 694 gfx::Rect last_window_screen_rect_; |
698 | 695 |
699 // Keyboard event listeners. | 696 // Keyboard event listeners. |
700 std::vector<KeyPressEventCallback> key_press_event_callbacks_; | 697 std::vector<KeyPressEventCallback> key_press_event_callbacks_; |
701 | 698 |
702 // Mouse event callbacks. | 699 // Mouse event callbacks. |
703 std::vector<MouseEventCallback> mouse_event_callbacks_; | 700 std::vector<MouseEventCallback> mouse_event_callbacks_; |
704 | 701 |
| 702 // Input event callbacks. |
| 703 base::ObserverList<RenderWidgetHost::InputEventObserver> |
| 704 input_event_observers_; |
| 705 |
705 // If true, then we should repaint when restoring even if we have a | 706 // 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 | 707 // 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 | 708 // 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. | 709 // itself, a paint message could already be in flight at that point. |
709 bool needs_repainting_on_restore_; | 710 bool needs_repainting_on_restore_; |
710 | 711 |
711 // This is true if the renderer is currently unresponsive. | 712 // This is true if the renderer is currently unresponsive. |
712 bool is_unresponsive_; | 713 bool is_unresponsive_; |
713 | 714 |
714 // This value denotes the number of input events yet to be acknowledged | 715 // This value denotes the number of input events yet to be acknowledged |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 base::TimeDelta new_content_rendering_delay_; | 811 base::TimeDelta new_content_rendering_delay_; |
811 | 812 |
812 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_; | 813 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_; |
813 | 814 |
814 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); | 815 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); |
815 }; | 816 }; |
816 | 817 |
817 } // namespace content | 818 } // namespace content |
818 | 819 |
819 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ | 820 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ |
OLD | NEW |