| 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_impl.h" | 5 #include "content/browser/renderer_host/render_view_host_impl.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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 | 282 |
| 283 // Ensure the RenderView starts with a next_page_id larger than any existing | 283 // Ensure the RenderView starts with a next_page_id larger than any existing |
| 284 // page ID it might be asked to render. | 284 // page ID it might be asked to render. |
| 285 int32 next_page_id = 1; | 285 int32 next_page_id = 1; |
| 286 if (max_page_id > -1) | 286 if (max_page_id > -1) |
| 287 next_page_id = max_page_id + 1; | 287 next_page_id = max_page_id + 1; |
| 288 | 288 |
| 289 ViewMsg_New_Params params; | 289 ViewMsg_New_Params params; |
| 290 params.renderer_preferences = | 290 params.renderer_preferences = |
| 291 delegate_->GetRendererPrefs(GetProcess()->GetBrowserContext()); | 291 delegate_->GetRendererPrefs(GetProcess()->GetBrowserContext()); |
| 292 params.web_preferences = GetWebkitPreferences(); | 292 params.web_preferences = delegate_->GetWebkitPrefs(); |
| 293 params.view_id = GetRoutingID(); | 293 params.view_id = GetRoutingID(); |
| 294 params.main_frame_routing_id = main_frame_routing_id_; | 294 params.main_frame_routing_id = main_frame_routing_id_; |
| 295 params.surface_id = surface_id(); | 295 params.surface_id = surface_id(); |
| 296 params.session_storage_namespace_id = | 296 params.session_storage_namespace_id = |
| 297 delegate_->GetSessionStorageNamespace(instance_)->id(); | 297 delegate_->GetSessionStorageNamespace(instance_)->id(); |
| 298 params.frame_name = frame_name; | 298 params.frame_name = frame_name; |
| 299 // Ensure the RenderView sets its opener correctly. | 299 // Ensure the RenderView sets its opener correctly. |
| 300 params.opener_route_id = opener_route_id; | 300 params.opener_route_id = opener_route_id; |
| 301 params.swapped_out = !IsRVHStateActive(rvh_state_); | 301 params.swapped_out = !IsRVHStateActive(rvh_state_); |
| 302 params.proxy_routing_id = proxy_route_id; | 302 params.proxy_routing_id = proxy_route_id; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 322 bool RenderViewHostImpl::IsRenderViewLive() const { | 322 bool RenderViewHostImpl::IsRenderViewLive() const { |
| 323 return GetProcess()->HasConnection() && renderer_initialized_; | 323 return GetProcess()->HasConnection() && renderer_initialized_; |
| 324 } | 324 } |
| 325 | 325 |
| 326 void RenderViewHostImpl::SyncRendererPrefs() { | 326 void RenderViewHostImpl::SyncRendererPrefs() { |
| 327 Send(new ViewMsg_SetRendererPrefs(GetRoutingID(), | 327 Send(new ViewMsg_SetRendererPrefs(GetRoutingID(), |
| 328 delegate_->GetRendererPrefs( | 328 delegate_->GetRendererPrefs( |
| 329 GetProcess()->GetBrowserContext()))); | 329 GetProcess()->GetBrowserContext()))); |
| 330 } | 330 } |
| 331 | 331 |
| 332 WebPreferences RenderViewHostImpl::ComputeWebkitPrefs(const GURL& url) { | 332 WebPreferences RenderViewHostImpl::GetWebkitPrefs(const GURL& url) { |
| 333 TRACE_EVENT0("browser", "RenderViewHostImpl::GetWebkitPrefs"); | 333 TRACE_EVENT0("browser", "RenderViewHostImpl::GetWebkitPrefs"); |
| 334 WebPreferences prefs; | 334 WebPreferences prefs; |
| 335 | 335 |
| 336 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 336 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 337 | 337 |
| 338 prefs.javascript_enabled = | 338 prefs.javascript_enabled = |
| 339 !command_line.HasSwitch(switches::kDisableJavaScript); | 339 !command_line.HasSwitch(switches::kDisableJavaScript); |
| 340 prefs.web_security_enabled = | 340 prefs.web_security_enabled = |
| 341 !command_line.HasSwitch(switches::kDisableWebSecurity); | 341 !command_line.HasSwitch(switches::kDisableWebSecurity); |
| 342 prefs.plugins_enabled = | 342 prefs.plugins_enabled = |
| (...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1411 view_->OnTextSurroundingSelectionResponse(content, start_offset, end_offset); | 1411 view_->OnTextSurroundingSelectionResponse(content, start_offset, end_offset); |
| 1412 } | 1412 } |
| 1413 | 1413 |
| 1414 void RenderViewHostImpl::ExitFullscreen() { | 1414 void RenderViewHostImpl::ExitFullscreen() { |
| 1415 RejectMouseLockOrUnlockIfNecessary(); | 1415 RejectMouseLockOrUnlockIfNecessary(); |
| 1416 // Notify delegate_ and renderer of fullscreen state change. | 1416 // Notify delegate_ and renderer of fullscreen state change. |
| 1417 OnToggleFullscreen(false); | 1417 OnToggleFullscreen(false); |
| 1418 } | 1418 } |
| 1419 | 1419 |
| 1420 WebPreferences RenderViewHostImpl::GetWebkitPreferences() { | 1420 WebPreferences RenderViewHostImpl::GetWebkitPreferences() { |
| 1421 if (!web_preferences_.get()) { | 1421 return delegate_->GetWebkitPrefs(); |
| 1422 OnWebkitPreferencesChanged(); | |
| 1423 } | |
| 1424 return *web_preferences_; | |
| 1425 } | 1422 } |
| 1426 | 1423 |
| 1427 void RenderViewHostImpl::DisownOpener() { | 1424 void RenderViewHostImpl::DisownOpener() { |
| 1428 // This should only be called when swapped out. | 1425 // This should only be called when swapped out. |
| 1429 DCHECK(IsSwappedOut()); | 1426 DCHECK(IsSwappedOut()); |
| 1430 | 1427 |
| 1431 Send(new ViewMsg_DisownOpener(GetRoutingID())); | 1428 Send(new ViewMsg_DisownOpener(GetRoutingID())); |
| 1432 } | 1429 } |
| 1433 | 1430 |
| 1434 void RenderViewHostImpl::UpdateWebkitPreferences(const WebPreferences& prefs) { | 1431 void RenderViewHostImpl::UpdateWebkitPreferences(const WebPreferences& prefs) { |
| 1435 web_preferences_.reset(new WebPreferences(prefs)); | |
| 1436 Send(new ViewMsg_UpdateWebPreferences(GetRoutingID(), prefs)); | 1432 Send(new ViewMsg_UpdateWebPreferences(GetRoutingID(), prefs)); |
| 1437 } | 1433 } |
| 1438 | 1434 |
| 1439 void RenderViewHostImpl::OnWebkitPreferencesChanged() { | |
| 1440 UpdateWebkitPreferences(delegate_->ComputeWebkitPrefs()); | |
| 1441 } | |
| 1442 | |
| 1443 void RenderViewHostImpl::GetAudioOutputControllers( | 1435 void RenderViewHostImpl::GetAudioOutputControllers( |
| 1444 const GetAudioOutputControllersCallback& callback) const { | 1436 const GetAudioOutputControllersCallback& callback) const { |
| 1445 AudioRendererHost* audio_host = | 1437 AudioRendererHost* audio_host = |
| 1446 static_cast<RenderProcessHostImpl*>(GetProcess())->audio_renderer_host(); | 1438 static_cast<RenderProcessHostImpl*>(GetProcess())->audio_renderer_host(); |
| 1447 audio_host->GetOutputControllers(GetRoutingID(), callback); | 1439 audio_host->GetOutputControllers(GetRoutingID(), callback); |
| 1448 } | 1440 } |
| 1449 | 1441 |
| 1450 void RenderViewHostImpl::ClearFocusedElement() { | 1442 void RenderViewHostImpl::ClearFocusedElement() { |
| 1451 is_focused_element_editable_ = false; | 1443 is_focused_element_editable_ = false; |
| 1452 Send(new ViewMsg_ClearFocusedElement(GetRoutingID())); | 1444 Send(new ViewMsg_ClearFocusedElement(GetRoutingID())); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1588 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1580 FrameTree* frame_tree = delegate_->GetFrameTree(); |
| 1589 | 1581 |
| 1590 frame_tree->ResetForMainFrameSwap(); | 1582 frame_tree->ResetForMainFrameSwap(); |
| 1591 } | 1583 } |
| 1592 | 1584 |
| 1593 void RenderViewHostImpl::SelectWordAroundCaret() { | 1585 void RenderViewHostImpl::SelectWordAroundCaret() { |
| 1594 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1586 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
| 1595 } | 1587 } |
| 1596 | 1588 |
| 1597 } // namespace content | 1589 } // namespace content |
| OLD | NEW |