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 <map> | 9 #include <map> |
10 #include <queue> | 10 #include <queue> |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 class RenderWidgetHostViewPort; | 59 class RenderWidgetHostViewPort; |
60 class SmoothScrollGesture; | 60 class SmoothScrollGesture; |
61 | 61 |
62 // This implements the RenderWidgetHost interface that is exposed to | 62 // This implements the RenderWidgetHost interface that is exposed to |
63 // embedders of content, and adds things only visible to content. | 63 // embedders of content, and adds things only visible to content. |
64 class CONTENT_EXPORT RenderWidgetHostImpl : virtual public RenderWidgetHost, | 64 class CONTENT_EXPORT RenderWidgetHostImpl : virtual public RenderWidgetHost, |
65 public IPC::Listener { | 65 public IPC::Listener { |
66 public: | 66 public: |
67 // routing_id can be MSG_ROUTING_NONE, in which case the next available | 67 // routing_id can be MSG_ROUTING_NONE, in which case the next available |
68 // routing id is taken from the RenderProcessHost. | 68 // routing id is taken from the RenderProcessHost. |
69 // If this object outlives |delegate|, DetachDelegate() must be called when | |
70 // |delegate| goes away. | |
69 RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate, | 71 RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate, |
70 RenderProcessHost* process, | 72 RenderProcessHost* process, |
71 int routing_id); | 73 int routing_id); |
72 virtual ~RenderWidgetHostImpl(); | 74 virtual ~RenderWidgetHostImpl(); |
73 | 75 |
74 // Use RenderWidgetHostImpl::From(rwh) to downcast a | 76 // Use RenderWidgetHostImpl::From(rwh) to downcast a |
75 // RenderWidgetHost to a RenderWidgetHostImpl. Internally, this | 77 // RenderWidgetHost to a RenderWidgetHostImpl. Internally, this |
76 // uses RenderWidgetHost::AsRenderWidgetHostImpl(). | 78 // uses RenderWidgetHost::AsRenderWidgetHostImpl(). |
77 static RenderWidgetHostImpl* From(RenderWidgetHost* rwh); | 79 static RenderWidgetHostImpl* From(RenderWidgetHost* rwh); |
78 | 80 |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
405 | 407 |
406 void set_allow_privileged_mouse_lock(bool allow) { | 408 void set_allow_privileged_mouse_lock(bool allow) { |
407 allow_privileged_mouse_lock_ = allow; | 409 allow_privileged_mouse_lock_ = allow; |
408 } | 410 } |
409 | 411 |
410 #if defined(OS_ANDROID) | 412 #if defined(OS_ANDROID) |
411 virtual void AttachLayer(WebKit::WebLayer* layer) {} | 413 virtual void AttachLayer(WebKit::WebLayer* layer) {} |
412 virtual void RemoveLayer(WebKit::WebLayer* layer) {} | 414 virtual void RemoveLayer(WebKit::WebLayer* layer) {} |
413 #endif | 415 #endif |
414 | 416 |
417 void DetachDelegate() { delegate_ = NULL; } | |
jam
2012/09/22 00:01:34
per the style guide, if this is inline this should
yzshen1
2012/09/22 00:28:08
set_delegate() implies that |delegate_| can be cha
| |
418 | |
415 protected: | 419 protected: |
416 virtual RenderWidgetHostImpl* AsRenderWidgetHostImpl() OVERRIDE; | 420 virtual RenderWidgetHostImpl* AsRenderWidgetHostImpl() OVERRIDE; |
417 | 421 |
418 // Internal implementation of the public Forward*Event() methods. | 422 // Internal implementation of the public Forward*Event() methods. |
419 void ForwardInputEvent(const WebKit::WebInputEvent& input_event, | 423 void ForwardInputEvent(const WebKit::WebInputEvent& input_event, |
420 int event_size, bool is_keyboard_shortcut); | 424 int event_size, bool is_keyboard_shortcut); |
421 | 425 |
422 // Called when we receive a notification indicating that the renderer | 426 // Called when we receive a notification indicating that the renderer |
423 // process has gone. This will reset our state so that our state will be | 427 // process has gone. This will reset our state so that our state will be |
424 // consistent if a new renderer is created. | 428 // consistent if a new renderer is created. |
425 void RendererExited(base::TerminationStatus status, int exit_code); | 429 void RendererExited(base::TerminationStatus status, int exit_code); |
426 | 430 |
427 // Retrieves an id the renderer can use to refer to its view. | 431 // Retrieves an id the renderer can use to refer to its view. |
428 // This is used for various IPC messages, including plugins. | 432 // This is used for various IPC messages, including plugins. |
429 gfx::NativeViewId GetNativeViewId() const; | 433 gfx::NativeViewId GetNativeViewId() const; |
430 | 434 |
431 // Retrieves an id for the surface that the renderer can draw to | 435 // Retrieves an id for the surface that the renderer can draw to |
432 // when accelerated compositing is enabled. | 436 // when accelerated compositing is enabled. |
433 gfx::GLSurfaceHandle GetCompositingSurface(); | 437 gfx::GLSurfaceHandle GetCompositingSurface(); |
434 | 438 |
435 // "RenderWidgetHostDelegate" ------------------------------------------------ | 439 // --------------------------------------------------------------------------- |
436 // There is no RenderWidgetHostDelegate but the following methods serve the | 440 // The following methods are overridden by RenderViewHost to send upwards to |
437 // same purpose. They are overridden by RenderViewHost to send upwards to its | 441 // its delegate. |
438 // delegate. | |
439 | 442 |
440 // Called when a mousewheel event was not processed by the renderer. | 443 // Called when a mousewheel event was not processed by the renderer. |
441 virtual void UnhandledWheelEvent(const WebKit::WebMouseWheelEvent& event) {} | 444 virtual void UnhandledWheelEvent(const WebKit::WebMouseWheelEvent& event) {} |
442 | 445 |
443 // Notification that the user has made some kind of input that could | 446 // Notification that the user has made some kind of input that could |
444 // perform an action. The gestures that count are 1) any mouse down | 447 // perform an action. The gestures that count are 1) any mouse down |
445 // event and 2) enter or space key presses. | 448 // event and 2) enter or space key presses. |
446 virtual void OnUserGesture() {} | 449 virtual void OnUserGesture() {} |
447 | 450 |
448 // Callbacks for notification when the renderer becomes unresponsive to user | 451 // Callbacks for notification when the renderer becomes unresponsive to user |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
624 | 627 |
625 // Called when there is a new auto resize (using a post to avoid a stack | 628 // Called when there is a new auto resize (using a post to avoid a stack |
626 // which may get in recursive loops). | 629 // which may get in recursive loops). |
627 void DelayedAutoResized(); | 630 void DelayedAutoResized(); |
628 | 631 |
629 // Called periodically to advance the active scroll gesture after being | 632 // Called periodically to advance the active scroll gesture after being |
630 // initiated by OnMsgBeginSmoothScroll. | 633 // initiated by OnMsgBeginSmoothScroll. |
631 void TickActiveSmoothScrollGesture(); | 634 void TickActiveSmoothScrollGesture(); |
632 | 635 |
633 // Our delegate, which wants to know mainly about keyboard events. | 636 // Our delegate, which wants to know mainly about keyboard events. |
637 // It will remain non-NULL until DetachDelegate() is called. | |
634 RenderWidgetHostDelegate* delegate_; | 638 RenderWidgetHostDelegate* delegate_; |
635 | 639 |
636 // Created during construction but initialized during Init*(). Therefore, it | 640 // Created during construction but initialized during Init*(). Therefore, it |
637 // is guaranteed never to be NULL, but its channel may be NULL if the | 641 // is guaranteed never to be NULL, but its channel may be NULL if the |
638 // renderer crashed, so you must always check that. | 642 // renderer crashed, so you must always check that. |
639 RenderProcessHost* process_; | 643 RenderProcessHost* process_; |
640 | 644 |
641 // The ID of the corresponding object in the Renderer Instance. | 645 // The ID of the corresponding object in the Renderer Instance. |
642 int routing_id_; | 646 int routing_id_; |
643 | 647 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
809 SmoothScrollGestureMap active_smooth_scroll_gestures_; | 813 SmoothScrollGestureMap active_smooth_scroll_gestures_; |
810 | 814 |
811 scoped_ptr<GestureEventFilter> gesture_event_filter_; | 815 scoped_ptr<GestureEventFilter> gesture_event_filter_; |
812 | 816 |
813 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); | 817 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); |
814 }; | 818 }; |
815 | 819 |
816 } // namespace content | 820 } // namespace content |
817 | 821 |
818 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ | 822 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ |
OLD | NEW |