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 #include "content/browser/renderer_host/render_view_host.h" | 5 #include "content/browser/renderer_host/render_view_host.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 RenderViewHost* RenderViewHost::FromID(int render_process_id, | 105 RenderViewHost* RenderViewHost::FromID(int render_process_id, |
106 int render_view_id) { | 106 int render_view_id) { |
107 content::RenderProcessHost* process = | 107 content::RenderProcessHost* process = |
108 content::RenderProcessHost::FromID(render_process_id); | 108 content::RenderProcessHost::FromID(render_process_id); |
109 if (!process) | 109 if (!process) |
110 return NULL; | 110 return NULL; |
111 RenderWidgetHost* widget = RenderWidgetHost::FromIPCChannelListener( | 111 RenderWidgetHost* widget = RenderWidgetHost::FromIPCChannelListener( |
112 process->GetListenerByID(render_view_id)); | 112 process->GetListenerByID(render_view_id)); |
113 if (!widget || !widget->IsRenderView()) | 113 if (!widget || !widget->IsRenderView()) |
114 return NULL; | 114 return NULL; |
115 return static_cast<RenderViewHost*>(widget); | 115 return static_cast<RenderViewHostImpl*>(widget->AsRWHImpl()); |
116 } | 116 } |
117 | 117 |
118 RenderViewHost::RenderViewHost(SiteInstance* instance, | 118 /////////////////////////////////////////////////////////////////////////////// |
119 RenderViewHostDelegate* delegate, | 119 // RenderViewHostImpl, public: |
120 int routing_id, | 120 |
121 SessionStorageNamespace* session_storage) | 121 // static |
| 122 RenderViewHostImpl* RenderViewHostImpl::FromID(int render_process_id, |
| 123 int render_view_id) { |
| 124 return static_cast<RenderViewHostImpl*>( |
| 125 RenderViewHost::FromID(render_process_id, render_view_id)); |
| 126 } |
| 127 |
| 128 RenderViewHostImpl::RenderViewHostImpl(SiteInstance* instance, |
| 129 RenderViewHostDelegate* delegate, |
| 130 int routing_id, |
| 131 SessionStorageNamespace* session_storage) |
122 : RenderWidgetHostImpl(instance->GetProcess(), routing_id), | 132 : RenderWidgetHostImpl(instance->GetProcess(), routing_id), |
| 133 delegate_(delegate), |
123 instance_(static_cast<SiteInstanceImpl*>(instance)), | 134 instance_(static_cast<SiteInstanceImpl*>(instance)), |
124 delegate_(delegate), | |
125 waiting_for_drag_context_response_(false), | 135 waiting_for_drag_context_response_(false), |
126 enabled_bindings_(0), | 136 enabled_bindings_(0), |
127 pending_request_id_(-1), | 137 pending_request_id_(-1), |
128 navigations_suspended_(false), | 138 navigations_suspended_(false), |
129 suspended_nav_message_(NULL), | 139 suspended_nav_message_(NULL), |
130 is_swapped_out_(false), | 140 is_swapped_out_(false), |
131 run_modal_reply_msg_(NULL), | 141 run_modal_reply_msg_(NULL), |
132 is_waiting_for_beforeunload_ack_(false), | 142 is_waiting_for_beforeunload_ack_(false), |
133 is_waiting_for_unload_ack_(false), | 143 is_waiting_for_unload_ack_(false), |
134 unload_ack_is_for_cross_site_transition_(false), | 144 unload_ack_is_for_cross_site_transition_(false), |
135 are_javascript_messages_suppressed_(false), | 145 are_javascript_messages_suppressed_(false), |
136 sudden_termination_allowed_(false), | 146 sudden_termination_allowed_(false), |
137 session_storage_namespace_( | 147 session_storage_namespace_( |
138 static_cast<SessionStorageNamespaceImpl*>(session_storage)), | 148 static_cast<SessionStorageNamespaceImpl*>(session_storage)), |
139 save_accessibility_tree_for_testing_(false), | 149 save_accessibility_tree_for_testing_(false), |
140 send_accessibility_updated_notifications_(false), | 150 send_accessibility_updated_notifications_(false), |
141 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING) { | 151 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING) { |
142 if (!session_storage_namespace_) { | 152 if (!session_storage_namespace_) { |
143 DOMStorageContext* dom_storage_context = | 153 DOMStorageContext* dom_storage_context = |
144 BrowserContext::GetDOMStorageContext(process()->GetBrowserContext()); | 154 BrowserContext::GetDOMStorageContext(GetProcess()->GetBrowserContext()); |
145 session_storage_namespace_ = new SessionStorageNamespaceImpl( | 155 session_storage_namespace_ = new SessionStorageNamespaceImpl( |
146 static_cast<DOMStorageContextImpl*>(dom_storage_context)); | 156 static_cast<DOMStorageContextImpl*>(dom_storage_context)); |
147 } | 157 } |
148 | 158 |
149 DCHECK(instance_); | 159 DCHECK(instance_); |
150 CHECK(delegate_); // http://crbug.com/82827 | 160 CHECK(delegate_); // http://crbug.com/82827 |
151 | 161 |
152 process()->EnableSendQueue(); | 162 GetProcess()->EnableSendQueue(); |
153 | 163 |
154 content::GetContentClient()->browser()->RenderViewHostCreated(this); | 164 content::GetContentClient()->browser()->RenderViewHostCreated(this); |
155 | 165 |
156 content::NotificationService::current()->Notify( | 166 content::NotificationService::current()->Notify( |
157 content::NOTIFICATION_RENDER_VIEW_HOST_CREATED, | 167 content::NOTIFICATION_RENDER_VIEW_HOST_CREATED, |
158 content::Source<RenderViewHost>(this), | 168 content::Source<RenderViewHost>(this), |
159 content::NotificationService::NoDetails()); | 169 content::NotificationService::NoDetails()); |
160 } | 170 } |
161 | 171 |
162 RenderViewHost::~RenderViewHost() { | 172 RenderViewHostImpl::~RenderViewHostImpl() { |
163 FOR_EACH_OBSERVER( | 173 FOR_EACH_OBSERVER( |
164 content::RenderViewHostObserver, observers_, RenderViewHostDestruction()); | 174 content::RenderViewHostObserver, observers_, RenderViewHostDestruction()); |
165 | 175 |
166 content::NotificationService::current()->Notify( | 176 content::NotificationService::current()->Notify( |
167 content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, | 177 content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, |
168 content::Source<RenderViewHost>(this), | 178 content::Source<RenderViewHost>(this), |
169 content::NotificationService::NoDetails()); | 179 content::NotificationService::NoDetails()); |
170 | 180 |
171 ClearPowerSaveBlockers(); | 181 ClearPowerSaveBlockers(); |
172 | 182 |
173 delegate()->RenderViewDeleted(this); | 183 GetDelegate()->RenderViewDeleted(this); |
174 | 184 |
175 // Be sure to clean up any leftover state from cross-site requests. | 185 // Be sure to clean up any leftover state from cross-site requests. |
176 CrossSiteRequestManager::GetInstance()->SetHasPendingCrossSiteRequest( | 186 CrossSiteRequestManager::GetInstance()->SetHasPendingCrossSiteRequest( |
177 process()->GetID(), routing_id(), false); | 187 GetProcess()->GetID(), GetRoutingID(), false); |
178 } | 188 } |
179 | 189 |
180 bool RenderViewHost::CreateRenderView(const string16& frame_name, | 190 content::RenderViewHostDelegate* RenderViewHostImpl::GetDelegate() const { |
181 int32 max_page_id) { | 191 return delegate_; |
| 192 } |
| 193 |
| 194 content::SiteInstance* RenderViewHostImpl::GetSiteInstance() const { |
| 195 return instance_; |
| 196 } |
| 197 |
| 198 bool RenderViewHostImpl::CreateRenderView(const string16& frame_name, |
| 199 int32 max_page_id) { |
182 DCHECK(!IsRenderViewLive()) << "Creating view twice"; | 200 DCHECK(!IsRenderViewLive()) << "Creating view twice"; |
183 | 201 |
184 // The process may (if we're sharing a process with another host that already | 202 // The process may (if we're sharing a process with another host that already |
185 // initialized it) or may not (we have our own process or the old process | 203 // initialized it) or may not (we have our own process or the old process |
186 // crashed) have been initialized. Calling Init multiple times will be | 204 // crashed) have been initialized. Calling Init multiple times will be |
187 // ignored, so this is safe. | 205 // ignored, so this is safe. |
188 if (!process()->Init(renderer_accessible())) | 206 if (!GetProcess()->Init(renderer_accessible())) |
189 return false; | 207 return false; |
190 DCHECK(process()->HasConnection()); | 208 DCHECK(GetProcess()->HasConnection()); |
191 DCHECK(process()->GetBrowserContext()); | 209 DCHECK(GetProcess()->GetBrowserContext()); |
192 | 210 |
193 renderer_initialized_ = true; | 211 renderer_initialized_ = true; |
194 | 212 |
195 GpuSurfaceTracker::Get()->SetSurfaceHandle( | 213 GpuSurfaceTracker::Get()->SetSurfaceHandle( |
196 surface_id(), GetCompositingSurface()); | 214 surface_id(), GetCompositingSurface()); |
197 | 215 |
198 // Ensure the RenderView starts with a next_page_id larger than any existing | 216 // Ensure the RenderView starts with a next_page_id larger than any existing |
199 // page ID it might be asked to render. | 217 // page ID it might be asked to render. |
200 int32 next_page_id = 1; | 218 int32 next_page_id = 1; |
201 if (max_page_id > -1) | 219 if (max_page_id > -1) |
202 next_page_id = max_page_id + 1; | 220 next_page_id = max_page_id + 1; |
203 | 221 |
204 ViewMsg_New_Params params; | 222 ViewMsg_New_Params params; |
205 params.parent_window = GetNativeViewId(); | 223 params.parent_window = GetNativeViewId(); |
206 params.renderer_preferences = | 224 params.renderer_preferences = |
207 delegate_->GetRendererPrefs(process()->GetBrowserContext()); | 225 delegate_->GetRendererPrefs(GetProcess()->GetBrowserContext()); |
208 params.web_preferences = delegate_->GetWebkitPrefs(); | 226 params.web_preferences = delegate_->GetWebkitPrefs(); |
209 params.view_id = routing_id(); | 227 params.view_id = GetRoutingID(); |
210 params.surface_id = surface_id(); | 228 params.surface_id = surface_id(); |
211 params.session_storage_namespace_id = session_storage_namespace_->id(); | 229 params.session_storage_namespace_id = session_storage_namespace_->id(); |
212 params.frame_name = frame_name; | 230 params.frame_name = frame_name; |
213 params.next_page_id = next_page_id; | 231 params.next_page_id = next_page_id; |
214 Send(new ViewMsg_New(params)); | 232 Send(new ViewMsg_New(params)); |
215 | 233 |
216 // If it's enabled, tell the renderer to set up the Javascript bindings for | 234 // If it's enabled, tell the renderer to set up the Javascript bindings for |
217 // sending messages back to the browser. | 235 // sending messages back to the browser. |
218 Send(new ViewMsg_AllowBindings(routing_id(), enabled_bindings_)); | 236 Send(new ViewMsg_AllowBindings(GetRoutingID(), enabled_bindings_)); |
219 // Let our delegate know that we created a RenderView. | 237 // Let our delegate know that we created a RenderView. |
220 delegate_->RenderViewCreated(this); | 238 delegate_->RenderViewCreated(this); |
221 | 239 |
222 // Invert the color scheme if a flag was set. | 240 // Invert the color scheme if a flag was set. |
223 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInvertWebContent)) | 241 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInvertWebContent)) |
224 Send(new ViewMsg_InvertWebContent(routing_id(), true)); | 242 Send(new ViewMsg_InvertWebContent(GetRoutingID(), true)); |
225 | 243 |
226 FOR_EACH_OBSERVER( | 244 FOR_EACH_OBSERVER( |
227 content::RenderViewHostObserver, observers_, RenderViewHostInitialized()); | 245 content::RenderViewHostObserver, observers_, RenderViewHostInitialized()); |
228 | 246 |
229 return true; | 247 return true; |
230 } | 248 } |
231 | 249 |
232 bool RenderViewHost::IsRenderViewLive() const { | 250 bool RenderViewHostImpl::IsRenderViewLive() const { |
233 return process()->HasConnection() && renderer_initialized_; | 251 return GetProcess()->HasConnection() && renderer_initialized_; |
234 } | 252 } |
235 | 253 |
236 void RenderViewHost::SyncRendererPrefs() { | 254 void RenderViewHostImpl::SyncRendererPrefs() { |
237 Send(new ViewMsg_SetRendererPrefs(routing_id(), | 255 Send(new ViewMsg_SetRendererPrefs(GetRoutingID(), |
238 delegate_->GetRendererPrefs( | 256 delegate_->GetRendererPrefs( |
239 process()->GetBrowserContext()))); | 257 GetProcess()->GetBrowserContext()))); |
240 } | 258 } |
241 | 259 |
242 void RenderViewHost::Navigate(const ViewMsg_Navigate_Params& params) { | 260 void RenderViewHostImpl::Navigate(const ViewMsg_Navigate_Params& params) { |
243 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( | 261 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( |
244 process()->GetID(), params.url); | 262 GetProcess()->GetID(), params.url); |
245 | 263 |
246 ViewMsg_Navigate* nav_message = new ViewMsg_Navigate(routing_id(), params); | 264 ViewMsg_Navigate* nav_message = new ViewMsg_Navigate(GetRoutingID(), params); |
247 | 265 |
248 // Only send the message if we aren't suspended at the start of a cross-site | 266 // Only send the message if we aren't suspended at the start of a cross-site |
249 // request. | 267 // request. |
250 if (navigations_suspended_) { | 268 if (navigations_suspended_) { |
251 // Shouldn't be possible to have a second navigation while suspended, since | 269 // Shouldn't be possible to have a second navigation while suspended, since |
252 // navigations will only be suspended during a cross-site request. If a | 270 // navigations will only be suspended during a cross-site request. If a |
253 // second navigation occurs, TabContents will cancel this pending RVH | 271 // second navigation occurs, TabContents will cancel this pending RVH |
254 // create a new pending RVH. | 272 // create a new pending RVH. |
255 DCHECK(!suspended_nav_message_.get()); | 273 DCHECK(!suspended_nav_message_.get()); |
256 suspended_nav_message_.reset(nav_message); | 274 suspended_nav_message_.reset(nav_message); |
(...skipping 16 matching lines...) Expand all Loading... |
273 // | 291 // |
274 // WebKit doesn't send throb notifications for JavaScript URLs, so we | 292 // WebKit doesn't send throb notifications for JavaScript URLs, so we |
275 // don't want to either. | 293 // don't want to either. |
276 if (!params.url.SchemeIs(chrome::kJavaScriptScheme)) | 294 if (!params.url.SchemeIs(chrome::kJavaScriptScheme)) |
277 delegate_->DidStartLoading(); | 295 delegate_->DidStartLoading(); |
278 | 296 |
279 FOR_EACH_OBSERVER(content::RenderViewHostObserver, | 297 FOR_EACH_OBSERVER(content::RenderViewHostObserver, |
280 observers_, Navigate(params.url)); | 298 observers_, Navigate(params.url)); |
281 } | 299 } |
282 | 300 |
283 void RenderViewHost::NavigateToURL(const GURL& url) { | 301 void RenderViewHostImpl::NavigateToURL(const GURL& url) { |
284 ViewMsg_Navigate_Params params; | 302 ViewMsg_Navigate_Params params; |
285 params.page_id = -1; | 303 params.page_id = -1; |
286 params.pending_history_list_offset = -1; | 304 params.pending_history_list_offset = -1; |
287 params.current_history_list_offset = -1; | 305 params.current_history_list_offset = -1; |
288 params.current_history_list_length = 0; | 306 params.current_history_list_length = 0; |
289 params.url = url; | 307 params.url = url; |
290 params.transition = content::PAGE_TRANSITION_LINK; | 308 params.transition = content::PAGE_TRANSITION_LINK; |
291 params.navigation_type = ViewMsg_Navigate_Type::NORMAL; | 309 params.navigation_type = ViewMsg_Navigate_Type::NORMAL; |
292 Navigate(params); | 310 Navigate(params); |
293 } | 311 } |
294 | 312 |
295 void RenderViewHost::SetNavigationsSuspended(bool suspend) { | 313 void RenderViewHostImpl::SetNavigationsSuspended(bool suspend) { |
296 // This should only be called to toggle the state. | 314 // This should only be called to toggle the state. |
297 DCHECK(navigations_suspended_ != suspend); | 315 DCHECK(navigations_suspended_ != suspend); |
298 | 316 |
299 navigations_suspended_ = suspend; | 317 navigations_suspended_ = suspend; |
300 if (!suspend && suspended_nav_message_.get()) { | 318 if (!suspend && suspended_nav_message_.get()) { |
301 // There's a navigation message waiting to be sent. Now that we're not | 319 // There's a navigation message waiting to be sent. Now that we're not |
302 // suspended anymore, resume navigation by sending it. If we were swapped | 320 // suspended anymore, resume navigation by sending it. If we were swapped |
303 // out, we should also stop filtering out the IPC messages now. | 321 // out, we should also stop filtering out the IPC messages now. |
304 SetSwappedOut(false); | 322 SetSwappedOut(false); |
305 | 323 |
306 Send(suspended_nav_message_.release()); | 324 Send(suspended_nav_message_.release()); |
307 } | 325 } |
308 } | 326 } |
309 | 327 |
310 void RenderViewHost::CancelSuspendedNavigations() { | 328 void RenderViewHostImpl::CancelSuspendedNavigations() { |
311 // Clear any state if a pending navigation is canceled or pre-empted. | 329 // Clear any state if a pending navigation is canceled or pre-empted. |
312 if (suspended_nav_message_.get()) | 330 if (suspended_nav_message_.get()) |
313 suspended_nav_message_.reset(); | 331 suspended_nav_message_.reset(); |
314 navigations_suspended_ = false; | 332 navigations_suspended_ = false; |
315 } | 333 } |
316 | 334 |
317 void RenderViewHost::FirePageBeforeUnload(bool for_cross_site_transition) { | 335 void RenderViewHostImpl::FirePageBeforeUnload(bool for_cross_site_transition) { |
318 if (!IsRenderViewLive()) { | 336 if (!IsRenderViewLive()) { |
319 // This RenderViewHost doesn't have a live renderer, so just skip running | 337 // This RenderViewHostImpl doesn't have a live renderer, so just |
320 // the onbeforeunload handler. | 338 // skip running the onbeforeunload handler. |
321 is_waiting_for_beforeunload_ack_ = true; // Checked by OnMsgShouldCloseACK. | 339 is_waiting_for_beforeunload_ack_ = true; // Checked by OnMsgShouldCloseACK. |
322 unload_ack_is_for_cross_site_transition_ = for_cross_site_transition; | 340 unload_ack_is_for_cross_site_transition_ = for_cross_site_transition; |
323 OnMsgShouldCloseACK(true); | 341 OnMsgShouldCloseACK(true); |
324 return; | 342 return; |
325 } | 343 } |
326 | 344 |
327 // This may be called more than once (if the user clicks the tab close button | 345 // This may be called more than once (if the user clicks the tab close button |
328 // several times, or if she clicks the tab close button then the browser close | 346 // several times, or if she clicks the tab close button then the browser close |
329 // button), and we only send the message once. | 347 // button), and we only send the message once. |
330 if (is_waiting_for_beforeunload_ack_) { | 348 if (is_waiting_for_beforeunload_ack_) { |
331 // Some of our close messages could be for the tab, others for cross-site | 349 // Some of our close messages could be for the tab, others for cross-site |
332 // transitions. We always want to think it's for closing the tab if any | 350 // transitions. We always want to think it's for closing the tab if any |
333 // of the messages were, since otherwise it might be impossible to close | 351 // of the messages were, since otherwise it might be impossible to close |
334 // (if there was a cross-site "close" request pending when the user clicked | 352 // (if there was a cross-site "close" request pending when the user clicked |
335 // the close button). We want to keep the "for cross site" flag only if | 353 // the close button). We want to keep the "for cross site" flag only if |
336 // both the old and the new ones are also for cross site. | 354 // both the old and the new ones are also for cross site. |
337 unload_ack_is_for_cross_site_transition_ = | 355 unload_ack_is_for_cross_site_transition_ = |
338 unload_ack_is_for_cross_site_transition_ && for_cross_site_transition; | 356 unload_ack_is_for_cross_site_transition_ && for_cross_site_transition; |
339 } else { | 357 } else { |
340 // Start the hang monitor in case the renderer hangs in the beforeunload | 358 // Start the hang monitor in case the renderer hangs in the beforeunload |
341 // handler. | 359 // handler. |
342 is_waiting_for_beforeunload_ack_ = true; | 360 is_waiting_for_beforeunload_ack_ = true; |
343 unload_ack_is_for_cross_site_transition_ = for_cross_site_transition; | 361 unload_ack_is_for_cross_site_transition_ = for_cross_site_transition; |
344 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); | 362 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); |
345 Send(new ViewMsg_ShouldClose(routing_id())); | 363 Send(new ViewMsg_ShouldClose(GetRoutingID())); |
346 } | 364 } |
347 } | 365 } |
348 | 366 |
349 void RenderViewHost::SwapOut(int new_render_process_host_id, | 367 void RenderViewHostImpl::SwapOut(int new_render_process_host_id, |
350 int new_request_id) { | 368 int new_request_id) { |
351 // This will be set back to false in OnSwapOutACK, just before we replace | 369 // This will be set back to false in OnSwapOutACK, just before we replace |
352 // this RVH with the pending RVH. | 370 // this RVH with the pending RVH. |
353 is_waiting_for_unload_ack_ = true; | 371 is_waiting_for_unload_ack_ = true; |
354 // Start the hang monitor in case the renderer hangs in the unload handler. | 372 // Start the hang monitor in case the renderer hangs in the unload handler. |
355 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); | 373 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); |
356 | 374 |
357 ViewMsg_SwapOut_Params params; | 375 ViewMsg_SwapOut_Params params; |
358 params.closing_process_id = process()->GetID(); | 376 params.closing_process_id = GetProcess()->GetID(); |
359 params.closing_route_id = routing_id(); | 377 params.closing_route_id = GetRoutingID(); |
360 params.new_render_process_host_id = new_render_process_host_id; | 378 params.new_render_process_host_id = new_render_process_host_id; |
361 params.new_request_id = new_request_id; | 379 params.new_request_id = new_request_id; |
362 if (IsRenderViewLive()) { | 380 if (IsRenderViewLive()) { |
363 Send(new ViewMsg_SwapOut(routing_id(), params)); | 381 Send(new ViewMsg_SwapOut(GetRoutingID(), params)); |
364 } else { | 382 } else { |
365 // This RenderViewHost doesn't have a live renderer, so just skip the unload | 383 // This RenderViewHost doesn't have a live renderer, so just skip the unload |
366 // event. We must notify the ResourceDispatcherHost on the IO thread, | 384 // event. We must notify the ResourceDispatcherHost on the IO thread, |
367 // which we will do through the RenderProcessHost's widget helper. | 385 // which we will do through the RenderProcessHost's widget helper. |
368 process()->CrossSiteSwapOutACK(params); | 386 GetProcess()->CrossSiteSwapOutACK(params); |
369 } | 387 } |
370 } | 388 } |
371 | 389 |
372 void RenderViewHost::OnSwapOutACK() { | 390 void RenderViewHostImpl::OnSwapOutACK() { |
373 // Stop the hang monitor now that the unload handler has finished. | 391 // Stop the hang monitor now that the unload handler has finished. |
374 StopHangMonitorTimeout(); | 392 StopHangMonitorTimeout(); |
375 is_waiting_for_unload_ack_ = false; | 393 is_waiting_for_unload_ack_ = false; |
376 delegate_->SwappedOut(this); | 394 delegate_->SwappedOut(this); |
377 } | 395 } |
378 | 396 |
379 void RenderViewHost::WasSwappedOut() { | 397 void RenderViewHostImpl::WasSwappedOut() { |
380 // Don't bother reporting hung state anymore. | 398 // Don't bother reporting hung state anymore. |
381 StopHangMonitorTimeout(); | 399 StopHangMonitorTimeout(); |
382 | 400 |
383 // Now that we're no longer the active RVH in the tab, start filtering out | 401 // Now that we're no longer the active RVH in the tab, start filtering out |
384 // most IPC messages. Usually the renderer will have stopped sending | 402 // most IPC messages. Usually the renderer will have stopped sending |
385 // messages as of OnSwapOutACK. However, we may have timed out waiting | 403 // messages as of OnSwapOutACK. However, we may have timed out waiting |
386 // for that message, and additional IPC messages may keep streaming in. | 404 // for that message, and additional IPC messages may keep streaming in. |
387 // We filter them out, as long as that won't cause problems (e.g., we | 405 // We filter them out, as long as that won't cause problems (e.g., we |
388 // still allow synchronous messages through). | 406 // still allow synchronous messages through). |
389 SetSwappedOut(true); | 407 SetSwappedOut(true); |
390 | 408 |
391 // Inform the renderer that it can exit if no one else is using it. | 409 // Inform the renderer that it can exit if no one else is using it. |
392 Send(new ViewMsg_WasSwappedOut(routing_id())); | 410 Send(new ViewMsg_WasSwappedOut(GetRoutingID())); |
393 } | 411 } |
394 | 412 |
395 void RenderViewHost::ClosePage() { | 413 void RenderViewHostImpl::ClosePage() { |
396 // Start the hang monitor in case the renderer hangs in the unload handler. | 414 // Start the hang monitor in case the renderer hangs in the unload handler. |
397 is_waiting_for_unload_ack_ = true; | 415 is_waiting_for_unload_ack_ = true; |
398 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); | 416 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); |
399 | 417 |
400 if (IsRenderViewLive()) { | 418 if (IsRenderViewLive()) { |
401 // TODO(creis): Should this be moved to Shutdown? It may not be called for | 419 // TODO(creis): Should this be moved to Shutdown? It may not be called for |
402 // RenderViewHosts that have been swapped out. | 420 // RenderViewHosts that have been swapped out. |
403 content::NotificationService::current()->Notify( | 421 content::NotificationService::current()->Notify( |
404 content::NOTIFICATION_RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW, | 422 content::NOTIFICATION_RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW, |
405 content::Source<RenderViewHost>(this), | 423 content::Source<RenderViewHost>(this), |
406 content::NotificationService::NoDetails()); | 424 content::NotificationService::NoDetails()); |
407 | 425 |
408 Send(new ViewMsg_ClosePage(routing_id())); | 426 Send(new ViewMsg_ClosePage(GetRoutingID())); |
409 } else { | 427 } else { |
410 // This RenderViewHost doesn't have a live renderer, so just skip the unload | 428 // This RenderViewHost doesn't have a live renderer, so just skip the unload |
411 // event and close the page. | 429 // event and close the page. |
412 ClosePageIgnoringUnloadEvents(); | 430 ClosePageIgnoringUnloadEvents(); |
413 } | 431 } |
414 } | 432 } |
415 | 433 |
416 void RenderViewHost::ClosePageIgnoringUnloadEvents() { | 434 void RenderViewHostImpl::ClosePageIgnoringUnloadEvents() { |
417 StopHangMonitorTimeout(); | 435 StopHangMonitorTimeout(); |
418 is_waiting_for_beforeunload_ack_ = false; | 436 is_waiting_for_beforeunload_ack_ = false; |
419 is_waiting_for_unload_ack_ = false; | 437 is_waiting_for_unload_ack_ = false; |
420 | 438 |
421 sudden_termination_allowed_ = true; | 439 sudden_termination_allowed_ = true; |
422 delegate_->Close(this); | 440 delegate_->Close(this); |
423 } | 441 } |
424 | 442 |
425 void RenderViewHost::SetHasPendingCrossSiteRequest(bool has_pending_request, | 443 void RenderViewHostImpl::SetHasPendingCrossSiteRequest(bool has_pending_request, |
426 int request_id) { | 444 int request_id) { |
427 CrossSiteRequestManager::GetInstance()->SetHasPendingCrossSiteRequest( | 445 CrossSiteRequestManager::GetInstance()->SetHasPendingCrossSiteRequest( |
428 process()->GetID(), routing_id(), has_pending_request); | 446 GetProcess()->GetID(), GetRoutingID(), has_pending_request); |
429 pending_request_id_ = request_id; | 447 pending_request_id_ = request_id; |
430 } | 448 } |
431 | 449 |
432 int RenderViewHost::GetPendingRequestId() { | 450 int RenderViewHostImpl::GetPendingRequestId() { |
433 return pending_request_id_; | 451 return pending_request_id_; |
434 } | 452 } |
435 | 453 |
436 void RenderViewHost::DragTargetDragEnter( | 454 void RenderViewHostImpl::DragTargetDragEnter( |
437 const WebDropData& drop_data, | 455 const WebDropData& drop_data, |
438 const gfx::Point& client_pt, | 456 const gfx::Point& client_pt, |
439 const gfx::Point& screen_pt, | 457 const gfx::Point& screen_pt, |
440 WebDragOperationsMask operations_allowed) { | 458 WebDragOperationsMask operations_allowed) { |
441 const int renderer_id = process()->GetID(); | 459 const int renderer_id = GetProcess()->GetID(); |
442 ChildProcessSecurityPolicyImpl* policy = | 460 ChildProcessSecurityPolicyImpl* policy = |
443 ChildProcessSecurityPolicyImpl::GetInstance(); | 461 ChildProcessSecurityPolicyImpl::GetInstance(); |
444 | 462 |
445 // The URL could have been cobbled together from any highlighted text string, | 463 // The URL could have been cobbled together from any highlighted text string, |
446 // and can't be interpreted as a capability. | 464 // and can't be interpreted as a capability. |
447 WebDropData filtered_data(drop_data); | 465 WebDropData filtered_data(drop_data); |
448 FilterURL(policy, renderer_id, &filtered_data.url); | 466 FilterURL(policy, renderer_id, &filtered_data.url); |
449 | 467 |
450 // The filenames vector, on the other hand, does represent a capability to | 468 // The filenames vector, on the other hand, does represent a capability to |
451 // access the given files. | 469 // access the given files. |
(...skipping 12 matching lines...) Expand all Loading... |
464 } | 482 } |
465 | 483 |
466 fileapi::IsolatedContext* isolated_context = | 484 fileapi::IsolatedContext* isolated_context = |
467 fileapi::IsolatedContext::GetInstance(); | 485 fileapi::IsolatedContext::GetInstance(); |
468 DCHECK(isolated_context); | 486 DCHECK(isolated_context); |
469 std::string filesystem_id = isolated_context->RegisterIsolatedFileSystem( | 487 std::string filesystem_id = isolated_context->RegisterIsolatedFileSystem( |
470 filesets); | 488 filesets); |
471 policy->GrantAccessFileSystem(renderer_id, filesystem_id); | 489 policy->GrantAccessFileSystem(renderer_id, filesystem_id); |
472 filtered_data.filesystem_id = UTF8ToUTF16(filesystem_id); | 490 filtered_data.filesystem_id = UTF8ToUTF16(filesystem_id); |
473 | 491 |
474 Send(new DragMsg_TargetDragEnter(routing_id(), filtered_data, client_pt, | 492 Send(new DragMsg_TargetDragEnter(GetRoutingID(), filtered_data, client_pt, |
475 screen_pt, operations_allowed)); | 493 screen_pt, operations_allowed)); |
476 } | 494 } |
477 | 495 |
478 void RenderViewHost::DragTargetDragOver( | 496 void RenderViewHostImpl::DragTargetDragOver( |
479 const gfx::Point& client_pt, const gfx::Point& screen_pt, | 497 const gfx::Point& client_pt, const gfx::Point& screen_pt, |
480 WebDragOperationsMask operations_allowed) { | 498 WebDragOperationsMask operations_allowed) { |
481 Send(new DragMsg_TargetDragOver(routing_id(), client_pt, screen_pt, | 499 Send(new DragMsg_TargetDragOver(GetRoutingID(), client_pt, screen_pt, |
482 operations_allowed)); | 500 operations_allowed)); |
483 } | 501 } |
484 | 502 |
485 void RenderViewHost::DragTargetDragLeave() { | 503 void RenderViewHostImpl::DragTargetDragLeave() { |
486 Send(new DragMsg_TargetDragLeave(routing_id())); | 504 Send(new DragMsg_TargetDragLeave(GetRoutingID())); |
487 } | 505 } |
488 | 506 |
489 void RenderViewHost::DragTargetDrop( | 507 void RenderViewHostImpl::DragTargetDrop( |
490 const gfx::Point& client_pt, const gfx::Point& screen_pt) { | 508 const gfx::Point& client_pt, const gfx::Point& screen_pt) { |
491 Send(new DragMsg_TargetDrop(routing_id(), client_pt, screen_pt)); | 509 Send(new DragMsg_TargetDrop(GetRoutingID(), client_pt, screen_pt)); |
492 } | 510 } |
493 | 511 |
494 void RenderViewHost::DesktopNotificationPermissionRequestDone( | 512 void RenderViewHostImpl::DesktopNotificationPermissionRequestDone( |
495 int callback_context) { | 513 int callback_context) { |
496 Send(new DesktopNotificationMsg_PermissionRequestDone( | 514 Send(new DesktopNotificationMsg_PermissionRequestDone( |
497 routing_id(), callback_context)); | 515 GetRoutingID(), callback_context)); |
498 } | 516 } |
499 | 517 |
500 void RenderViewHost::DesktopNotificationPostDisplay(int callback_context) { | 518 void RenderViewHostImpl::DesktopNotificationPostDisplay(int callback_context) { |
501 Send(new DesktopNotificationMsg_PostDisplay(routing_id(), callback_context)); | 519 Send(new DesktopNotificationMsg_PostDisplay(GetRoutingID(), |
| 520 callback_context)); |
502 } | 521 } |
503 | 522 |
504 void RenderViewHost::DesktopNotificationPostError(int notification_id, | 523 void RenderViewHostImpl::DesktopNotificationPostError(int notification_id, |
505 const string16& message) { | 524 const string16& message) { |
506 Send(new DesktopNotificationMsg_PostError( | 525 Send(new DesktopNotificationMsg_PostError( |
507 routing_id(), notification_id, message)); | 526 GetRoutingID(), notification_id, message)); |
508 } | 527 } |
509 | 528 |
510 void RenderViewHost::DesktopNotificationPostClose(int notification_id, | 529 void RenderViewHostImpl::DesktopNotificationPostClose(int notification_id, |
511 bool by_user) { | 530 bool by_user) { |
512 Send(new DesktopNotificationMsg_PostClose( | 531 Send(new DesktopNotificationMsg_PostClose( |
513 routing_id(), notification_id, by_user)); | 532 GetRoutingID(), notification_id, by_user)); |
514 } | 533 } |
515 | 534 |
516 void RenderViewHost::DesktopNotificationPostClick(int notification_id) { | 535 void RenderViewHostImpl::DesktopNotificationPostClick(int notification_id) { |
517 Send(new DesktopNotificationMsg_PostClick(routing_id(), notification_id)); | 536 Send(new DesktopNotificationMsg_PostClick(GetRoutingID(), notification_id)); |
518 } | 537 } |
519 | 538 |
520 void RenderViewHost::ExecuteJavascriptInWebFrame( | 539 void RenderViewHostImpl::ExecuteJavascriptInWebFrame( |
521 const string16& frame_xpath, | 540 const string16& frame_xpath, |
522 const string16& jscript) { | 541 const string16& jscript) { |
523 Send(new ViewMsg_ScriptEvalRequest(routing_id(), frame_xpath, jscript, | 542 Send(new ViewMsg_ScriptEvalRequest(GetRoutingID(), frame_xpath, jscript, |
524 0, false)); | 543 0, false)); |
525 } | 544 } |
526 | 545 |
527 int RenderViewHost::ExecuteJavascriptInWebFrameNotifyResult( | 546 int RenderViewHostImpl::ExecuteJavascriptInWebFrameNotifyResult( |
528 const string16& frame_xpath, | 547 const string16& frame_xpath, |
529 const string16& jscript) { | 548 const string16& jscript) { |
530 static int next_id = 1; | 549 static int next_id = 1; |
531 Send(new ViewMsg_ScriptEvalRequest(routing_id(), frame_xpath, jscript, | 550 Send(new ViewMsg_ScriptEvalRequest(GetRoutingID(), frame_xpath, jscript, |
532 next_id, true)); | 551 next_id, true)); |
533 return next_id++; | 552 return next_id++; |
534 } | 553 } |
535 | 554 |
536 typedef std::pair<int, Value*> ExecuteDetailType; | 555 typedef std::pair<int, Value*> ExecuteDetailType; |
537 | 556 |
538 ExecuteNotificationObserver::ExecuteNotificationObserver(int id) | 557 ExecuteNotificationObserver::ExecuteNotificationObserver(int id) |
539 : id_(id) { | 558 : id_(id) { |
540 } | 559 } |
541 | 560 |
542 ExecuteNotificationObserver::~ExecuteNotificationObserver() { | 561 ExecuteNotificationObserver::~ExecuteNotificationObserver() { |
543 } | 562 } |
544 | 563 |
545 void ExecuteNotificationObserver::Observe(int type, | 564 void ExecuteNotificationObserver::Observe(int type, |
546 const content::NotificationSource& source, | 565 const content::NotificationSource& source, |
547 const content::NotificationDetails& details) { | 566 const content::NotificationDetails& details) { |
548 content::Details<ExecuteDetailType> execute_details = | 567 content::Details<ExecuteDetailType> execute_details = |
549 static_cast<content::Details<ExecuteDetailType> >(details); | 568 static_cast<content::Details<ExecuteDetailType> >(details); |
550 int id = execute_details->first; | 569 int id = execute_details->first; |
551 if (id != id_) | 570 if (id != id_) |
552 return; | 571 return; |
553 Value* value = execute_details->second; | 572 Value* value = execute_details->second; |
554 if (value) | 573 if (value) |
555 value_.reset(value->DeepCopy()); | 574 value_.reset(value->DeepCopy()); |
556 MessageLoop::current()->Quit(); | 575 MessageLoop::current()->Quit(); |
557 } | 576 } |
558 | 577 |
559 Value* RenderViewHost::ExecuteJavascriptAndGetValue(const string16& frame_xpath, | 578 Value* RenderViewHostImpl::ExecuteJavascriptAndGetValue( |
560 const string16& jscript) { | 579 const string16& frame_xpath, |
| 580 const string16& jscript) { |
561 int id = ExecuteJavascriptInWebFrameNotifyResult(frame_xpath, jscript); | 581 int id = ExecuteJavascriptInWebFrameNotifyResult(frame_xpath, jscript); |
562 ExecuteNotificationObserver observer(id); | 582 ExecuteNotificationObserver observer(id); |
563 content::NotificationRegistrar notification_registrar; | 583 content::NotificationRegistrar notification_registrar; |
564 notification_registrar.Add( | 584 notification_registrar.Add( |
565 &observer, content::NOTIFICATION_EXECUTE_JAVASCRIPT_RESULT, | 585 &observer, content::NOTIFICATION_EXECUTE_JAVASCRIPT_RESULT, |
566 content::Source<RenderViewHost>(this)); | 586 content::Source<RenderViewHost>(this)); |
567 MessageLoop* loop = MessageLoop::current(); | 587 MessageLoop* loop = MessageLoop::current(); |
568 loop->Run(); | 588 loop->Run(); |
569 return observer.value()->DeepCopy(); | 589 return observer.value()->DeepCopy(); |
570 } | 590 } |
571 | 591 |
572 void RenderViewHost::JavaScriptDialogClosed(IPC::Message* reply_msg, | 592 void RenderViewHostImpl::JavaScriptDialogClosed(IPC::Message* reply_msg, |
573 bool success, | 593 bool success, |
574 const string16& user_input) { | 594 const string16& user_input) { |
575 process()->SetIgnoreInputEvents(false); | 595 GetProcess()->SetIgnoreInputEvents(false); |
576 bool is_waiting = | 596 bool is_waiting = |
577 is_waiting_for_beforeunload_ack_ || is_waiting_for_unload_ack_; | 597 is_waiting_for_beforeunload_ack_ || is_waiting_for_unload_ack_; |
578 if (is_waiting) | 598 if (is_waiting) |
579 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); | 599 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); |
580 | 600 |
581 ViewHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg, | 601 ViewHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg, |
582 success, user_input); | 602 success, user_input); |
583 Send(reply_msg); | 603 Send(reply_msg); |
584 | 604 |
585 // If we are waiting for an unload or beforeunload ack and the user has | 605 // If we are waiting for an unload or beforeunload ack and the user has |
586 // suppressed messages, kill the tab immediately; a page that's spamming | 606 // suppressed messages, kill the tab immediately; a page that's spamming |
587 // alerts in onbeforeunload is presumably malicious, so there's no point in | 607 // alerts in onbeforeunload is presumably malicious, so there's no point in |
588 // continuing to run its script and dragging out the process. | 608 // continuing to run its script and dragging out the process. |
589 // This must be done after sending the reply since RenderView can't close | 609 // This must be done after sending the reply since RenderView can't close |
590 // correctly while waiting for a response. | 610 // correctly while waiting for a response. |
591 if (is_waiting && are_javascript_messages_suppressed_) | 611 if (is_waiting && are_javascript_messages_suppressed_) |
592 delegate_->RendererUnresponsive(this, is_waiting); | 612 delegate_->RendererUnresponsive(this, is_waiting); |
593 } | 613 } |
594 | 614 |
595 void RenderViewHost::DragSourceEndedAt( | 615 void RenderViewHostImpl::DragSourceEndedAt( |
596 int client_x, int client_y, int screen_x, int screen_y, | 616 int client_x, int client_y, int screen_x, int screen_y, |
597 WebDragOperation operation) { | 617 WebDragOperation operation) { |
598 Send(new DragMsg_SourceEndedOrMoved( | 618 Send(new DragMsg_SourceEndedOrMoved( |
599 routing_id(), | 619 GetRoutingID(), |
600 gfx::Point(client_x, client_y), | 620 gfx::Point(client_x, client_y), |
601 gfx::Point(screen_x, screen_y), | 621 gfx::Point(screen_x, screen_y), |
602 true, operation)); | 622 true, operation)); |
603 } | 623 } |
604 | 624 |
605 void RenderViewHost::DragSourceMovedTo( | 625 void RenderViewHostImpl::DragSourceMovedTo( |
606 int client_x, int client_y, int screen_x, int screen_y) { | 626 int client_x, int client_y, int screen_x, int screen_y) { |
607 Send(new DragMsg_SourceEndedOrMoved( | 627 Send(new DragMsg_SourceEndedOrMoved( |
608 routing_id(), | 628 GetRoutingID(), |
609 gfx::Point(client_x, client_y), | 629 gfx::Point(client_x, client_y), |
610 gfx::Point(screen_x, screen_y), | 630 gfx::Point(screen_x, screen_y), |
611 false, WebDragOperationNone)); | 631 false, WebDragOperationNone)); |
612 } | 632 } |
613 | 633 |
614 void RenderViewHost::DragSourceSystemDragEnded() { | 634 void RenderViewHostImpl::DragSourceSystemDragEnded() { |
615 Send(new DragMsg_SourceSystemDragEnded(routing_id())); | 635 Send(new DragMsg_SourceSystemDragEnded(GetRoutingID())); |
616 } | 636 } |
617 | 637 |
618 void RenderViewHost::AllowBindings(int bindings_flags) { | 638 void RenderViewHostImpl::AllowBindings(int bindings_flags) { |
619 if (bindings_flags & content::BINDINGS_POLICY_WEB_UI) { | 639 if (bindings_flags & content::BINDINGS_POLICY_WEB_UI) { |
620 ChildProcessSecurityPolicyImpl::GetInstance()->GrantWebUIBindings( | 640 ChildProcessSecurityPolicyImpl::GetInstance()->GrantWebUIBindings( |
621 process()->GetID()); | 641 GetProcess()->GetID()); |
622 } | 642 } |
623 | 643 |
624 enabled_bindings_ |= bindings_flags; | 644 enabled_bindings_ |= bindings_flags; |
625 if (renderer_initialized_) | 645 if (renderer_initialized_) |
626 Send(new ViewMsg_AllowBindings(routing_id(), enabled_bindings_)); | 646 Send(new ViewMsg_AllowBindings(GetRoutingID(), enabled_bindings_)); |
627 } | 647 } |
628 | 648 |
629 void RenderViewHost::SetWebUIProperty(const std::string& name, | 649 int RenderViewHostImpl::GetEnabledBindings() const { |
630 const std::string& value) { | 650 return enabled_bindings_; |
631 DCHECK(enabled_bindings_ & content::BINDINGS_POLICY_WEB_UI); | |
632 Send(new ViewMsg_SetWebUIProperty(routing_id(), name, value)); | |
633 } | 651 } |
634 | 652 |
635 void RenderViewHost::GotFocus() { | 653 void RenderViewHostImpl::SetWebUIProperty(const std::string& name, |
| 654 const std::string& value) { |
| 655 DCHECK(enabled_bindings_ & content::BINDINGS_POLICY_WEB_UI); |
| 656 Send(new ViewMsg_SetWebUIProperty(GetRoutingID(), name, value)); |
| 657 } |
| 658 |
| 659 void RenderViewHostImpl::GotFocus() { |
636 RenderWidgetHostImpl::GotFocus(); // Notifies the renderer it got focus. | 660 RenderWidgetHostImpl::GotFocus(); // Notifies the renderer it got focus. |
637 | 661 |
638 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); | 662 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); |
639 if (view) | 663 if (view) |
640 view->GotFocus(); | 664 view->GotFocus(); |
641 } | 665 } |
642 | 666 |
643 void RenderViewHost::LostCapture() { | 667 void RenderViewHostImpl::LostCapture() { |
644 RenderWidgetHostImpl::LostCapture(); | 668 RenderWidgetHostImpl::LostCapture(); |
645 delegate_->LostCapture(); | 669 delegate_->LostCapture(); |
646 } | 670 } |
647 | 671 |
648 void RenderViewHost::LostMouseLock() { | 672 void RenderViewHostImpl::LostMouseLock() { |
649 RenderWidgetHostImpl::LostMouseLock(); | 673 RenderWidgetHostImpl::LostMouseLock(); |
650 delegate_->LostMouseLock(); | 674 delegate_->LostMouseLock(); |
651 } | 675 } |
652 | 676 |
653 void RenderViewHost::SetInitialFocus(bool reverse) { | 677 void RenderViewHostImpl::SetInitialFocus(bool reverse) { |
654 Send(new ViewMsg_SetInitialFocus(routing_id(), reverse)); | 678 Send(new ViewMsg_SetInitialFocus(GetRoutingID(), reverse)); |
655 } | 679 } |
656 | 680 |
657 void RenderViewHost::FilesSelectedInChooser( | 681 void RenderViewHostImpl::FilesSelectedInChooser( |
658 const std::vector<FilePath>& files, | 682 const std::vector<FilePath>& files, |
659 int permissions) { | 683 int permissions) { |
660 // Grant the security access requested to the given files. | 684 // Grant the security access requested to the given files. |
661 for (std::vector<FilePath>::const_iterator file = files.begin(); | 685 for (std::vector<FilePath>::const_iterator file = files.begin(); |
662 file != files.end(); ++file) { | 686 file != files.end(); ++file) { |
663 ChildProcessSecurityPolicyImpl::GetInstance()->GrantPermissionsForFile( | 687 ChildProcessSecurityPolicyImpl::GetInstance()->GrantPermissionsForFile( |
664 process()->GetID(), *file, permissions); | 688 GetProcess()->GetID(), *file, permissions); |
665 } | 689 } |
666 Send(new ViewMsg_RunFileChooserResponse(routing_id(), files)); | 690 Send(new ViewMsg_RunFileChooserResponse(GetRoutingID(), files)); |
667 } | 691 } |
668 | 692 |
669 void RenderViewHost::DirectoryEnumerationFinished( | 693 void RenderViewHostImpl::DirectoryEnumerationFinished( |
670 int request_id, | 694 int request_id, |
671 const std::vector<FilePath>& files) { | 695 const std::vector<FilePath>& files) { |
672 // Grant the security access requested to the given files. | 696 // Grant the security access requested to the given files. |
673 for (std::vector<FilePath>::const_iterator file = files.begin(); | 697 for (std::vector<FilePath>::const_iterator file = files.begin(); |
674 file != files.end(); ++file) { | 698 file != files.end(); ++file) { |
675 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile( | 699 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile( |
676 process()->GetID(), *file); | 700 GetProcess()->GetID(), *file); |
677 } | 701 } |
678 Send(new ViewMsg_EnumerateDirectoryResponse(routing_id(), | 702 Send(new ViewMsg_EnumerateDirectoryResponse(GetRoutingID(), |
679 request_id, | 703 request_id, |
680 files)); | 704 files)); |
681 } | 705 } |
682 | 706 |
683 void RenderViewHost::LoadStateChanged(const GURL& url, | 707 void RenderViewHostImpl::LoadStateChanged( |
684 const net::LoadStateWithParam& load_state, | 708 const GURL& url, |
685 uint64 upload_position, | 709 const net::LoadStateWithParam& load_state, |
686 uint64 upload_size) { | 710 uint64 upload_position, |
| 711 uint64 upload_size) { |
687 delegate_->LoadStateChanged(url, load_state, upload_position, upload_size); | 712 delegate_->LoadStateChanged(url, load_state, upload_position, upload_size); |
688 } | 713 } |
689 | 714 |
690 bool RenderViewHost::SuddenTerminationAllowed() const { | 715 bool RenderViewHostImpl::SuddenTerminationAllowed() const { |
691 return sudden_termination_allowed_ || process()->SuddenTerminationAllowed(); | 716 return sudden_termination_allowed_ || |
| 717 GetProcess()->SuddenTerminationAllowed(); |
692 } | 718 } |
693 | 719 |
694 /////////////////////////////////////////////////////////////////////////////// | 720 /////////////////////////////////////////////////////////////////////////////// |
695 // RenderViewHost, IPC message handlers: | 721 // RenderViewHostImpl, IPC message handlers: |
696 | 722 |
697 bool RenderViewHost::OnMessageReceived(const IPC::Message& msg) { | 723 bool RenderViewHostImpl::OnMessageReceived(const IPC::Message& msg) { |
698 if (!BrowserMessageFilter::CheckCanDispatchOnUI(msg, this)) | 724 if (!BrowserMessageFilter::CheckCanDispatchOnUI(msg, this)) |
699 return true; | 725 return true; |
700 | 726 |
701 // Filter out most IPC messages if this renderer is swapped out. | 727 // Filter out most IPC messages if this renderer is swapped out. |
702 // We still want to handle certain ACKs to keep our state consistent. | 728 // We still want to handle certain ACKs to keep our state consistent. |
703 if (is_swapped_out_) { | 729 if (is_swapped_out_) { |
704 if (!content::SwappedOutMessages::CanHandleWhileSwappedOut(msg)) { | 730 if (!content::SwappedOutMessages::CanHandleWhileSwappedOut(msg)) { |
705 // If this is a synchronous message and we decided not to handle it, | 731 // If this is a synchronous message and we decided not to handle it, |
706 // we must send an error reply, or else the renderer will be stuck | 732 // we must send an error reply, or else the renderer will be stuck |
707 // and won't respond to future requests. | 733 // and won't respond to future requests. |
(...skipping 12 matching lines...) Expand all Loading... |
720 while ((observer = it.GetNext()) != NULL) { | 746 while ((observer = it.GetNext()) != NULL) { |
721 if (observer->OnMessageReceived(msg)) | 747 if (observer->OnMessageReceived(msg)) |
722 return true; | 748 return true; |
723 } | 749 } |
724 | 750 |
725 if (delegate_->OnMessageReceived(msg)) | 751 if (delegate_->OnMessageReceived(msg)) |
726 return true; | 752 return true; |
727 | 753 |
728 bool handled = true; | 754 bool handled = true; |
729 bool msg_is_ok = true; | 755 bool msg_is_ok = true; |
730 IPC_BEGIN_MESSAGE_MAP_EX(RenderViewHost, msg, msg_is_ok) | 756 IPC_BEGIN_MESSAGE_MAP_EX(RenderViewHostImpl, msg, msg_is_ok) |
731 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowView, OnMsgShowView) | 757 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowView, OnMsgShowView) |
732 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnMsgShowWidget) | 758 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnMsgShowWidget) |
733 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowFullscreenWidget, | 759 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowFullscreenWidget, |
734 OnMsgShowFullscreenWidget) | 760 OnMsgShowFullscreenWidget) |
735 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunModal, OnMsgRunModal) | 761 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunModal, OnMsgRunModal) |
736 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnMsgRenderViewReady) | 762 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnMsgRenderViewReady) |
737 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewGone, OnMsgRenderViewGone) | 763 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewGone, OnMsgRenderViewGone) |
738 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_FrameNavigate, OnMsgNavigate(msg)) | 764 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_FrameNavigate, OnMsgNavigate(msg)) |
739 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateState, OnMsgUpdateState) | 765 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateState, OnMsgUpdateState) |
740 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTitle, OnMsgUpdateTitle) | 766 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTitle, OnMsgUpdateTitle) |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 OnAccessibilityNotifications) | 825 OnAccessibilityNotifications) |
800 // Have the super handle all other messages. | 826 // Have the super handle all other messages. |
801 IPC_MESSAGE_UNHANDLED( | 827 IPC_MESSAGE_UNHANDLED( |
802 handled = RenderWidgetHostImpl::OnMessageReceived(msg)) | 828 handled = RenderWidgetHostImpl::OnMessageReceived(msg)) |
803 IPC_END_MESSAGE_MAP_EX() | 829 IPC_END_MESSAGE_MAP_EX() |
804 | 830 |
805 if (!msg_is_ok) { | 831 if (!msg_is_ok) { |
806 // The message had a handler, but its de-serialization failed. | 832 // The message had a handler, but its de-serialization failed. |
807 // Kill the renderer. | 833 // Kill the renderer. |
808 content::RecordAction(UserMetricsAction("BadMessageTerminate_RVH")); | 834 content::RecordAction(UserMetricsAction("BadMessageTerminate_RVH")); |
809 process()->ReceivedBadMessage(); | 835 GetProcess()->ReceivedBadMessage(); |
810 } | 836 } |
811 | 837 |
812 return handled; | 838 return handled; |
813 } | 839 } |
814 | 840 |
815 void RenderViewHost::Shutdown() { | 841 void RenderViewHostImpl::Shutdown() { |
816 // If we are being run modally (see RunModal), then we need to cleanup. | 842 // If we are being run modally (see RunModal), then we need to cleanup. |
817 if (run_modal_reply_msg_) { | 843 if (run_modal_reply_msg_) { |
818 Send(run_modal_reply_msg_); | 844 Send(run_modal_reply_msg_); |
819 run_modal_reply_msg_ = NULL; | 845 run_modal_reply_msg_ = NULL; |
820 } | 846 } |
821 | 847 |
822 RenderWidgetHostImpl::Shutdown(); | 848 RenderWidgetHostImpl::Shutdown(); |
823 } | 849 } |
824 | 850 |
825 bool RenderViewHost::IsRenderView() const { | 851 bool RenderViewHostImpl::IsRenderView() const { |
826 return true; | 852 return true; |
827 } | 853 } |
828 | 854 |
829 void RenderViewHost::CreateNewWindow( | 855 void RenderViewHostImpl::CreateNewWindow( |
830 int route_id, | 856 int route_id, |
831 const ViewHostMsg_CreateWindow_Params& params) { | 857 const ViewHostMsg_CreateWindow_Params& params) { |
832 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); | 858 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); |
833 if (!view) | 859 if (!view) |
834 return; | 860 return; |
835 | 861 |
836 view->CreateNewWindow(route_id, params); | 862 view->CreateNewWindow(route_id, params); |
837 } | 863 } |
838 | 864 |
839 void RenderViewHost::CreateNewWidget(int route_id, | 865 void RenderViewHostImpl::CreateNewWidget(int route_id, |
840 WebKit::WebPopupType popup_type) { | 866 WebKit::WebPopupType popup_type) { |
841 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); | 867 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); |
842 if (view) | 868 if (view) |
843 view->CreateNewWidget(route_id, popup_type); | 869 view->CreateNewWidget(route_id, popup_type); |
844 } | 870 } |
845 | 871 |
846 void RenderViewHost::CreateNewFullscreenWidget(int route_id) { | 872 void RenderViewHostImpl::CreateNewFullscreenWidget(int route_id) { |
847 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); | 873 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); |
848 if (view) | 874 if (view) |
849 view->CreateNewFullscreenWidget(route_id); | 875 view->CreateNewFullscreenWidget(route_id); |
850 } | 876 } |
851 | 877 |
852 void RenderViewHost::OnMsgShowView(int route_id, | 878 void RenderViewHostImpl::OnMsgShowView(int route_id, |
853 WindowOpenDisposition disposition, | 879 WindowOpenDisposition disposition, |
854 const gfx::Rect& initial_pos, | 880 const gfx::Rect& initial_pos, |
855 bool user_gesture) { | 881 bool user_gesture) { |
856 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); | 882 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); |
857 if (view) { | 883 if (view) { |
858 if (!is_swapped_out_) | 884 if (!is_swapped_out_) |
859 view->ShowCreatedWindow(route_id, disposition, initial_pos, user_gesture); | 885 view->ShowCreatedWindow(route_id, disposition, initial_pos, user_gesture); |
860 Send(new ViewMsg_Move_ACK(route_id)); | 886 Send(new ViewMsg_Move_ACK(route_id)); |
861 } | 887 } |
862 } | 888 } |
863 | 889 |
864 void RenderViewHost::OnMsgShowWidget(int route_id, | 890 void RenderViewHostImpl::OnMsgShowWidget(int route_id, |
865 const gfx::Rect& initial_pos) { | 891 const gfx::Rect& initial_pos) { |
866 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); | 892 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); |
867 if (view) { | 893 if (view) { |
868 if (!is_swapped_out_) | 894 if (!is_swapped_out_) |
869 view->ShowCreatedWidget(route_id, initial_pos); | 895 view->ShowCreatedWidget(route_id, initial_pos); |
870 Send(new ViewMsg_Move_ACK(route_id)); | 896 Send(new ViewMsg_Move_ACK(route_id)); |
871 } | 897 } |
872 } | 898 } |
873 | 899 |
874 void RenderViewHost::OnMsgShowFullscreenWidget(int route_id) { | 900 void RenderViewHostImpl::OnMsgShowFullscreenWidget(int route_id) { |
875 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); | 901 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); |
876 if (view) { | 902 if (view) { |
877 if (!is_swapped_out_) | 903 if (!is_swapped_out_) |
878 view->ShowCreatedFullscreenWidget(route_id); | 904 view->ShowCreatedFullscreenWidget(route_id); |
879 Send(new ViewMsg_Move_ACK(route_id)); | 905 Send(new ViewMsg_Move_ACK(route_id)); |
880 } | 906 } |
881 } | 907 } |
882 | 908 |
883 void RenderViewHost::OnMsgRunModal(IPC::Message* reply_msg) { | 909 void RenderViewHostImpl::OnMsgRunModal(IPC::Message* reply_msg) { |
884 DCHECK(!run_modal_reply_msg_); | 910 DCHECK(!run_modal_reply_msg_); |
885 run_modal_reply_msg_ = reply_msg; | 911 run_modal_reply_msg_ = reply_msg; |
886 | 912 |
887 content::RecordAction(UserMetricsAction("ShowModalDialog")); | 913 content::RecordAction(UserMetricsAction("ShowModalDialog")); |
888 | 914 |
889 // TODO(darin): Bug 1107929: Need to inform our delegate to show this view in | 915 // TODO(darin): Bug 1107929: Need to inform our delegate to show this view in |
890 // an app-modal fashion. | 916 // an app-modal fashion. |
891 } | 917 } |
892 | 918 |
893 void RenderViewHost::OnMsgRenderViewReady() { | 919 void RenderViewHostImpl::OnMsgRenderViewReady() { |
894 render_view_termination_status_ = base::TERMINATION_STATUS_STILL_RUNNING; | 920 render_view_termination_status_ = base::TERMINATION_STATUS_STILL_RUNNING; |
895 WasResized(); | 921 WasResized(); |
896 delegate_->RenderViewReady(this); | 922 delegate_->RenderViewReady(this); |
897 } | 923 } |
898 | 924 |
899 void RenderViewHost::OnMsgRenderViewGone(int status, int exit_code) { | 925 void RenderViewHostImpl::OnMsgRenderViewGone(int status, int exit_code) { |
900 // Keep the termination status so we can get at it later when we | 926 // Keep the termination status so we can get at it later when we |
901 // need to know why it died. | 927 // need to know why it died. |
902 render_view_termination_status_ = | 928 render_view_termination_status_ = |
903 static_cast<base::TerminationStatus>(status); | 929 static_cast<base::TerminationStatus>(status); |
904 | 930 |
905 // Reset state. | 931 // Reset state. |
906 ClearPowerSaveBlockers(); | 932 ClearPowerSaveBlockers(); |
907 | 933 |
908 // Our base class RenderWidgetHost needs to reset some stuff. | 934 // Our base class RenderWidgetHost needs to reset some stuff. |
909 RendererExited(render_view_termination_status_, exit_code); | 935 RendererExited(render_view_termination_status_, exit_code); |
910 | 936 |
911 delegate_->RenderViewGone(this, | 937 delegate_->RenderViewGone(this, |
912 static_cast<base::TerminationStatus>(status), | 938 static_cast<base::TerminationStatus>(status), |
913 exit_code); | 939 exit_code); |
914 } | 940 } |
915 | 941 |
916 // Called when the renderer navigates. For every frame loaded, we'll get this | 942 // Called when the renderer navigates. For every frame loaded, we'll get this |
917 // notification containing parameters identifying the navigation. | 943 // notification containing parameters identifying the navigation. |
918 // | 944 // |
919 // Subframes are identified by the page transition type. For subframes loaded | 945 // Subframes are identified by the page transition type. For subframes loaded |
920 // as part of a wider page load, the page_id will be the same as for the top | 946 // as part of a wider page load, the page_id will be the same as for the top |
921 // level frame. If the user explicitly requests a subframe navigation, we will | 947 // level frame. If the user explicitly requests a subframe navigation, we will |
922 // get a new page_id because we need to create a new navigation entry for that | 948 // get a new page_id because we need to create a new navigation entry for that |
923 // action. | 949 // action. |
924 void RenderViewHost::OnMsgNavigate(const IPC::Message& msg) { | 950 void RenderViewHostImpl::OnMsgNavigate(const IPC::Message& msg) { |
925 // Read the parameters out of the IPC message directly to avoid making another | 951 // Read the parameters out of the IPC message directly to avoid making another |
926 // copy when we filter the URLs. | 952 // copy when we filter the URLs. |
927 void* iter = NULL; | 953 void* iter = NULL; |
928 ViewHostMsg_FrameNavigate_Params validated_params; | 954 ViewHostMsg_FrameNavigate_Params validated_params; |
929 if (!IPC::ParamTraits<ViewHostMsg_FrameNavigate_Params>:: | 955 if (!IPC::ParamTraits<ViewHostMsg_FrameNavigate_Params>:: |
930 Read(&msg, &iter, &validated_params)) | 956 Read(&msg, &iter, &validated_params)) |
931 return; | 957 return; |
932 | 958 |
933 // If we're waiting for a cross-site beforeunload ack from this renderer and | 959 // If we're waiting for a cross-site beforeunload ack from this renderer and |
934 // we receive a Navigate message from the main frame, then the renderer was | 960 // we receive a Navigate message from the main frame, then the renderer was |
935 // navigating already and sent it before hearing the ViewMsg_Stop message. | 961 // navigating already and sent it before hearing the ViewMsg_Stop message. |
936 // We do not want to cancel the pending navigation in this case, since the | 962 // We do not want to cancel the pending navigation in this case, since the |
937 // old page will soon be stopped. Instead, treat this as a beforeunload ack | 963 // old page will soon be stopped. Instead, treat this as a beforeunload ack |
938 // to allow the pending navigation to continue. | 964 // to allow the pending navigation to continue. |
939 if (is_waiting_for_beforeunload_ack_ && | 965 if (is_waiting_for_beforeunload_ack_ && |
940 unload_ack_is_for_cross_site_transition_ && | 966 unload_ack_is_for_cross_site_transition_ && |
941 content::PageTransitionIsMainFrame(validated_params.transition)) { | 967 content::PageTransitionIsMainFrame(validated_params.transition)) { |
942 OnMsgShouldCloseACK(true); | 968 OnMsgShouldCloseACK(true); |
943 return; | 969 return; |
944 } | 970 } |
945 | 971 |
946 // If we're waiting for an unload ack from this renderer and we receive a | 972 // If we're waiting for an unload ack from this renderer and we receive a |
947 // Navigate message, then the renderer was navigating before it received the | 973 // Navigate message, then the renderer was navigating before it received the |
948 // unload request. It will either respond to the unload request soon or our | 974 // unload request. It will either respond to the unload request soon or our |
949 // timer will expire. Either way, we should ignore this message, because we | 975 // timer will expire. Either way, we should ignore this message, because we |
950 // have already committed to closing this renderer. | 976 // have already committed to closing this renderer. |
951 if (is_waiting_for_unload_ack_) | 977 if (is_waiting_for_unload_ack_) |
952 return; | 978 return; |
953 | 979 |
954 const int renderer_id = process()->GetID(); | 980 const int renderer_id = GetProcess()->GetID(); |
955 ChildProcessSecurityPolicyImpl* policy = | 981 ChildProcessSecurityPolicyImpl* policy = |
956 ChildProcessSecurityPolicyImpl::GetInstance(); | 982 ChildProcessSecurityPolicyImpl::GetInstance(); |
957 // Without this check, an evil renderer can trick the browser into creating | 983 // Without this check, an evil renderer can trick the browser into creating |
958 // a navigation entry for a banned URL. If the user clicks the back button | 984 // a navigation entry for a banned URL. If the user clicks the back button |
959 // followed by the forward button (or clicks reload, or round-trips through | 985 // followed by the forward button (or clicks reload, or round-trips through |
960 // session restore, etc), we'll think that the browser commanded the | 986 // session restore, etc), we'll think that the browser commanded the |
961 // renderer to load the URL and grant the renderer the privileges to request | 987 // renderer to load the URL and grant the renderer the privileges to request |
962 // the URL. To prevent this attack, we block the renderer from inserting | 988 // the URL. To prevent this attack, we block the renderer from inserting |
963 // banned URLs into the navigation controller in the first place. | 989 // banned URLs into the navigation controller in the first place. |
964 FilterURL(policy, renderer_id, &validated_params.url); | 990 FilterURL(policy, renderer_id, &validated_params.url); |
965 FilterURL(policy, renderer_id, &validated_params.referrer.url); | 991 FilterURL(policy, renderer_id, &validated_params.referrer.url); |
966 for (std::vector<GURL>::iterator it(validated_params.redirects.begin()); | 992 for (std::vector<GURL>::iterator it(validated_params.redirects.begin()); |
967 it != validated_params.redirects.end(); ++it) { | 993 it != validated_params.redirects.end(); ++it) { |
968 FilterURL(policy, renderer_id, &(*it)); | 994 FilterURL(policy, renderer_id, &(*it)); |
969 } | 995 } |
970 FilterURL(policy, renderer_id, &validated_params.searchable_form_url); | 996 FilterURL(policy, renderer_id, &validated_params.searchable_form_url); |
971 FilterURL(policy, renderer_id, &validated_params.password_form.origin); | 997 FilterURL(policy, renderer_id, &validated_params.password_form.origin); |
972 FilterURL(policy, renderer_id, &validated_params.password_form.action); | 998 FilterURL(policy, renderer_id, &validated_params.password_form.action); |
973 | 999 |
974 delegate_->DidNavigate(this, validated_params); | 1000 delegate_->DidNavigate(this, validated_params); |
975 } | 1001 } |
976 | 1002 |
977 void RenderViewHost::OnMsgUpdateState(int32 page_id, | 1003 void RenderViewHostImpl::OnMsgUpdateState(int32 page_id, |
978 const std::string& state) { | 1004 const std::string& state) { |
979 delegate_->UpdateState(this, page_id, state); | 1005 delegate_->UpdateState(this, page_id, state); |
980 } | 1006 } |
981 | 1007 |
982 void RenderViewHost::OnMsgUpdateTitle( | 1008 void RenderViewHostImpl::OnMsgUpdateTitle( |
983 int32 page_id, | 1009 int32 page_id, |
984 const string16& title, | 1010 const string16& title, |
985 WebKit::WebTextDirection title_direction) { | 1011 WebKit::WebTextDirection title_direction) { |
986 if (title.length() > content::kMaxTitleChars) { | 1012 if (title.length() > content::kMaxTitleChars) { |
987 NOTREACHED() << "Renderer sent too many characters in title."; | 1013 NOTREACHED() << "Renderer sent too many characters in title."; |
988 return; | 1014 return; |
989 } | 1015 } |
990 | 1016 |
991 delegate_->UpdateTitle(this, page_id, title, | 1017 delegate_->UpdateTitle(this, page_id, title, |
992 WebTextDirectionToChromeTextDirection( | 1018 WebTextDirectionToChromeTextDirection( |
993 title_direction)); | 1019 title_direction)); |
994 } | 1020 } |
995 | 1021 |
996 void RenderViewHost::OnMsgUpdateEncoding(const std::string& encoding_name) { | 1022 void RenderViewHostImpl::OnMsgUpdateEncoding(const std::string& encoding_name) { |
997 delegate_->UpdateEncoding(this, encoding_name); | 1023 delegate_->UpdateEncoding(this, encoding_name); |
998 } | 1024 } |
999 | 1025 |
1000 void RenderViewHost::OnMsgUpdateTargetURL(int32 page_id, | 1026 void RenderViewHostImpl::OnMsgUpdateTargetURL(int32 page_id, |
1001 const GURL& url) { | 1027 const GURL& url) { |
1002 if (!is_swapped_out_) | 1028 if (!is_swapped_out_) |
1003 delegate_->UpdateTargetURL(page_id, url); | 1029 delegate_->UpdateTargetURL(page_id, url); |
1004 | 1030 |
1005 // Send a notification back to the renderer that we are ready to | 1031 // Send a notification back to the renderer that we are ready to |
1006 // receive more target urls. | 1032 // receive more target urls. |
1007 Send(new ViewMsg_UpdateTargetURL_ACK(routing_id())); | 1033 Send(new ViewMsg_UpdateTargetURL_ACK(GetRoutingID())); |
1008 } | 1034 } |
1009 | 1035 |
1010 void RenderViewHost::OnUpdateInspectorSetting( | 1036 void RenderViewHostImpl::OnUpdateInspectorSetting( |
1011 const std::string& key, const std::string& value) { | 1037 const std::string& key, const std::string& value) { |
1012 content::GetContentClient()->browser()->UpdateInspectorSetting( | 1038 content::GetContentClient()->browser()->UpdateInspectorSetting( |
1013 this, key, value); | 1039 this, key, value); |
1014 } | 1040 } |
1015 | 1041 |
1016 void RenderViewHost::OnMsgClose() { | 1042 void RenderViewHostImpl::OnMsgClose() { |
1017 // If the renderer is telling us to close, it has already run the unload | 1043 // If the renderer is telling us to close, it has already run the unload |
1018 // events, and we can take the fast path. | 1044 // events, and we can take the fast path. |
1019 ClosePageIgnoringUnloadEvents(); | 1045 ClosePageIgnoringUnloadEvents(); |
1020 } | 1046 } |
1021 | 1047 |
1022 void RenderViewHost::OnMsgRequestMove(const gfx::Rect& pos) { | 1048 void RenderViewHostImpl::OnMsgRequestMove(const gfx::Rect& pos) { |
1023 if (!is_swapped_out_) | 1049 if (!is_swapped_out_) |
1024 delegate_->RequestMove(pos); | 1050 delegate_->RequestMove(pos); |
1025 Send(new ViewMsg_Move_ACK(routing_id())); | 1051 Send(new ViewMsg_Move_ACK(GetRoutingID())); |
1026 } | 1052 } |
1027 | 1053 |
1028 void RenderViewHost::OnMsgDidStartLoading() { | 1054 void RenderViewHostImpl::OnMsgDidStartLoading() { |
1029 delegate_->DidStartLoading(); | 1055 delegate_->DidStartLoading(); |
1030 } | 1056 } |
1031 | 1057 |
1032 void RenderViewHost::OnMsgDidStopLoading() { | 1058 void RenderViewHostImpl::OnMsgDidStopLoading() { |
1033 delegate_->DidStopLoading(); | 1059 delegate_->DidStopLoading(); |
1034 } | 1060 } |
1035 | 1061 |
1036 void RenderViewHost::OnMsgDidChangeLoadProgress(double load_progress) { | 1062 void RenderViewHostImpl::OnMsgDidChangeLoadProgress(double load_progress) { |
1037 delegate_->DidChangeLoadProgress(load_progress); | 1063 delegate_->DidChangeLoadProgress(load_progress); |
1038 } | 1064 } |
1039 | 1065 |
1040 void RenderViewHost::OnMsgDocumentAvailableInMainFrame() { | 1066 void RenderViewHostImpl::OnMsgDocumentAvailableInMainFrame() { |
1041 delegate_->DocumentAvailableInMainFrame(this); | 1067 delegate_->DocumentAvailableInMainFrame(this); |
1042 } | 1068 } |
1043 | 1069 |
1044 void RenderViewHost::OnMsgDocumentOnLoadCompletedInMainFrame(int32 page_id) { | 1070 void RenderViewHostImpl::OnMsgDocumentOnLoadCompletedInMainFrame( |
| 1071 int32 page_id) { |
1045 delegate_->DocumentOnLoadCompletedInMainFrame(this, page_id); | 1072 delegate_->DocumentOnLoadCompletedInMainFrame(this, page_id); |
1046 } | 1073 } |
1047 | 1074 |
1048 void RenderViewHost::OnMsgContextMenu( | 1075 void RenderViewHostImpl::OnMsgContextMenu( |
1049 const content::ContextMenuParams& params) { | 1076 const content::ContextMenuParams& params) { |
1050 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); | 1077 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); |
1051 if (!view) | 1078 if (!view) |
1052 return; | 1079 return; |
1053 | 1080 |
1054 // Validate the URLs in |params|. If the renderer can't request the URLs | 1081 // Validate the URLs in |params|. If the renderer can't request the URLs |
1055 // directly, don't show them in the context menu. | 1082 // directly, don't show them in the context menu. |
1056 content::ContextMenuParams validated_params(params); | 1083 content::ContextMenuParams validated_params(params); |
1057 int renderer_id = process()->GetID(); | 1084 int renderer_id = GetProcess()->GetID(); |
1058 ChildProcessSecurityPolicyImpl* policy = | 1085 ChildProcessSecurityPolicyImpl* policy = |
1059 ChildProcessSecurityPolicyImpl::GetInstance(); | 1086 ChildProcessSecurityPolicyImpl::GetInstance(); |
1060 | 1087 |
1061 // We don't validate |unfiltered_link_url| so that this field can be used | 1088 // We don't validate |unfiltered_link_url| so that this field can be used |
1062 // when users want to copy the original link URL. | 1089 // when users want to copy the original link URL. |
1063 FilterURL(policy, renderer_id, &validated_params.link_url); | 1090 FilterURL(policy, renderer_id, &validated_params.link_url); |
1064 FilterURL(policy, renderer_id, &validated_params.src_url); | 1091 FilterURL(policy, renderer_id, &validated_params.src_url); |
1065 FilterURL(policy, renderer_id, &validated_params.page_url); | 1092 FilterURL(policy, renderer_id, &validated_params.page_url); |
1066 FilterURL(policy, renderer_id, &validated_params.frame_url); | 1093 FilterURL(policy, renderer_id, &validated_params.frame_url); |
1067 | 1094 |
1068 view->ShowContextMenu(validated_params); | 1095 view->ShowContextMenu(validated_params); |
1069 } | 1096 } |
1070 | 1097 |
1071 void RenderViewHost::OnMsgToggleFullscreen(bool enter_fullscreen) { | 1098 void RenderViewHostImpl::OnMsgToggleFullscreen(bool enter_fullscreen) { |
1072 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1099 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1073 delegate_->ToggleFullscreenMode(enter_fullscreen); | 1100 delegate_->ToggleFullscreenMode(enter_fullscreen); |
1074 } | 1101 } |
1075 | 1102 |
1076 void RenderViewHost::OnMsgOpenURL(const GURL& url, | 1103 void RenderViewHostImpl::OnMsgOpenURL(const GURL& url, |
1077 const content::Referrer& referrer, | 1104 const content::Referrer& referrer, |
1078 WindowOpenDisposition disposition, | 1105 WindowOpenDisposition disposition, |
1079 int64 source_frame_id) { | 1106 int64 source_frame_id) { |
1080 GURL validated_url(url); | 1107 GURL validated_url(url); |
1081 FilterURL(ChildProcessSecurityPolicyImpl::GetInstance(), | 1108 FilterURL(ChildProcessSecurityPolicyImpl::GetInstance(), |
1082 process()->GetID(), &validated_url); | 1109 GetProcess()->GetID(), &validated_url); |
1083 | 1110 |
1084 delegate_->RequestOpenURL( | 1111 delegate_->RequestOpenURL( |
1085 validated_url, referrer, disposition, source_frame_id); | 1112 validated_url, referrer, disposition, source_frame_id); |
1086 } | 1113 } |
1087 | 1114 |
1088 void RenderViewHost::OnMsgDidContentsPreferredSizeChange( | 1115 void RenderViewHostImpl::OnMsgDidContentsPreferredSizeChange( |
1089 const gfx::Size& new_size) { | 1116 const gfx::Size& new_size) { |
1090 delegate_->UpdatePreferredSize(new_size); | 1117 delegate_->UpdatePreferredSize(new_size); |
1091 } | 1118 } |
1092 | 1119 |
1093 void RenderViewHost::OnRenderAutoResized(const gfx::Size& new_size) { | 1120 void RenderViewHostImpl::OnRenderAutoResized(const gfx::Size& new_size) { |
1094 delegate_->UpdatePreferredSize(new_size); | 1121 delegate_->UpdatePreferredSize(new_size); |
1095 } | 1122 } |
1096 | 1123 |
1097 void RenderViewHost::OnMsgDidChangeScrollbarsForMainFrame( | 1124 void RenderViewHostImpl::OnMsgDidChangeScrollbarsForMainFrame( |
1098 bool has_horizontal_scrollbar, bool has_vertical_scrollbar) { | 1125 bool has_horizontal_scrollbar, bool has_vertical_scrollbar) { |
1099 if (view_) | 1126 if (view_) |
1100 view_->SetHasHorizontalScrollbar(has_horizontal_scrollbar); | 1127 view_->SetHasHorizontalScrollbar(has_horizontal_scrollbar); |
1101 } | 1128 } |
1102 | 1129 |
1103 void RenderViewHost::OnMsgDidChangeScrollOffsetPinningForMainFrame( | 1130 void RenderViewHostImpl::OnMsgDidChangeScrollOffsetPinningForMainFrame( |
1104 bool is_pinned_to_left, bool is_pinned_to_right) { | 1131 bool is_pinned_to_left, bool is_pinned_to_right) { |
1105 if (view_) | 1132 if (view_) |
1106 view_->SetScrollOffsetPinning(is_pinned_to_left, is_pinned_to_right); | 1133 view_->SetScrollOffsetPinning(is_pinned_to_left, is_pinned_to_right); |
1107 } | 1134 } |
1108 | 1135 |
1109 void RenderViewHost::OnMsgDidChangeNumWheelEvents(int count) { | 1136 void RenderViewHostImpl::OnMsgDidChangeNumWheelEvents(int count) { |
1110 } | 1137 } |
1111 | 1138 |
1112 void RenderViewHost::OnMsgSelectionChanged(const string16& text, | 1139 void RenderViewHostImpl::OnMsgSelectionChanged(const string16& text, |
1113 size_t offset, | 1140 size_t offset, |
1114 const ui::Range& range) { | 1141 const ui::Range& range) { |
1115 if (view_) | 1142 if (view_) |
1116 view_->SelectionChanged(text, offset, range); | 1143 view_->SelectionChanged(text, offset, range); |
1117 } | 1144 } |
1118 | 1145 |
1119 void RenderViewHost::OnMsgSelectionBoundsChanged( | 1146 void RenderViewHostImpl::OnMsgSelectionBoundsChanged( |
1120 const gfx::Rect& start_rect, | 1147 const gfx::Rect& start_rect, |
1121 const gfx::Rect& end_rect) { | 1148 const gfx::Rect& end_rect) { |
1122 if (view_) | 1149 if (view_) |
1123 view_->SelectionBoundsChanged(start_rect, end_rect); | 1150 view_->SelectionBoundsChanged(start_rect, end_rect); |
1124 } | 1151 } |
1125 | 1152 |
1126 void RenderViewHost::OnMsgRunJavaScriptMessage( | 1153 void RenderViewHostImpl::OnMsgRunJavaScriptMessage( |
1127 const string16& message, | 1154 const string16& message, |
1128 const string16& default_prompt, | 1155 const string16& default_prompt, |
1129 const GURL& frame_url, | 1156 const GURL& frame_url, |
1130 ui::JavascriptMessageType type, | 1157 ui::JavascriptMessageType type, |
1131 IPC::Message* reply_msg) { | 1158 IPC::Message* reply_msg) { |
1132 // While a JS message dialog is showing, tabs in the same process shouldn't | 1159 // While a JS message dialog is showing, tabs in the same process shouldn't |
1133 // process input events. | 1160 // process input events. |
1134 process()->SetIgnoreInputEvents(true); | 1161 GetProcess()->SetIgnoreInputEvents(true); |
1135 StopHangMonitorTimeout(); | 1162 StopHangMonitorTimeout(); |
1136 delegate_->RunJavaScriptMessage(this, message, default_prompt, frame_url, | 1163 delegate_->RunJavaScriptMessage(this, message, default_prompt, frame_url, |
1137 type, reply_msg, | 1164 type, reply_msg, |
1138 &are_javascript_messages_suppressed_); | 1165 &are_javascript_messages_suppressed_); |
1139 } | 1166 } |
1140 | 1167 |
1141 void RenderViewHost::OnMsgRunBeforeUnloadConfirm(const GURL& frame_url, | 1168 void RenderViewHostImpl::OnMsgRunBeforeUnloadConfirm(const GURL& frame_url, |
1142 const string16& message, | 1169 const string16& message, |
1143 IPC::Message* reply_msg) { | 1170 IPC::Message* reply_msg) { |
1144 // While a JS before unload dialog is showing, tabs in the same process | 1171 // While a JS before unload dialog is showing, tabs in the same process |
1145 // shouldn't process input events. | 1172 // shouldn't process input events. |
1146 process()->SetIgnoreInputEvents(true); | 1173 GetProcess()->SetIgnoreInputEvents(true); |
1147 StopHangMonitorTimeout(); | 1174 StopHangMonitorTimeout(); |
1148 delegate_->RunBeforeUnloadConfirm(this, message, reply_msg); | 1175 delegate_->RunBeforeUnloadConfirm(this, message, reply_msg); |
1149 } | 1176 } |
1150 | 1177 |
1151 void RenderViewHost::OnMsgStartDragging( | 1178 void RenderViewHostImpl::OnMsgStartDragging( |
1152 const WebDropData& drop_data, | 1179 const WebDropData& drop_data, |
1153 WebDragOperationsMask drag_operations_mask, | 1180 WebDragOperationsMask drag_operations_mask, |
1154 const SkBitmap& image, | 1181 const SkBitmap& image, |
1155 const gfx::Point& image_offset) { | 1182 const gfx::Point& image_offset) { |
1156 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); | 1183 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); |
1157 if (!view) | 1184 if (!view) |
1158 return; | 1185 return; |
1159 | 1186 |
1160 WebDropData filtered_data(drop_data); | 1187 WebDropData filtered_data(drop_data); |
1161 ChildProcessSecurityPolicyImpl* policy = | 1188 ChildProcessSecurityPolicyImpl* policy = |
1162 ChildProcessSecurityPolicyImpl::GetInstance(); | 1189 ChildProcessSecurityPolicyImpl::GetInstance(); |
1163 | 1190 |
1164 // Allow drag of Javascript URLs to enable bookmarklet drag to bookmark bar. | 1191 // Allow drag of Javascript URLs to enable bookmarklet drag to bookmark bar. |
1165 if (!filtered_data.url.SchemeIs(chrome::kJavaScriptScheme)) | 1192 if (!filtered_data.url.SchemeIs(chrome::kJavaScriptScheme)) |
1166 FilterURL(policy, process()->GetID(), &filtered_data.url); | 1193 FilterURL(policy, GetProcess()->GetID(), &filtered_data.url); |
1167 FilterURL(policy, process()->GetID(), &filtered_data.html_base_url); | 1194 FilterURL(policy, GetProcess()->GetID(), &filtered_data.html_base_url); |
1168 view->StartDragging(filtered_data, drag_operations_mask, image, image_offset); | 1195 view->StartDragging(filtered_data, drag_operations_mask, image, image_offset); |
1169 } | 1196 } |
1170 | 1197 |
1171 void RenderViewHost::OnUpdateDragCursor(WebDragOperation current_op) { | 1198 void RenderViewHostImpl::OnUpdateDragCursor(WebDragOperation current_op) { |
1172 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); | 1199 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); |
1173 if (view) | 1200 if (view) |
1174 view->UpdateDragCursor(current_op); | 1201 view->UpdateDragCursor(current_op); |
1175 } | 1202 } |
1176 | 1203 |
1177 void RenderViewHost::OnTargetDropACK() { | 1204 void RenderViewHostImpl::OnTargetDropACK() { |
1178 content::NotificationService::current()->Notify( | 1205 content::NotificationService::current()->Notify( |
1179 content::NOTIFICATION_RENDER_VIEW_HOST_DID_RECEIVE_DRAG_TARGET_DROP_ACK, | 1206 content::NOTIFICATION_RENDER_VIEW_HOST_DID_RECEIVE_DRAG_TARGET_DROP_ACK, |
1180 content::Source<RenderViewHost>(this), | 1207 content::Source<RenderViewHost>(this), |
1181 content::NotificationService::NoDetails()); | 1208 content::NotificationService::NoDetails()); |
1182 } | 1209 } |
1183 | 1210 |
1184 void RenderViewHost::OnTakeFocus(bool reverse) { | 1211 void RenderViewHostImpl::OnTakeFocus(bool reverse) { |
1185 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); | 1212 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); |
1186 if (view) | 1213 if (view) |
1187 view->TakeFocus(reverse); | 1214 view->TakeFocus(reverse); |
1188 } | 1215 } |
1189 | 1216 |
1190 void RenderViewHost::OnFocusedNodeChanged(bool is_editable_node) { | 1217 void RenderViewHostImpl::OnFocusedNodeChanged(bool is_editable_node) { |
1191 content::NotificationService::current()->Notify( | 1218 content::NotificationService::current()->Notify( |
1192 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, | 1219 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, |
1193 content::Source<RenderViewHost>(this), | 1220 content::Source<RenderViewHost>(this), |
1194 content::Details<const bool>(&is_editable_node)); | 1221 content::Details<const bool>(&is_editable_node)); |
1195 } | 1222 } |
1196 | 1223 |
1197 void RenderViewHost::OnAddMessageToConsole(int32 level, | 1224 void RenderViewHostImpl::OnAddMessageToConsole(int32 level, |
1198 const string16& message, | 1225 const string16& message, |
1199 int32 line_no, | 1226 int32 line_no, |
1200 const string16& source_id) { | 1227 const string16& source_id) { |
1201 // Pass through log level only on WebUI pages to limit console spew. | 1228 // Pass through log level only on WebUI pages to limit console spew. |
1202 int32 resolved_level = | 1229 int32 resolved_level = |
1203 (enabled_bindings_ & content::BINDINGS_POLICY_WEB_UI) ? level : 0; | 1230 (enabled_bindings_ & content::BINDINGS_POLICY_WEB_UI) ? level : 0; |
1204 | 1231 |
1205 logging::LogMessage("CONSOLE", line_no, resolved_level).stream() << "\"" << | 1232 logging::LogMessage("CONSOLE", line_no, resolved_level).stream() << "\"" << |
1206 message << "\", source: " << source_id << " (" << line_no << ")"; | 1233 message << "\", source: " << source_id << " (" << line_no << ")"; |
1207 } | 1234 } |
1208 | 1235 |
1209 void RenderViewHost::AddObserver(content::RenderViewHostObserver* observer) { | 1236 void RenderViewHostImpl::AddObserver( |
| 1237 content::RenderViewHostObserver* observer) { |
1210 observers_.AddObserver(observer); | 1238 observers_.AddObserver(observer); |
1211 } | 1239 } |
1212 | 1240 |
1213 void RenderViewHost::RemoveObserver(content::RenderViewHostObserver* observer) { | 1241 void RenderViewHostImpl::RemoveObserver( |
| 1242 content::RenderViewHostObserver* observer) { |
1214 observers_.RemoveObserver(observer); | 1243 observers_.RemoveObserver(observer); |
1215 } | 1244 } |
1216 | 1245 |
1217 bool RenderViewHost::PreHandleKeyboardEvent( | 1246 bool RenderViewHostImpl::PreHandleKeyboardEvent( |
1218 const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) { | 1247 const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) { |
1219 return delegate_->PreHandleKeyboardEvent(event, is_keyboard_shortcut); | 1248 return delegate_->PreHandleKeyboardEvent(event, is_keyboard_shortcut); |
1220 } | 1249 } |
1221 | 1250 |
1222 void RenderViewHost::UnhandledKeyboardEvent( | 1251 void RenderViewHostImpl::UnhandledKeyboardEvent( |
1223 const NativeWebKeyboardEvent& event) { | 1252 const NativeWebKeyboardEvent& event) { |
1224 delegate_->HandleKeyboardEvent(event); | 1253 delegate_->HandleKeyboardEvent(event); |
1225 } | 1254 } |
1226 | 1255 |
1227 void RenderViewHost::OnUserGesture() { | 1256 void RenderViewHostImpl::OnUserGesture() { |
1228 delegate_->OnUserGesture(); | 1257 delegate_->OnUserGesture(); |
1229 } | 1258 } |
1230 | 1259 |
1231 void RenderViewHost::OnMsgShouldCloseACK(bool proceed) { | 1260 void RenderViewHostImpl::OnMsgShouldCloseACK(bool proceed) { |
1232 StopHangMonitorTimeout(); | 1261 StopHangMonitorTimeout(); |
1233 // If this renderer navigated while the beforeunload request was in flight, we | 1262 // If this renderer navigated while the beforeunload request was in flight, we |
1234 // may have cleared this state in OnMsgNavigate, in which case we can ignore | 1263 // may have cleared this state in OnMsgNavigate, in which case we can ignore |
1235 // this message. | 1264 // this message. |
1236 if (!is_waiting_for_beforeunload_ack_ || is_swapped_out_) | 1265 if (!is_waiting_for_beforeunload_ack_ || is_swapped_out_) |
1237 return; | 1266 return; |
1238 | 1267 |
1239 is_waiting_for_beforeunload_ack_ = false; | 1268 is_waiting_for_beforeunload_ack_ = false; |
1240 | 1269 |
1241 RenderViewHostDelegate::RendererManagement* management_delegate = | 1270 RenderViewHostDelegate::RendererManagement* management_delegate = |
1242 delegate_->GetRendererManagementDelegate(); | 1271 delegate_->GetRendererManagementDelegate(); |
1243 if (management_delegate) { | 1272 if (management_delegate) { |
1244 management_delegate->ShouldClosePage( | 1273 management_delegate->ShouldClosePage( |
1245 unload_ack_is_for_cross_site_transition_, proceed); | 1274 unload_ack_is_for_cross_site_transition_, proceed); |
1246 } | 1275 } |
1247 | 1276 |
1248 // If canceled, notify the delegate to cancel its pending navigation entry. | 1277 // If canceled, notify the delegate to cancel its pending navigation entry. |
1249 if (!proceed) | 1278 if (!proceed) |
1250 delegate_->DidCancelLoading(); | 1279 delegate_->DidCancelLoading(); |
1251 } | 1280 } |
1252 | 1281 |
1253 void RenderViewHost::OnMsgClosePageACK() { | 1282 void RenderViewHostImpl::OnMsgClosePageACK() { |
1254 ClosePageIgnoringUnloadEvents(); | 1283 ClosePageIgnoringUnloadEvents(); |
1255 } | 1284 } |
1256 | 1285 |
1257 void RenderViewHost::NotifyRendererUnresponsive() { | 1286 void RenderViewHostImpl::NotifyRendererUnresponsive() { |
1258 delegate_->RendererUnresponsive( | 1287 delegate_->RendererUnresponsive( |
1259 this, is_waiting_for_beforeunload_ack_ || is_waiting_for_unload_ack_); | 1288 this, is_waiting_for_beforeunload_ack_ || is_waiting_for_unload_ack_); |
1260 } | 1289 } |
1261 | 1290 |
1262 void RenderViewHost::NotifyRendererResponsive() { | 1291 void RenderViewHostImpl::NotifyRendererResponsive() { |
1263 delegate_->RendererResponsive(this); | 1292 delegate_->RendererResponsive(this); |
1264 } | 1293 } |
1265 | 1294 |
1266 void RenderViewHost::RequestToLockMouse() { | 1295 void RenderViewHostImpl::RequestToLockMouse() { |
1267 delegate_->RequestToLockMouse(); | 1296 delegate_->RequestToLockMouse(); |
1268 } | 1297 } |
1269 | 1298 |
1270 bool RenderViewHost::IsFullscreen() const { | 1299 bool RenderViewHostImpl::IsFullscreen() const { |
1271 return delegate_->IsFullscreenForCurrentTab(); | 1300 return delegate_->IsFullscreenForCurrentTab(); |
1272 } | 1301 } |
1273 | 1302 |
1274 void RenderViewHost::OnMsgFocus() { | 1303 void RenderViewHostImpl::OnMsgFocus() { |
1275 delegate_->Activate(); | 1304 delegate_->Activate(); |
1276 } | 1305 } |
1277 | 1306 |
1278 void RenderViewHost::OnMsgBlur() { | 1307 void RenderViewHostImpl::OnMsgBlur() { |
1279 delegate_->Deactivate(); | 1308 delegate_->Deactivate(); |
1280 } | 1309 } |
1281 | 1310 |
1282 gfx::Rect RenderViewHost::GetRootWindowResizerRect() const { | 1311 gfx::Rect RenderViewHostImpl::GetRootWindowResizerRect() const { |
1283 return delegate_->GetRootWindowResizerRect(); | 1312 return delegate_->GetRootWindowResizerRect(); |
1284 } | 1313 } |
1285 | 1314 |
1286 void RenderViewHost::ForwardMouseEvent( | 1315 void RenderViewHostImpl::ForwardMouseEvent( |
1287 const WebKit::WebMouseEvent& mouse_event) { | 1316 const WebKit::WebMouseEvent& mouse_event) { |
1288 | 1317 |
1289 // We make a copy of the mouse event because | 1318 // We make a copy of the mouse event because |
1290 // RenderWidgetHost::ForwardMouseEvent will delete |mouse_event|. | 1319 // RenderWidgetHost::ForwardMouseEvent will delete |mouse_event|. |
1291 WebKit::WebMouseEvent event_copy(mouse_event); | 1320 WebKit::WebMouseEvent event_copy(mouse_event); |
1292 RenderWidgetHostImpl::ForwardMouseEvent(event_copy); | 1321 RenderWidgetHostImpl::ForwardMouseEvent(event_copy); |
1293 | 1322 |
1294 switch (event_copy.type) { | 1323 switch (event_copy.type) { |
1295 case WebInputEvent::MouseMove: | 1324 case WebInputEvent::MouseMove: |
1296 delegate_->HandleMouseMove(); | 1325 delegate_->HandleMouseMove(); |
1297 break; | 1326 break; |
1298 case WebInputEvent::MouseLeave: | 1327 case WebInputEvent::MouseLeave: |
1299 delegate_->HandleMouseLeave(); | 1328 delegate_->HandleMouseLeave(); |
1300 break; | 1329 break; |
1301 case WebInputEvent::MouseDown: | 1330 case WebInputEvent::MouseDown: |
1302 delegate_->HandleMouseDown(); | 1331 delegate_->HandleMouseDown(); |
1303 break; | 1332 break; |
1304 case WebInputEvent::MouseWheel: | 1333 case WebInputEvent::MouseWheel: |
1305 if (ignore_input_events()) | 1334 if (ignore_input_events()) |
1306 delegate_->OnIgnoredUIEvent(); | 1335 delegate_->OnIgnoredUIEvent(); |
1307 break; | 1336 break; |
1308 case WebInputEvent::MouseUp: | 1337 case WebInputEvent::MouseUp: |
1309 delegate_->HandleMouseUp(); | 1338 delegate_->HandleMouseUp(); |
1310 default: | 1339 default: |
1311 // For now, we don't care about the rest. | 1340 // For now, we don't care about the rest. |
1312 break; | 1341 break; |
1313 } | 1342 } |
1314 } | 1343 } |
1315 | 1344 |
1316 void RenderViewHost::OnMouseActivate() { | 1345 void RenderViewHostImpl::OnMouseActivate() { |
1317 delegate_->HandleMouseActivate(); | 1346 delegate_->HandleMouseActivate(); |
1318 } | 1347 } |
1319 | 1348 |
1320 void RenderViewHost::ForwardKeyboardEvent( | 1349 void RenderViewHostImpl::ForwardKeyboardEvent( |
1321 const NativeWebKeyboardEvent& key_event) { | 1350 const NativeWebKeyboardEvent& key_event) { |
1322 if (ignore_input_events()) { | 1351 if (ignore_input_events()) { |
1323 if (key_event.type == WebInputEvent::RawKeyDown) | 1352 if (key_event.type == WebInputEvent::RawKeyDown) |
1324 delegate_->OnIgnoredUIEvent(); | 1353 delegate_->OnIgnoredUIEvent(); |
1325 return; | 1354 return; |
1326 } | 1355 } |
1327 RenderWidgetHostImpl::ForwardKeyboardEvent(key_event); | 1356 RenderWidgetHostImpl::ForwardKeyboardEvent(key_event); |
1328 } | 1357 } |
1329 | 1358 |
1330 #if defined(OS_MACOSX) | 1359 #if defined(OS_MACOSX) |
1331 void RenderViewHost::DidSelectPopupMenuItem(int selected_index) { | 1360 void RenderViewHostImpl::DidSelectPopupMenuItem(int selected_index) { |
1332 Send(new ViewMsg_SelectPopupMenuItem(routing_id(), selected_index)); | 1361 Send(new ViewMsg_SelectPopupMenuItem(GetRoutingID(), selected_index)); |
1333 } | 1362 } |
1334 | 1363 |
1335 void RenderViewHost::DidCancelPopupMenu() { | 1364 void RenderViewHostImpl::DidCancelPopupMenu() { |
1336 Send(new ViewMsg_SelectPopupMenuItem(routing_id(), -1)); | 1365 Send(new ViewMsg_SelectPopupMenuItem(GetRoutingID(), -1)); |
1337 } | 1366 } |
1338 #endif | 1367 #endif |
1339 | 1368 |
1340 void RenderViewHost::ToggleSpeechInput() { | 1369 void RenderViewHostImpl::ToggleSpeechInput() { |
1341 Send(new SpeechInputMsg_ToggleSpeechInput(routing_id())); | 1370 Send(new SpeechInputMsg_ToggleSpeechInput(GetRoutingID())); |
1342 } | 1371 } |
1343 | 1372 |
1344 void RenderViewHost::FilterURL(ChildProcessSecurityPolicyImpl* policy, | 1373 void RenderViewHostImpl::FilterURL(ChildProcessSecurityPolicyImpl* policy, |
1345 int renderer_id, | 1374 int renderer_id, |
1346 GURL* url) { | 1375 GURL* url) { |
1347 if (!url->is_valid()) | 1376 if (!url->is_valid()) |
1348 return; // We don't need to block invalid URLs. | 1377 return; // We don't need to block invalid URLs. |
1349 | 1378 |
1350 if (url->SchemeIs(chrome::kAboutScheme)) { | 1379 if (url->SchemeIs(chrome::kAboutScheme)) { |
1351 // The renderer treats all URLs in the about: scheme as being about:blank. | 1380 // The renderer treats all URLs in the about: scheme as being about:blank. |
1352 // Canonicalize about: URLs to about:blank. | 1381 // Canonicalize about: URLs to about:blank. |
1353 *url = GURL(chrome::kAboutBlankURL); | 1382 *url = GURL(chrome::kAboutBlankURL); |
1354 } | 1383 } |
1355 | 1384 |
1356 if (!policy->CanRequestURL(renderer_id, *url)) { | 1385 if (!policy->CanRequestURL(renderer_id, *url)) { |
1357 // If this renderer is not permitted to request this URL, we invalidate the | 1386 // If this renderer is not permitted to request this URL, we invalidate the |
1358 // URL. This prevents us from storing the blocked URL and becoming confused | 1387 // URL. This prevents us from storing the blocked URL and becoming confused |
1359 // later. | 1388 // later. |
1360 VLOG(1) << "Blocked URL " << url->spec(); | 1389 VLOG(1) << "Blocked URL " << url->spec(); |
1361 *url = GURL(); | 1390 *url = GURL(); |
1362 } | 1391 } |
1363 } | 1392 } |
1364 | 1393 |
1365 void RenderViewHost::SetAltErrorPageURL(const GURL& url) { | 1394 void RenderViewHostImpl::SetAltErrorPageURL(const GURL& url) { |
1366 Send(new ViewMsg_SetAltErrorPageURL(routing_id(), url)); | 1395 Send(new ViewMsg_SetAltErrorPageURL(GetRoutingID(), url)); |
1367 } | 1396 } |
1368 | 1397 |
1369 void RenderViewHost::ExitFullscreen() { | 1398 void RenderViewHostImpl::ExitFullscreen() { |
1370 RejectMouseLockOrUnlockIfNecessary(); | 1399 RejectMouseLockOrUnlockIfNecessary(); |
1371 } | 1400 } |
1372 | 1401 |
1373 void RenderViewHost::UpdateWebkitPreferences(const WebPreferences& prefs) { | 1402 void RenderViewHostImpl::UpdateWebkitPreferences(const WebPreferences& prefs) { |
1374 Send(new ViewMsg_UpdateWebPreferences(routing_id(), prefs)); | 1403 Send(new ViewMsg_UpdateWebPreferences(GetRoutingID(), prefs)); |
1375 } | 1404 } |
1376 | 1405 |
1377 void RenderViewHost::ClearFocusedNode() { | 1406 void RenderViewHostImpl::ClearFocusedNode() { |
1378 Send(new ViewMsg_ClearFocusedNode(routing_id())); | 1407 Send(new ViewMsg_ClearFocusedNode(GetRoutingID())); |
1379 } | 1408 } |
1380 | 1409 |
1381 void RenderViewHost::SetZoomLevel(double level) { | 1410 void RenderViewHostImpl::SetZoomLevel(double level) { |
1382 Send(new ViewMsg_SetZoomLevel(routing_id(), level)); | 1411 Send(new ViewMsg_SetZoomLevel(GetRoutingID(), level)); |
1383 } | 1412 } |
1384 | 1413 |
1385 void RenderViewHost::Zoom(content::PageZoom zoom) { | 1414 void RenderViewHostImpl::Zoom(content::PageZoom zoom) { |
1386 Send(new ViewMsg_Zoom(routing_id(), zoom)); | 1415 Send(new ViewMsg_Zoom(GetRoutingID(), zoom)); |
1387 } | 1416 } |
1388 | 1417 |
1389 void RenderViewHost::ReloadFrame() { | 1418 void RenderViewHostImpl::ReloadFrame() { |
1390 Send(new ViewMsg_ReloadFrame(routing_id())); | 1419 Send(new ViewMsg_ReloadFrame(GetRoutingID())); |
1391 } | 1420 } |
1392 | 1421 |
1393 void RenderViewHost::Find(int request_id, const string16& search_text, | 1422 void RenderViewHostImpl::Find(int request_id, |
1394 const WebKit::WebFindOptions& options) { | 1423 const string16& search_text, |
1395 Send(new ViewMsg_Find(routing_id(), request_id, search_text, options)); | 1424 const WebKit::WebFindOptions& options) { |
| 1425 Send(new ViewMsg_Find(GetRoutingID(), request_id, search_text, options)); |
1396 } | 1426 } |
1397 | 1427 |
1398 void RenderViewHost::InsertCSS(const string16& frame_xpath, | 1428 void RenderViewHostImpl::InsertCSS(const string16& frame_xpath, |
1399 const std::string& css) { | 1429 const std::string& css) { |
1400 Send(new ViewMsg_CSSInsertRequest(routing_id(), frame_xpath, css)); | 1430 Send(new ViewMsg_CSSInsertRequest(GetRoutingID(), frame_xpath, css)); |
1401 } | 1431 } |
1402 | 1432 |
1403 void RenderViewHost::DisableScrollbarsForThreshold(const gfx::Size& size) { | 1433 void RenderViewHostImpl::DisableScrollbarsForThreshold(const gfx::Size& size) { |
1404 Send(new ViewMsg_DisableScrollbarsForSmallWindows(routing_id(), size)); | 1434 Send(new ViewMsg_DisableScrollbarsForSmallWindows(GetRoutingID(), size)); |
1405 } | 1435 } |
1406 | 1436 |
1407 void RenderViewHost::EnablePreferredSizeMode() { | 1437 void RenderViewHostImpl::EnablePreferredSizeMode() { |
1408 Send(new ViewMsg_EnablePreferredSizeChangedMode(routing_id())); | 1438 Send(new ViewMsg_EnablePreferredSizeChangedMode(GetRoutingID())); |
1409 } | 1439 } |
1410 | 1440 |
1411 void RenderViewHost::EnableAutoResize(const gfx::Size& min_size, | 1441 void RenderViewHostImpl::EnableAutoResize(const gfx::Size& min_size, |
1412 const gfx::Size& max_size) { | 1442 const gfx::Size& max_size) { |
1413 SetShouldAutoResize(true); | 1443 SetShouldAutoResize(true); |
1414 Send(new ViewMsg_EnableAutoResize(routing_id(), min_size, max_size)); | 1444 Send(new ViewMsg_EnableAutoResize(GetRoutingID(), min_size, max_size)); |
1415 } | 1445 } |
1416 | 1446 |
1417 void RenderViewHost::ExecuteCustomContextMenuCommand( | 1447 void RenderViewHostImpl::ExecuteCustomContextMenuCommand( |
1418 int action, const content::CustomContextMenuContext& context) { | 1448 int action, const content::CustomContextMenuContext& context) { |
1419 Send(new ViewMsg_CustomContextMenuAction(routing_id(), context, action)); | 1449 Send(new ViewMsg_CustomContextMenuAction(GetRoutingID(), context, action)); |
1420 } | 1450 } |
1421 | 1451 |
1422 void RenderViewHost::NotifyContextMenuClosed( | 1452 void RenderViewHostImpl::NotifyContextMenuClosed( |
1423 const content::CustomContextMenuContext& context) { | 1453 const content::CustomContextMenuContext& context) { |
1424 Send(new ViewMsg_ContextMenuClosed(routing_id(), context)); | 1454 Send(new ViewMsg_ContextMenuClosed(GetRoutingID(), context)); |
1425 } | 1455 } |
1426 | 1456 |
1427 void RenderViewHost::CopyImageAt(int x, int y) { | 1457 void RenderViewHostImpl::CopyImageAt(int x, int y) { |
1428 Send(new ViewMsg_CopyImageAt(routing_id(), x, y)); | 1458 Send(new ViewMsg_CopyImageAt(GetRoutingID(), x, y)); |
1429 } | 1459 } |
1430 | 1460 |
1431 void RenderViewHost::ExecuteMediaPlayerActionAtLocation( | 1461 void RenderViewHostImpl::ExecuteMediaPlayerActionAtLocation( |
1432 const gfx::Point& location, const WebKit::WebMediaPlayerAction& action) { | 1462 const gfx::Point& location, const WebKit::WebMediaPlayerAction& action) { |
1433 Send(new ViewMsg_MediaPlayerActionAt(routing_id(), location, action)); | 1463 Send(new ViewMsg_MediaPlayerActionAt(GetRoutingID(), location, action)); |
1434 } | 1464 } |
1435 | 1465 |
1436 void RenderViewHost::ExecutePluginActionAtLocation( | 1466 void RenderViewHostImpl::ExecutePluginActionAtLocation( |
1437 const gfx::Point& location, const WebKit::WebPluginAction& action) { | 1467 const gfx::Point& location, const WebKit::WebPluginAction& action) { |
1438 Send(new ViewMsg_PluginActionAt(routing_id(), location, action)); | 1468 Send(new ViewMsg_PluginActionAt(GetRoutingID(), location, action)); |
1439 } | 1469 } |
1440 | 1470 |
1441 void RenderViewHost::DisassociateFromPopupCount() { | 1471 void RenderViewHostImpl::DisassociateFromPopupCount() { |
1442 Send(new ViewMsg_DisassociateFromPopupCount(routing_id())); | 1472 Send(new ViewMsg_DisassociateFromPopupCount(GetRoutingID())); |
1443 } | 1473 } |
1444 | 1474 |
1445 void RenderViewHost::NotifyMoveOrResizeStarted() { | 1475 void RenderViewHostImpl::NotifyMoveOrResizeStarted() { |
1446 Send(new ViewMsg_MoveOrResizeStarted(routing_id())); | 1476 Send(new ViewMsg_MoveOrResizeStarted(GetRoutingID())); |
1447 } | 1477 } |
1448 | 1478 |
1449 void RenderViewHost::StopFinding(content::StopFindAction action) { | 1479 void RenderViewHostImpl::StopFinding(content::StopFindAction action) { |
1450 Send(new ViewMsg_StopFinding(routing_id(), action)); | 1480 Send(new ViewMsg_StopFinding(GetRoutingID(), action)); |
1451 } | 1481 } |
1452 | 1482 |
1453 void RenderViewHost::OnAccessibilityNotifications( | 1483 content::SessionStorageNamespace* |
| 1484 RenderViewHostImpl::GetSessionStorageNamespace() { |
| 1485 return session_storage_namespace_.get(); |
| 1486 } |
| 1487 |
| 1488 void RenderViewHostImpl::OnAccessibilityNotifications( |
1454 const std::vector<AccessibilityHostMsg_NotificationParams>& params) { | 1489 const std::vector<AccessibilityHostMsg_NotificationParams>& params) { |
1455 if (view_ && !is_swapped_out_) | 1490 if (view_ && !is_swapped_out_) |
1456 view_->OnAccessibilityNotifications(params); | 1491 view_->OnAccessibilityNotifications(params); |
1457 | 1492 |
1458 if (!params.empty()) { | 1493 if (!params.empty()) { |
1459 for (unsigned i = 0; i < params.size(); i++) { | 1494 for (unsigned i = 0; i < params.size(); i++) { |
1460 const AccessibilityHostMsg_NotificationParams& param = params[i]; | 1495 const AccessibilityHostMsg_NotificationParams& param = params[i]; |
1461 | 1496 |
1462 if ((param.notification_type == AccessibilityNotificationLayoutComplete || | 1497 if ((param.notification_type == AccessibilityNotificationLayoutComplete || |
1463 param.notification_type == AccessibilityNotificationLoadComplete) && | 1498 param.notification_type == AccessibilityNotificationLoadComplete) && |
(...skipping 10 matching lines...) Expand all Loading... |
1474 } | 1509 } |
1475 } | 1510 } |
1476 | 1511 |
1477 if (send_accessibility_updated_notifications_) { | 1512 if (send_accessibility_updated_notifications_) { |
1478 content::NotificationService::current()->Notify( | 1513 content::NotificationService::current()->Notify( |
1479 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, | 1514 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, |
1480 content::Source<RenderViewHost>(this), | 1515 content::Source<RenderViewHost>(this), |
1481 content::NotificationService::NoDetails()); | 1516 content::NotificationService::NoDetails()); |
1482 } | 1517 } |
1483 | 1518 |
1484 Send(new AccessibilityMsg_Notifications_ACK(routing_id())); | 1519 Send(new AccessibilityMsg_Notifications_ACK(GetRoutingID())); |
1485 } | 1520 } |
1486 | 1521 |
1487 void RenderViewHost::OnScriptEvalResponse(int id, const ListValue& result) { | 1522 void RenderViewHostImpl::OnScriptEvalResponse(int id, const ListValue& result) { |
1488 Value* result_value; | 1523 Value* result_value; |
1489 if (!result.Get(0, &result_value)) { | 1524 if (!result.Get(0, &result_value)) { |
1490 // Programming error or rogue renderer. | 1525 // Programming error or rogue renderer. |
1491 NOTREACHED() << "Got bad arguments for OnScriptEvalResponse"; | 1526 NOTREACHED() << "Got bad arguments for OnScriptEvalResponse"; |
1492 return; | 1527 return; |
1493 } | 1528 } |
1494 std::pair<int, Value*> details(id, result_value); | 1529 std::pair<int, Value*> details(id, result_value); |
1495 content::NotificationService::current()->Notify( | 1530 content::NotificationService::current()->Notify( |
1496 content::NOTIFICATION_EXECUTE_JAVASCRIPT_RESULT, | 1531 content::NOTIFICATION_EXECUTE_JAVASCRIPT_RESULT, |
1497 content::Source<RenderViewHost>(this), | 1532 content::Source<RenderViewHost>(this), |
1498 content::Details<std::pair<int, Value*> >(&details)); | 1533 content::Details<std::pair<int, Value*> >(&details)); |
1499 } | 1534 } |
1500 | 1535 |
1501 void RenderViewHost::OnDidZoomURL(double zoom_level, | 1536 void RenderViewHostImpl::OnDidZoomURL(double zoom_level, |
1502 bool remember, | 1537 bool remember, |
1503 const GURL& url) { | 1538 const GURL& url) { |
1504 HostZoomMapImpl* host_zoom_map = static_cast<HostZoomMapImpl*>( | 1539 HostZoomMapImpl* host_zoom_map = static_cast<HostZoomMapImpl*>( |
1505 HostZoomMap::GetForBrowserContext(process()->GetBrowserContext())); | 1540 HostZoomMap::GetForBrowserContext(GetProcess()->GetBrowserContext())); |
1506 if (remember) { | 1541 if (remember) { |
1507 host_zoom_map->SetZoomLevel(net::GetHostOrSpecFromURL(url), zoom_level); | 1542 host_zoom_map->SetZoomLevel(net::GetHostOrSpecFromURL(url), zoom_level); |
1508 } else { | 1543 } else { |
1509 host_zoom_map->SetTemporaryZoomLevel( | 1544 host_zoom_map->SetTemporaryZoomLevel( |
1510 process()->GetID(), routing_id(), zoom_level); | 1545 GetProcess()->GetID(), GetRoutingID(), zoom_level); |
1511 } | 1546 } |
1512 } | 1547 } |
1513 | 1548 |
1514 void RenderViewHost::OnMediaNotification(int64 player_cookie, | 1549 void RenderViewHostImpl::OnMediaNotification(int64 player_cookie, |
1515 bool has_video, | 1550 bool has_video, |
1516 bool has_audio, | 1551 bool has_audio, |
1517 bool is_playing) { | 1552 bool is_playing) { |
1518 if (is_playing) { | 1553 if (is_playing) { |
1519 PowerSaveBlocker* blocker = NULL; | 1554 PowerSaveBlocker* blocker = NULL; |
1520 if (has_video) { | 1555 if (has_video) { |
1521 blocker = new PowerSaveBlocker( | 1556 blocker = new PowerSaveBlocker( |
1522 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep); | 1557 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep); |
1523 } else if (has_audio) { | 1558 } else if (has_audio) { |
1524 blocker = new PowerSaveBlocker( | 1559 blocker = new PowerSaveBlocker( |
1525 PowerSaveBlocker::kPowerSaveBlockPreventSystemSleep); | 1560 PowerSaveBlocker::kPowerSaveBlockPreventSystemSleep); |
1526 } | 1561 } |
1527 | 1562 |
1528 if (blocker) | 1563 if (blocker) |
1529 power_save_blockers_[player_cookie] = blocker; | 1564 power_save_blockers_[player_cookie] = blocker; |
1530 } else { | 1565 } else { |
1531 delete power_save_blockers_[player_cookie]; | 1566 delete power_save_blockers_[player_cookie]; |
1532 power_save_blockers_.erase(player_cookie); | 1567 power_save_blockers_.erase(player_cookie); |
1533 } | 1568 } |
1534 } | 1569 } |
1535 | 1570 |
1536 void RenderViewHost::OnRequestDesktopNotificationPermission( | 1571 void RenderViewHostImpl::OnRequestDesktopNotificationPermission( |
1537 const GURL& source_origin, int callback_context) { | 1572 const GURL& source_origin, int callback_context) { |
1538 content::GetContentClient()->browser()->RequestDesktopNotificationPermission( | 1573 content::GetContentClient()->browser()->RequestDesktopNotificationPermission( |
1539 source_origin, callback_context, process()->GetID(), routing_id()); | 1574 source_origin, callback_context, GetProcess()->GetID(), GetRoutingID()); |
1540 } | 1575 } |
1541 | 1576 |
1542 void RenderViewHost::OnShowDesktopNotification( | 1577 void RenderViewHostImpl::OnShowDesktopNotification( |
1543 const content::ShowDesktopNotificationHostMsgParams& params) { | 1578 const content::ShowDesktopNotificationHostMsgParams& params) { |
1544 // Disallow HTML notifications from javascript: and file: schemes as this | 1579 // Disallow HTML notifications from javascript: and file: schemes as this |
1545 // allows unwanted cross-domain access. | 1580 // allows unwanted cross-domain access. |
1546 GURL url = params.contents_url; | 1581 GURL url = params.contents_url; |
1547 if (params.is_html && | 1582 if (params.is_html && |
1548 (url.SchemeIs(chrome::kJavaScriptScheme) || | 1583 (url.SchemeIs(chrome::kJavaScriptScheme) || |
1549 url.SchemeIs(chrome::kFileScheme))) { | 1584 url.SchemeIs(chrome::kFileScheme))) { |
1550 return; | 1585 return; |
1551 } | 1586 } |
1552 | 1587 |
1553 content::GetContentClient()->browser()->ShowDesktopNotification( | 1588 content::GetContentClient()->browser()->ShowDesktopNotification( |
1554 params, process()->GetID(), routing_id(), false); | 1589 params, GetProcess()->GetID(), GetRoutingID(), false); |
1555 } | 1590 } |
1556 | 1591 |
1557 void RenderViewHost::OnCancelDesktopNotification(int notification_id) { | 1592 void RenderViewHostImpl::OnCancelDesktopNotification(int notification_id) { |
1558 content::GetContentClient()->browser()->CancelDesktopNotification( | 1593 content::GetContentClient()->browser()->CancelDesktopNotification( |
1559 process()->GetID(), routing_id(), notification_id); | 1594 GetProcess()->GetID(), GetRoutingID(), notification_id); |
1560 } | 1595 } |
1561 | 1596 |
1562 #if defined(OS_MACOSX) | 1597 #if defined(OS_MACOSX) |
1563 void RenderViewHost::OnMsgShowPopup( | 1598 void RenderViewHostImpl::OnMsgShowPopup( |
1564 const ViewHostMsg_ShowPopup_Params& params) { | 1599 const ViewHostMsg_ShowPopup_Params& params) { |
1565 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); | 1600 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); |
1566 if (view) { | 1601 if (view) { |
1567 view->ShowPopupMenu(params.bounds, | 1602 view->ShowPopupMenu(params.bounds, |
1568 params.item_height, | 1603 params.item_height, |
1569 params.item_font_size, | 1604 params.item_font_size, |
1570 params.selected_item, | 1605 params.selected_item, |
1571 params.popup_items, | 1606 params.popup_items, |
1572 params.right_aligned); | 1607 params.right_aligned); |
1573 } | 1608 } |
1574 } | 1609 } |
1575 #endif | 1610 #endif |
1576 | 1611 |
1577 void RenderViewHost::OnRunFileChooser( | 1612 void RenderViewHostImpl::OnRunFileChooser( |
1578 const content::FileChooserParams& params) { | 1613 const content::FileChooserParams& params) { |
1579 delegate_->RunFileChooser(this, params); | 1614 delegate_->RunFileChooser(this, params); |
1580 } | 1615 } |
1581 | 1616 |
1582 void RenderViewHost::OnWebUISend(const GURL& source_url, | 1617 void RenderViewHostImpl::OnWebUISend(const GURL& source_url, |
1583 const std::string& name, | 1618 const std::string& name, |
1584 const base::ListValue& args) { | 1619 const base::ListValue& args) { |
1585 delegate_->WebUISend(this, source_url, name, args); | 1620 delegate_->WebUISend(this, source_url, name, args); |
1586 } | 1621 } |
1587 | 1622 |
1588 void RenderViewHost::OnDomOperationResponse( | 1623 void RenderViewHostImpl::OnDomOperationResponse( |
1589 const std::string& json_string, int automation_id) { | 1624 const std::string& json_string, int automation_id) { |
1590 DomOperationNotificationDetails details(json_string, automation_id); | 1625 DomOperationNotificationDetails details(json_string, automation_id); |
1591 content::NotificationService::current()->Notify( | 1626 content::NotificationService::current()->Notify( |
1592 content::NOTIFICATION_DOM_OPERATION_RESPONSE, | 1627 content::NOTIFICATION_DOM_OPERATION_RESPONSE, |
1593 content::Source<RenderViewHost>(this), | 1628 content::Source<RenderViewHost>(this), |
1594 content::Details<DomOperationNotificationDetails>(&details)); | 1629 content::Details<DomOperationNotificationDetails>(&details)); |
1595 } | 1630 } |
1596 | 1631 |
1597 void RenderViewHost::SetSwappedOut(bool is_swapped_out) { | 1632 void RenderViewHostImpl::SetSwappedOut(bool is_swapped_out) { |
1598 is_swapped_out_ = is_swapped_out; | 1633 is_swapped_out_ = is_swapped_out; |
1599 | 1634 |
1600 // Whenever we change swap out state, we should not be waiting for | 1635 // Whenever we change swap out state, we should not be waiting for |
1601 // beforeunload or unload acks. We clear them here to be safe, since they | 1636 // beforeunload or unload acks. We clear them here to be safe, since they |
1602 // can cause navigations to be ignored in OnMsgNavigate. | 1637 // can cause navigations to be ignored in OnMsgNavigate. |
1603 is_waiting_for_beforeunload_ack_ = false; | 1638 is_waiting_for_beforeunload_ack_ = false; |
1604 is_waiting_for_unload_ack_ = false; | 1639 is_waiting_for_unload_ack_ = false; |
1605 } | 1640 } |
1606 | 1641 |
1607 void RenderViewHost::ClearPowerSaveBlockers() { | 1642 void RenderViewHostImpl::ClearPowerSaveBlockers() { |
1608 STLDeleteValues(&power_save_blockers_); | 1643 STLDeleteValues(&power_save_blockers_); |
1609 } | 1644 } |
OLD | NEW |