Chromium Code Reviews| 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 285 | 285 |
| 286 // Ensure the RenderView starts with a next_page_id larger than any existing | 286 // Ensure the RenderView starts with a next_page_id larger than any existing |
| 287 // page ID it might be asked to render. | 287 // page ID it might be asked to render. |
| 288 int32 next_page_id = 1; | 288 int32 next_page_id = 1; |
| 289 if (max_page_id > -1) | 289 if (max_page_id > -1) |
| 290 next_page_id = max_page_id + 1; | 290 next_page_id = max_page_id + 1; |
| 291 | 291 |
| 292 ViewMsg_New_Params params; | 292 ViewMsg_New_Params params; |
| 293 params.renderer_preferences = | 293 params.renderer_preferences = |
| 294 delegate_->GetRendererPrefs(GetProcess()->GetBrowserContext()); | 294 delegate_->GetRendererPrefs(GetProcess()->GetBrowserContext()); |
| 295 params.web_preferences = delegate_->GetWebkitPrefs(); | 295 params.web_preferences = GetWebkitPreferences(); |
| 296 params.view_id = GetRoutingID(); | 296 params.view_id = GetRoutingID(); |
| 297 params.main_frame_routing_id = main_frame_routing_id_; | 297 params.main_frame_routing_id = main_frame_routing_id_; |
| 298 params.surface_id = surface_id(); | 298 params.surface_id = surface_id(); |
| 299 params.session_storage_namespace_id = | 299 params.session_storage_namespace_id = |
| 300 delegate_->GetSessionStorageNamespace(instance_)->id(); | 300 delegate_->GetSessionStorageNamespace(instance_)->id(); |
| 301 params.frame_name = frame_name; | 301 params.frame_name = frame_name; |
| 302 // Ensure the RenderView sets its opener correctly. | 302 // Ensure the RenderView sets its opener correctly. |
| 303 params.opener_route_id = opener_route_id; | 303 params.opener_route_id = opener_route_id; |
| 304 params.swapped_out = !IsRVHStateActive(rvh_state_); | 304 params.swapped_out = !IsRVHStateActive(rvh_state_); |
| 305 params.proxy_routing_id = proxy_route_id; | 305 params.proxy_routing_id = proxy_route_id; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 326 bool RenderViewHostImpl::IsRenderViewLive() const { | 326 bool RenderViewHostImpl::IsRenderViewLive() const { |
| 327 return GetProcess()->HasConnection() && renderer_initialized_; | 327 return GetProcess()->HasConnection() && renderer_initialized_; |
| 328 } | 328 } |
| 329 | 329 |
| 330 void RenderViewHostImpl::SyncRendererPrefs() { | 330 void RenderViewHostImpl::SyncRendererPrefs() { |
| 331 Send(new ViewMsg_SetRendererPrefs(GetRoutingID(), | 331 Send(new ViewMsg_SetRendererPrefs(GetRoutingID(), |
| 332 delegate_->GetRendererPrefs( | 332 delegate_->GetRendererPrefs( |
| 333 GetProcess()->GetBrowserContext()))); | 333 GetProcess()->GetBrowserContext()))); |
| 334 } | 334 } |
| 335 | 335 |
| 336 WebPreferences RenderViewHostImpl::GetWebkitPrefs(const GURL& url) { | 336 WebPreferences RenderViewHostImpl::ComputeWebkitPrefs(const GURL& url) { |
| 337 TRACE_EVENT0("browser", "RenderViewHostImpl::GetWebkitPrefs"); | 337 TRACE_EVENT0("browser", "RenderViewHostImpl::GetWebkitPrefs"); |
| 338 WebPreferences prefs; | 338 WebPreferences prefs; |
| 339 | 339 |
| 340 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 340 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 341 | 341 |
| 342 prefs.javascript_enabled = | 342 prefs.javascript_enabled = |
| 343 !command_line.HasSwitch(switches::kDisableJavaScript); | 343 !command_line.HasSwitch(switches::kDisableJavaScript); |
| 344 prefs.web_security_enabled = | 344 prefs.web_security_enabled = |
| 345 !command_line.HasSwitch(switches::kDisableWebSecurity); | 345 !command_line.HasSwitch(switches::kDisableWebSecurity); |
| 346 prefs.plugins_enabled = | 346 prefs.plugins_enabled = |
| (...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1423 view_->OnTextSurroundingSelectionResponse(content, start_offset, end_offset); | 1423 view_->OnTextSurroundingSelectionResponse(content, start_offset, end_offset); |
| 1424 } | 1424 } |
| 1425 | 1425 |
| 1426 void RenderViewHostImpl::ExitFullscreen() { | 1426 void RenderViewHostImpl::ExitFullscreen() { |
| 1427 RejectMouseLockOrUnlockIfNecessary(); | 1427 RejectMouseLockOrUnlockIfNecessary(); |
| 1428 // Notify delegate_ and renderer of fullscreen state change. | 1428 // Notify delegate_ and renderer of fullscreen state change. |
| 1429 OnToggleFullscreen(false); | 1429 OnToggleFullscreen(false); |
| 1430 } | 1430 } |
| 1431 | 1431 |
| 1432 WebPreferences RenderViewHostImpl::GetWebkitPreferences() { | 1432 WebPreferences RenderViewHostImpl::GetWebkitPreferences() { |
| 1433 return delegate_->GetWebkitPrefs(); | 1433 if (!web_preferences_.get()) { |
| 1434 OnWebkitPreferencesChanged(); | |
| 1435 } | |
| 1436 return *web_preferences_; | |
|
jam
2014/07/21 17:40:33
nit: indentation
chrishtr
2014/07/21 18:16:07
Done.
| |
| 1434 } | 1437 } |
| 1435 | 1438 |
| 1436 void RenderViewHostImpl::DisownOpener() { | 1439 void RenderViewHostImpl::DisownOpener() { |
| 1437 // This should only be called when swapped out. | 1440 // This should only be called when swapped out. |
| 1438 DCHECK(IsSwappedOut()); | 1441 DCHECK(IsSwappedOut()); |
| 1439 | 1442 |
| 1440 Send(new ViewMsg_DisownOpener(GetRoutingID())); | 1443 Send(new ViewMsg_DisownOpener(GetRoutingID())); |
| 1441 } | 1444 } |
| 1442 | 1445 |
| 1443 void RenderViewHostImpl::SetAccessibilityCallbackForTesting( | 1446 void RenderViewHostImpl::SetAccessibilityCallbackForTesting( |
| 1444 const base::Callback<void(ui::AXEvent, int)>& callback) { | 1447 const base::Callback<void(ui::AXEvent, int)>& callback) { |
| 1445 accessibility_testing_callback_ = callback; | 1448 accessibility_testing_callback_ = callback; |
| 1446 } | 1449 } |
| 1447 | 1450 |
| 1448 void RenderViewHostImpl::UpdateWebkitPreferences(const WebPreferences& prefs) { | 1451 void RenderViewHostImpl::UpdateWebkitPreferences(const WebPreferences& prefs) { |
| 1452 web_preferences_.reset(new WebPreferences(prefs)); | |
| 1449 Send(new ViewMsg_UpdateWebPreferences(GetRoutingID(), prefs)); | 1453 Send(new ViewMsg_UpdateWebPreferences(GetRoutingID(), prefs)); |
| 1450 } | 1454 } |
| 1451 | 1455 |
| 1456 void RenderViewHostImpl::OnWebkitPreferencesChanged() { | |
| 1457 UpdateWebkitPreferences(delegate_->ComputeWebkitPrefs()); | |
| 1458 } | |
| 1459 | |
| 1452 void RenderViewHostImpl::GetAudioOutputControllers( | 1460 void RenderViewHostImpl::GetAudioOutputControllers( |
| 1453 const GetAudioOutputControllersCallback& callback) const { | 1461 const GetAudioOutputControllersCallback& callback) const { |
| 1454 AudioRendererHost* audio_host = | 1462 AudioRendererHost* audio_host = |
| 1455 static_cast<RenderProcessHostImpl*>(GetProcess())->audio_renderer_host(); | 1463 static_cast<RenderProcessHostImpl*>(GetProcess())->audio_renderer_host(); |
| 1456 audio_host->GetOutputControllers(GetRoutingID(), callback); | 1464 audio_host->GetOutputControllers(GetRoutingID(), callback); |
| 1457 } | 1465 } |
| 1458 | 1466 |
| 1459 void RenderViewHostImpl::ClearFocusedElement() { | 1467 void RenderViewHostImpl::ClearFocusedElement() { |
| 1460 is_focused_element_editable_ = false; | 1468 is_focused_element_editable_ = false; |
| 1461 Send(new ViewMsg_ClearFocusedElement(GetRoutingID())); | 1469 Send(new ViewMsg_ClearFocusedElement(GetRoutingID())); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1658 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1666 FrameTree* frame_tree = delegate_->GetFrameTree(); |
| 1659 | 1667 |
| 1660 frame_tree->ResetForMainFrameSwap(); | 1668 frame_tree->ResetForMainFrameSwap(); |
| 1661 } | 1669 } |
| 1662 | 1670 |
| 1663 void RenderViewHostImpl::SelectWordAroundCaret() { | 1671 void RenderViewHostImpl::SelectWordAroundCaret() { |
| 1664 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1672 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
| 1665 } | 1673 } |
| 1666 | 1674 |
| 1667 } // namespace content | 1675 } // namespace content |
| OLD | NEW |