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 // A BrowserPluginGuest represents the browser side of browser <--> renderer | 5 // A BrowserPluginGuest represents the browser side of browser <--> renderer |
6 // communication. A BrowserPlugin (a WebPlugin) is on the renderer side of | 6 // communication. A BrowserPlugin (a WebPlugin) is on the renderer side of |
7 // browser <--> guest renderer communication. The 'guest' renderer is a | 7 // browser <--> guest renderer communication. The 'guest' renderer is a |
8 // <browser> tag. | 8 // <browser> tag. |
9 // | 9 // |
10 // BrowserPluginGuest lives on the UI thread of the browser process. It has a | 10 // BrowserPluginGuest lives on the UI thread of the browser process. It has a |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 | 74 |
75 void set_guest_hang_timeout_for_testing(const base::TimeDelta& timeout) { | 75 void set_guest_hang_timeout_for_testing(const base::TimeDelta& timeout) { |
76 guest_hang_timeout_ = timeout; | 76 guest_hang_timeout_ = timeout; |
77 } | 77 } |
78 | 78 |
79 void set_embedder_render_process_host( | 79 void set_embedder_render_process_host( |
80 RenderProcessHost* render_process_host) { | 80 RenderProcessHost* render_process_host) { |
81 embedder_render_process_host_ = render_process_host; | 81 embedder_render_process_host_ = render_process_host; |
82 } | 82 } |
83 | 83 |
84 bool visible() const { return visible_; } | |
85 | |
84 // WebContentsObserver implementation. | 86 // WebContentsObserver implementation. |
85 virtual void DidStartProvisionalLoadForFrame( | 87 virtual void DidStartProvisionalLoadForFrame( |
86 int64 frame_id, | 88 int64 frame_id, |
87 bool is_main_frame, | 89 bool is_main_frame, |
88 const GURL& validated_url, | 90 const GURL& validated_url, |
89 bool is_error_page, | 91 bool is_error_page, |
90 RenderViewHost* render_view_host) OVERRIDE; | 92 RenderViewHost* render_view_host) OVERRIDE; |
91 virtual void DidFailProvisionalLoad( | 93 virtual void DidFailProvisionalLoad( |
92 int64 frame_id, | 94 int64 frame_id, |
93 bool is_main_frame, | 95 bool is_main_frame, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 const gfx::Rect& initial_pos); | 128 const gfx::Rect& initial_pos); |
127 void SetCursor(const WebCursor& cursor); | 129 void SetCursor(const WebCursor& cursor); |
128 // Handles input event acks so they are sent to browser plugin host (via | 130 // Handles input event acks so they are sent to browser plugin host (via |
129 // embedder) instead of default view/widget host. | 131 // embedder) instead of default view/widget host. |
130 void HandleInputEventAck(RenderViewHost* render_view_host, bool handled); | 132 void HandleInputEventAck(RenderViewHost* render_view_host, bool handled); |
131 | 133 |
132 // The guest needs to notify the plugin in the embedder to start (or stop) | 134 // The guest needs to notify the plugin in the embedder to start (or stop) |
133 // accepting touch events. | 135 // accepting touch events. |
134 void SetIsAcceptingTouchEvents(bool accept); | 136 void SetIsAcceptingTouchEvents(bool accept); |
135 | 137 |
138 // The guest WebContents' is visible if both its embedder is visible and | |
139 // the browser plugin element is visible. If either one is not then the | |
140 // WebContents is marked as hidden. A hidden WebContents will consume | |
141 // fewer GPU and CPU resources. | |
142 // | |
143 // When the guest WebContents is hidden, it will lower the priority of the | |
144 // process (see RenderProcessHostImpl::WidgetHidden). | |
Charlie Reis
2012/10/05 16:23:58
Technically, when every WebContents in a RenderPro
Fady Samuel
2012/10/08 14:24:56
Done.
| |
145 // | |
146 // It will also send a message to the guest renderer process to cleanup | |
Charlie Reis
2012/10/05 16:23:58
nit: extra space
Fady Samuel
2012/10/08 14:24:56
Done.
| |
147 // resources such as dropping back buffers and adjusting memory limits (if in | |
148 // compositing mode, see CCLayerTreeHost::setVisible). | |
149 // | |
150 // Additionally it will slow down Javascript execution and garbage collection. | |
151 // See RenderThreadImpl::IdleHandler (executed when hidden) and | |
152 // RenderThreadImpl::IdleHandlerInForegroundTab (executed when visible). | |
153 void SetVisibility(bool embedder_visible, bool visible); | |
154 | |
136 // Exposes the protected web_contents() from WebContentsObserver. | 155 // Exposes the protected web_contents() from WebContentsObserver. |
137 WebContents* GetWebContents(); | 156 WebContents* GetWebContents(); |
138 | 157 |
139 // Kill the guest process. | 158 // Kill the guest process. |
140 void Terminate(); | 159 void Terminate(); |
141 | 160 |
142 // Overridden in tests. | 161 // Overridden in tests. |
143 virtual bool ViewTakeFocus(bool reverse); | 162 virtual bool ViewTakeFocus(bool reverse); |
144 // If possible, navigate the guest to |relative_index| entries away from the | 163 // If possible, navigate the guest to |relative_index| entries away from the |
145 // current navigation entry. | 164 // current navigation entry. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
193 size_t damage_buffer_size_; | 212 size_t damage_buffer_size_; |
194 #endif | 213 #endif |
195 gfx::Size damage_view_size_; | 214 gfx::Size damage_view_size_; |
196 float damage_buffer_scale_factor_; | 215 float damage_buffer_scale_factor_; |
197 scoped_ptr<IPC::Message> pending_input_event_reply_; | 216 scoped_ptr<IPC::Message> pending_input_event_reply_; |
198 gfx::Rect guest_rect_; | 217 gfx::Rect guest_rect_; |
199 WebCursor cursor_; | 218 WebCursor cursor_; |
200 IDMap<RenderViewHost> pending_updates_; | 219 IDMap<RenderViewHost> pending_updates_; |
201 int pending_update_counter_; | 220 int pending_update_counter_; |
202 base::TimeDelta guest_hang_timeout_; | 221 base::TimeDelta guest_hang_timeout_; |
222 bool visible_; | |
203 | 223 |
204 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); | 224 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); |
205 }; | 225 }; |
206 | 226 |
207 } // namespace content | 227 } // namespace content |
208 | 228 |
209 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ | 229 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ |
OLD | NEW |