| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame_host/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 #include "content/public/common/content_switches.h" | 58 #include "content/public/common/content_switches.h" |
| 59 #include "content/public/common/url_constants.h" | 59 #include "content/public/common/url_constants.h" |
| 60 #include "content/public/common/url_utils.h" | 60 #include "content/public/common/url_utils.h" |
| 61 #include "ui/accessibility/ax_tree.h" | 61 #include "ui/accessibility/ax_tree.h" |
| 62 #include "url/gurl.h" | 62 #include "url/gurl.h" |
| 63 | 63 |
| 64 #if defined(OS_MACOSX) | 64 #if defined(OS_MACOSX) |
| 65 #include "content/browser/frame_host/popup_menu_helper_mac.h" | 65 #include "content/browser/frame_host/popup_menu_helper_mac.h" |
| 66 #endif | 66 #endif |
| 67 | 67 |
| 68 #if defined(ENABLE_MEDIA_MOJO_RENDERER) |
| 69 #include "media/mojo/interfaces/media_renderer.mojom.h" |
| 70 #include "media/mojo/services/mojo_renderer_service.h" |
| 71 #endif |
| 72 |
| 68 using base::TimeDelta; | 73 using base::TimeDelta; |
| 69 | 74 |
| 70 namespace content { | 75 namespace content { |
| 71 | 76 |
| 72 namespace { | 77 namespace { |
| 73 | 78 |
| 74 // The next value to use for the accessibility reset token. | 79 // The next value to use for the accessibility reset token. |
| 75 int g_next_accessibility_reset_token = 1; | 80 int g_next_accessibility_reset_token = 1; |
| 76 | 81 |
| 77 // The (process id, routing id) pair that identifies one RenderFrame. | 82 // The (process id, routing id) pair that identifies one RenderFrame. |
| (...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1266 } | 1271 } |
| 1267 | 1272 |
| 1268 void RenderFrameHostImpl::OnHidePopup() { | 1273 void RenderFrameHostImpl::OnHidePopup() { |
| 1269 RenderViewHostDelegateView* view = | 1274 RenderViewHostDelegateView* view = |
| 1270 render_view_host_->delegate_->GetDelegateView(); | 1275 render_view_host_->delegate_->GetDelegateView(); |
| 1271 if (view) | 1276 if (view) |
| 1272 view->HidePopupMenu(); | 1277 view->HidePopupMenu(); |
| 1273 } | 1278 } |
| 1274 #endif | 1279 #endif |
| 1275 | 1280 |
| 1281 #if defined(ENABLE_MEDIA_MOJO_RENDERER) |
| 1282 static void CreateMediaRendererService( |
| 1283 mojo::InterfaceRequest<mojo::MediaRenderer> request) { |
| 1284 media::MojoRendererService* service = new media::MojoRendererService(); |
| 1285 mojo::BindToRequest(service, &request); |
| 1286 } |
| 1287 #endif |
| 1288 |
| 1276 void RenderFrameHostImpl::RegisterMojoServices() { | 1289 void RenderFrameHostImpl::RegisterMojoServices() { |
| 1277 GeolocationServiceContext* geolocation_service_context = | 1290 GeolocationServiceContext* geolocation_service_context = |
| 1278 delegate_ ? delegate_->GetGeolocationServiceContext() : NULL; | 1291 delegate_ ? delegate_->GetGeolocationServiceContext() : NULL; |
| 1279 if (geolocation_service_context) { | 1292 if (geolocation_service_context) { |
| 1280 // TODO(creis): Bind process ID here so that GeolocationServiceImpl | 1293 // TODO(creis): Bind process ID here so that GeolocationServiceImpl |
| 1281 // can perform permissions checks once site isolation is complete. | 1294 // can perform permissions checks once site isolation is complete. |
| 1282 // crbug.com/426384 | 1295 // crbug.com/426384 |
| 1283 GetServiceRegistry()->AddService<GeolocationService>( | 1296 GetServiceRegistry()->AddService<GeolocationService>( |
| 1284 base::Bind(&GeolocationServiceContext::CreateService, | 1297 base::Bind(&GeolocationServiceContext::CreateService, |
| 1285 base::Unretained(geolocation_service_context), | 1298 base::Unretained(geolocation_service_context), |
| 1286 base::Bind(&RenderFrameHostImpl::DidUseGeolocationPermission, | 1299 base::Bind(&RenderFrameHostImpl::DidUseGeolocationPermission, |
| 1287 base::Unretained(this)))); | 1300 base::Unretained(this)))); |
| 1288 } | 1301 } |
| 1289 | 1302 |
| 1290 if (!permission_service_context_) | 1303 if (!permission_service_context_) |
| 1291 permission_service_context_.reset(new PermissionServiceContext(this)); | 1304 permission_service_context_.reset(new PermissionServiceContext(this)); |
| 1292 | 1305 |
| 1293 GetServiceRegistry()->AddService<PermissionService>( | 1306 GetServiceRegistry()->AddService<PermissionService>( |
| 1294 base::Bind(&PermissionServiceContext::CreateService, | 1307 base::Bind(&PermissionServiceContext::CreateService, |
| 1295 base::Unretained(permission_service_context_.get()))); | 1308 base::Unretained(permission_service_context_.get()))); |
| 1309 |
| 1310 #if defined(ENABLE_MEDIA_MOJO_RENDERER) |
| 1311 GetServiceRegistry()->AddService<mojo::MediaRenderer>( |
| 1312 base::Bind(&CreateMediaRendererService)); |
| 1313 #endif |
| 1296 } | 1314 } |
| 1297 | 1315 |
| 1298 void RenderFrameHostImpl::SetState(RenderFrameHostImplState rfh_state) { | 1316 void RenderFrameHostImpl::SetState(RenderFrameHostImplState rfh_state) { |
| 1299 // Only main frames should be swapped out and retained inside a proxy host. | 1317 // Only main frames should be swapped out and retained inside a proxy host. |
| 1300 if (rfh_state == STATE_SWAPPED_OUT) | 1318 if (rfh_state == STATE_SWAPPED_OUT) |
| 1301 CHECK(!GetParent()); | 1319 CHECK(!GetParent()); |
| 1302 | 1320 |
| 1303 // We update the number of RenderFrameHosts in a SiteInstance when the swapped | 1321 // We update the number of RenderFrameHosts in a SiteInstance when the swapped |
| 1304 // out status of a RenderFrameHost gets flipped to/from active. | 1322 // out status of a RenderFrameHost gets flipped to/from active. |
| 1305 if (!IsRFHStateActive(rfh_state_) && IsRFHStateActive(rfh_state)) | 1323 if (!IsRFHStateActive(rfh_state_) && IsRFHStateActive(rfh_state)) |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1745 void RenderFrameHostImpl::DidUseGeolocationPermission() { | 1763 void RenderFrameHostImpl::DidUseGeolocationPermission() { |
| 1746 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); | 1764 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); |
| 1747 GetContentClient()->browser()->RegisterPermissionUsage( | 1765 GetContentClient()->browser()->RegisterPermissionUsage( |
| 1748 PERMISSION_GEOLOCATION, | 1766 PERMISSION_GEOLOCATION, |
| 1749 delegate_->GetAsWebContents(), | 1767 delegate_->GetAsWebContents(), |
| 1750 GetLastCommittedURL().GetOrigin(), | 1768 GetLastCommittedURL().GetOrigin(), |
| 1751 top_frame->GetLastCommittedURL().GetOrigin()); | 1769 top_frame->GetLastCommittedURL().GetOrigin()); |
| 1752 } | 1770 } |
| 1753 | 1771 |
| 1754 } // namespace content | 1772 } // namespace content |
| OLD | NEW |