| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 namespace WebKit { | 42 namespace WebKit { |
| 43 class WebInputEvent; | 43 class WebInputEvent; |
| 44 class WebMouseEvent; | 44 class WebMouseEvent; |
| 45 struct WebCompositionUnderline; | 45 struct WebCompositionUnderline; |
| 46 struct WebScreenInfo; | 46 struct WebScreenInfo; |
| 47 } | 47 } |
| 48 | 48 |
| 49 namespace content { | 49 namespace content { |
| 50 | 50 |
| 51 class RenderWidgetHostDelegate; |
| 51 class RenderWidgetHostViewPort; | 52 class RenderWidgetHostViewPort; |
| 52 class TapSuppressionController; | 53 class TapSuppressionController; |
| 53 | 54 |
| 54 // This implements the RenderWidgetHost interface that is exposed to | 55 // This implements the RenderWidgetHost interface that is exposed to |
| 55 // embedders of content, and adds things only visible to content. | 56 // embedders of content, and adds things only visible to content. |
| 56 class CONTENT_EXPORT RenderWidgetHostImpl : virtual public RenderWidgetHost, | 57 class CONTENT_EXPORT RenderWidgetHostImpl : virtual public RenderWidgetHost, |
| 57 public IPC::Channel::Listener { | 58 public IPC::Channel::Listener { |
| 58 public: | 59 public: |
| 59 // routing_id can be MSG_ROUTING_NONE, in which case the next available | 60 // routing_id can be MSG_ROUTING_NONE, in which case the next available |
| 60 // routing id is taken from the RenderProcessHost. | 61 // routing id is taken from the RenderProcessHost. |
| 61 RenderWidgetHostImpl(RenderProcessHost* process, int routing_id); | 62 RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate, |
| 63 RenderProcessHost* process, |
| 64 int routing_id); |
| 62 virtual ~RenderWidgetHostImpl(); | 65 virtual ~RenderWidgetHostImpl(); |
| 63 | 66 |
| 64 // Use RenderWidgetHostImpl::From(rwh) to downcast a | 67 // Use RenderWidgetHostImpl::From(rwh) to downcast a |
| 65 // RenderWidgetHost to a RenderWidgetHostImpl. Internally, this | 68 // RenderWidgetHost to a RenderWidgetHostImpl. Internally, this |
| 66 // uses RenderWidgetHost::AsRenderWidgetHostImpl(). | 69 // uses RenderWidgetHost::AsRenderWidgetHostImpl(). |
| 67 static RenderWidgetHostImpl* From(RenderWidgetHost* rwh); | 70 static RenderWidgetHostImpl* From(RenderWidgetHost* rwh); |
| 68 | 71 |
| 69 // RenderWidgetHost implementation. | 72 // RenderWidgetHost implementation. |
| 70 virtual void Undo() OVERRIDE; | 73 virtual void Undo() OVERRIDE; |
| 71 virtual void Redo() OVERRIDE; | 74 virtual void Redo() OVERRIDE; |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 void RendererExited(base::TerminationStatus status, int exit_code); | 373 void RendererExited(base::TerminationStatus status, int exit_code); |
| 371 | 374 |
| 372 // Retrieves an id the renderer can use to refer to its view. | 375 // Retrieves an id the renderer can use to refer to its view. |
| 373 // This is used for various IPC messages, including plugins. | 376 // This is used for various IPC messages, including plugins. |
| 374 gfx::NativeViewId GetNativeViewId() const; | 377 gfx::NativeViewId GetNativeViewId() const; |
| 375 | 378 |
| 376 // Retrieves an id for the surface that the renderer can draw to | 379 // Retrieves an id for the surface that the renderer can draw to |
| 377 // when accelerated compositing is enabled. | 380 // when accelerated compositing is enabled. |
| 378 gfx::GLSurfaceHandle GetCompositingSurface(); | 381 gfx::GLSurfaceHandle GetCompositingSurface(); |
| 379 | 382 |
| 380 // Called to handled a keyboard event before sending it to the renderer. | |
| 381 // This is overridden by RenderViewHost to send upwards to its delegate. | |
| 382 // Returns true if the event was handled, and then the keyboard event will | |
| 383 // not be sent to the renderer anymore. Otherwise, if the |event| would | |
| 384 // be handled in HandleKeyboardEvent() method as a normal keyboard shortcut, | |
| 385 // |*is_keyboard_shortcut| should be set to true. | |
| 386 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, | |
| 387 bool* is_keyboard_shortcut); | |
| 388 | |
| 389 // "RenderWidgetHostDelegate" ------------------------------------------------ | 383 // "RenderWidgetHostDelegate" ------------------------------------------------ |
| 390 // There is no RenderWidgetHostDelegate but the following methods serve the | 384 // There is no RenderWidgetHostDelegate but the following methods serve the |
| 391 // same purpose. They are overridden by RenderViewHost to send upwards to its | 385 // same purpose. They are overridden by RenderViewHost to send upwards to its |
| 392 // delegate. | 386 // delegate. |
| 393 | 387 |
| 394 // Called when a keyboard event was not processed by the renderer. | |
| 395 virtual void UnhandledKeyboardEvent(const NativeWebKeyboardEvent& event) {} | |
| 396 | |
| 397 // Called when a mousewheel event was not processed by the renderer. | 388 // Called when a mousewheel event was not processed by the renderer. |
| 398 virtual void UnhandledWheelEvent(const WebKit::WebMouseWheelEvent& event) {} | 389 virtual void UnhandledWheelEvent(const WebKit::WebMouseWheelEvent& event) {} |
| 399 | 390 |
| 400 // Notification that the user has made some kind of input that could | 391 // Notification that the user has made some kind of input that could |
| 401 // perform an action. The gestures that count are 1) any mouse down | 392 // perform an action. The gestures that count are 1) any mouse down |
| 402 // event and 2) enter or space key presses. | 393 // event and 2) enter or space key presses. |
| 403 virtual void OnUserGesture() {} | 394 virtual void OnUserGesture() {} |
| 404 | 395 |
| 405 // Callbacks for notification when the renderer becomes unresponsive to user | 396 // Callbacks for notification when the renderer becomes unresponsive to user |
| 406 // input events, and subsequently responsive again. | 397 // input events, and subsequently responsive again. |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 | 545 |
| 555 // Called on OnMsgInputEventAck() to process a touch event ack message. | 546 // Called on OnMsgInputEventAck() to process a touch event ack message. |
| 556 // This can result in a gesture event being generated and sent back to the | 547 // This can result in a gesture event being generated and sent back to the |
| 557 // renderer. | 548 // renderer. |
| 558 void ProcessTouchAck(WebKit::WebInputEvent::Type type, bool processed); | 549 void ProcessTouchAck(WebKit::WebInputEvent::Type type, bool processed); |
| 559 | 550 |
| 560 // Called when there is a new auto resize (using a post to avoid a stack | 551 // Called when there is a new auto resize (using a post to avoid a stack |
| 561 // which may get in recursive loops). | 552 // which may get in recursive loops). |
| 562 void DelayedAutoResized(); | 553 void DelayedAutoResized(); |
| 563 | 554 |
| 555 // Our delegate, which wants to know mainly about keyboard events. |
| 556 RenderWidgetHostDelegate* delegate_; |
| 557 |
| 564 // Created during construction but initialized during Init*(). Therefore, it | 558 // Created during construction but initialized during Init*(). Therefore, it |
| 565 // is guaranteed never to be NULL, but its channel may be NULL if the | 559 // is guaranteed never to be NULL, but its channel may be NULL if the |
| 566 // renderer crashed, so you must always check that. | 560 // renderer crashed, so you must always check that. |
| 567 RenderProcessHost* process_; | 561 RenderProcessHost* process_; |
| 568 | 562 |
| 569 // The ID of the corresponding object in the Renderer Instance. | 563 // The ID of the corresponding object in the Renderer Instance. |
| 570 int routing_id_; | 564 int routing_id_; |
| 571 | 565 |
| 572 // Stores random bits of data for others to associate with this object. | 566 // Stores random bits of data for others to associate with this object. |
| 573 base::PropertyBag property_bag_; | 567 base::PropertyBag property_bag_; |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_; | 717 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_; |
| 724 | 718 |
| 725 scoped_ptr<TapSuppressionController> tap_suppression_controller_; | 719 scoped_ptr<TapSuppressionController> tap_suppression_controller_; |
| 726 | 720 |
| 727 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); | 721 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); |
| 728 }; | 722 }; |
| 729 | 723 |
| 730 } // namespace content | 724 } // namespace content |
| 731 | 725 |
| 732 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ | 726 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ |
| OLD | NEW |