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

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

Issue 1411203010: Separate RenderViewHost from RenderWidgetHost, part 4: delegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: oops Created 5 years, 1 month 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 <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 namespace gfx { 64 namespace gfx {
65 class Range; 65 class Range;
66 } 66 }
67 67
68 namespace content { 68 namespace content {
69 69
70 class BrowserAccessibilityManager; 70 class BrowserAccessibilityManager;
71 class InputRouter; 71 class InputRouter;
72 class MockRenderWidgetHost; 72 class MockRenderWidgetHost;
73 class RenderWidgetHostDelegate; 73 class RenderWidgetHostDelegate;
74 class RenderWidgetHostOwnerDelegate;
74 class SyntheticGestureController; 75 class SyntheticGestureController;
75 class TimeoutMonitor; 76 class TimeoutMonitor;
76 class TouchEmulator; 77 class TouchEmulator;
77 class WebCursor; 78 class WebCursor;
78 struct EditCommand; 79 struct EditCommand;
79 80
80 // This implements the RenderWidgetHost interface that is exposed to 81 // This implements the RenderWidgetHost interface that is exposed to
81 // embedders of content, and adds things only visible to content. 82 // embedders of content, and adds things only visible to content.
82 class CONTENT_EXPORT RenderWidgetHostImpl : public RenderWidgetHost, 83 class CONTENT_EXPORT RenderWidgetHostImpl : public RenderWidgetHost,
83 public InputRouterClient, 84 public InputRouterClient,
84 public InputAckHandler, 85 public InputAckHandler,
85 public TouchEmulatorClient, 86 public TouchEmulatorClient,
86 public IPC::Listener { 87 public IPC::Listener {
87 public: 88 public:
88 // |routing_id| must not be MSG_ROUTING_NONE. 89 // |routing_id| must not be MSG_ROUTING_NONE.
89 // If this object outlives |delegate|, DetachDelegate() must be called when 90 // If this object outlives |delegate|, DetachDelegate() must be called when
90 // |delegate| goes away. 91 // |delegate| goes away.
91 RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate, 92 RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate,
92 RenderProcessHost* process, 93 RenderProcessHost* process,
93 int32_t routing_id, 94 int32_t routing_id,
94 bool hidden); 95 bool hidden);
95 ~RenderWidgetHostImpl() override; 96 ~RenderWidgetHostImpl() override;
96 97
97 // Similar to RenderWidgetHost::FromID, but returning the Impl object. 98 // Similar to RenderWidgetHost::FromID, but returning the Impl object.
98 static RenderWidgetHostImpl* FromID(int32_t process_id, int32_t routing_id); 99 static RenderWidgetHostImpl* FromID(int32_t process_id, int32_t routing_id);
99 100
100 // Returns all RenderWidgetHosts including swapped out ones for 101 // Returns all RenderWidgetHosts including swapped out ones for
101 // internal use. The public interface 102 // internal use. The public interface
102 // RendgerWidgetHost::GetRenderWidgetHosts only returns active ones. 103 // RenderWidgetHost::GetRenderWidgetHosts only returns active ones.
103 static scoped_ptr<RenderWidgetHostIterator> GetAllRenderWidgetHosts(); 104 static scoped_ptr<RenderWidgetHostIterator> GetAllRenderWidgetHosts();
104 105
105 // Use RenderWidgetHostImpl::From(rwh) to downcast a 106 // Use RenderWidgetHostImpl::From(rwh) to downcast a RenderWidgetHost to a
106 // RenderWidgetHost to a RenderWidgetHostImpl. Internally, this 107 // RenderWidgetHostImpl.
107 // uses RenderWidgetHost::AsRenderWidgetHostImpl().
108 static RenderWidgetHostImpl* From(RenderWidgetHost* rwh); 108 static RenderWidgetHostImpl* From(RenderWidgetHost* rwh);
109 109
110 void set_hung_renderer_delay(const base::TimeDelta& delay) { 110 void set_hung_renderer_delay(const base::TimeDelta& delay) {
111 hung_renderer_delay_ = delay; 111 hung_renderer_delay_ = delay;
112 } 112 }
113 113
114 base::TimeDelta hung_renderer_delay() { return hung_renderer_delay_; } 114 base::TimeDelta hung_renderer_delay() { return hung_renderer_delay_; }
115 115
116 void set_new_content_rendering_delay_for_testing( 116 void set_new_content_rendering_delay_for_testing(
117 const base::TimeDelta& delay) { 117 const base::TimeDelta& delay) {
118 new_content_rendering_delay_ = delay; 118 new_content_rendering_delay_ = delay;
119 } 119 }
120 120
121 base::TimeDelta new_content_rendering_delay() { 121 base::TimeDelta new_content_rendering_delay() {
122 return new_content_rendering_delay_; 122 return new_content_rendering_delay_;
123 } 123 }
124
125 void set_owner_delegate(RenderWidgetHostOwnerDelegate* owner_delegate) {
126 owner_delegate_ = owner_delegate;
127 }
128
129 RenderWidgetHostOwnerDelegate* owner_delegate() { return owner_delegate_; }
130
124 // RenderWidgetHost implementation. 131 // RenderWidgetHost implementation.
125 void UpdateTextDirection(blink::WebTextDirection direction) override; 132 void UpdateTextDirection(blink::WebTextDirection direction) override;
126 void NotifyTextDirection() override; 133 void NotifyTextDirection() override;
127 void Focus() override; 134 void Focus() override;
128 void Blur() override; 135 void Blur() override;
129 void SetActive(bool active) override; 136 void SetActive(bool active) override;
130 void CopyFromBackingStore(const gfx::Rect& src_rect, 137 void CopyFromBackingStore(const gfx::Rect& src_rect,
131 const gfx::Size& accelerated_dst_size, 138 const gfx::Size& accelerated_dst_size,
132 const ReadbackRequestCallback& callback, 139 const ReadbackRequestCallback& callback,
133 const SkColorType preferred_color_type) override; 140 const SkColorType preferred_color_type) override;
134 bool CanCopyFromBackingStore() override; 141 bool CanCopyFromBackingStore() override;
135 #if defined(OS_ANDROID) 142 #if defined(OS_ANDROID)
136 void LockBackingStore() override; 143 void LockBackingStore() override;
137 void UnlockBackingStore() override; 144 void UnlockBackingStore() override;
138 #endif 145 #endif
139 void ForwardMouseEvent(const blink::WebMouseEvent& mouse_event) override; 146 void ForwardMouseEvent(const blink::WebMouseEvent& mouse_event) override;
140 void ForwardWheelEvent(const blink::WebMouseWheelEvent& wheel_event) override; 147 void ForwardWheelEvent(const blink::WebMouseWheelEvent& wheel_event) override;
141 void ForwardKeyboardEvent(const NativeWebKeyboardEvent& key_event) override; 148 void ForwardKeyboardEvent(const NativeWebKeyboardEvent& key_event) override;
142 RenderProcessHost* GetProcess() const override; 149 RenderProcessHost* GetProcess() const override;
143 int GetRoutingID() const override; 150 int GetRoutingID() const override;
144 RenderWidgetHostViewBase* GetView() const override; 151 RenderWidgetHostViewBase* GetView() const override;
145 bool IsLoading() const override; 152 bool IsLoading() const override;
146 bool IsRenderView() const override;
147 void ResizeRectChanged(const gfx::Rect& new_rect) override; 153 void ResizeRectChanged(const gfx::Rect& new_rect) override;
148 void RestartHangMonitorTimeout() override; 154 void RestartHangMonitorTimeout() override;
149 void SetIgnoreInputEvents(bool ignore_input_events) override; 155 void SetIgnoreInputEvents(bool ignore_input_events) override;
150 void WasResized() override; 156 void WasResized() override;
151 void AddKeyPressEventCallback(const KeyPressEventCallback& callback) override; 157 void AddKeyPressEventCallback(const KeyPressEventCallback& callback) override;
152 void RemoveKeyPressEventCallback( 158 void RemoveKeyPressEventCallback(
153 const KeyPressEventCallback& callback) override; 159 const KeyPressEventCallback& callback) override;
154 void AddMouseEventCallback(const MouseEventCallback& callback) override; 160 void AddMouseEventCallback(const MouseEventCallback& callback) override;
155 void RemoveMouseEventCallback(const MouseEventCallback& callback) override; 161 void RemoveMouseEventCallback(const MouseEventCallback& callback) override;
156 void GetWebScreenInfo(blink::WebScreenInfo* result) override; 162 void GetWebScreenInfo(blink::WebScreenInfo* result) override;
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 679
674 // true if a renderer has once been valid. We use this flag to display a sad 680 // true if a renderer has once been valid. We use this flag to display a sad
675 // tab only when we lose our renderer and not if a paint occurs during 681 // tab only when we lose our renderer and not if a paint occurs during
676 // initialization. 682 // initialization.
677 bool renderer_initialized_; 683 bool renderer_initialized_;
678 684
679 // Our delegate, which wants to know mainly about keyboard events. 685 // Our delegate, which wants to know mainly about keyboard events.
680 // It will remain non-NULL until DetachDelegate() is called. 686 // It will remain non-NULL until DetachDelegate() is called.
681 RenderWidgetHostDelegate* delegate_; 687 RenderWidgetHostDelegate* delegate_;
682 688
689 // The delegate of the owner of this object.
690 RenderWidgetHostOwnerDelegate* owner_delegate_;
691
683 // Created during construction and guaranteed never to be NULL, but its 692 // Created during construction and guaranteed never to be NULL, but its
684 // channel may be NULL if the renderer crashed, so one must always check that. 693 // channel may be NULL if the renderer crashed, so one must always check that.
685 RenderProcessHost* const process_; 694 RenderProcessHost* const process_;
686 695
687 // The ID of the corresponding object in the Renderer Instance. 696 // The ID of the corresponding object in the Renderer Instance.
688 const int routing_id_; 697 const int routing_id_;
689 698
690 // Indicates whether a page is loading or not. 699 // Indicates whether a page is loading or not.
691 bool is_loading_; 700 bool is_loading_;
692 701
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 base::TimeDelta new_content_rendering_delay_; 853 base::TimeDelta new_content_rendering_delay_;
845 854
846 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_; 855 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_;
847 856
848 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); 857 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl);
849 }; 858 };
850 859
851 } // namespace content 860 } // namespace content
852 861
853 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ 862 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698