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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 #include "content/public/common/content_switches.h" | 57 #include "content/public/common/content_switches.h" |
58 #include "content/public/common/url_constants.h" | 58 #include "content/public/common/url_constants.h" |
59 #include "content/public/common/url_utils.h" | 59 #include "content/public/common/url_utils.h" |
60 #include "ui/accessibility/ax_tree.h" | 60 #include "ui/accessibility/ax_tree.h" |
61 #include "url/gurl.h" | 61 #include "url/gurl.h" |
62 | 62 |
63 #if defined(OS_MACOSX) | 63 #if defined(OS_MACOSX) |
64 #include "content/browser/frame_host/popup_menu_helper_mac.h" | 64 #include "content/browser/frame_host/popup_menu_helper_mac.h" |
65 #endif | 65 #endif |
66 | 66 |
| 67 #if defined(ENABLE_MEDIA_MOJO_RENDERER) |
| 68 #include "media/mojo/interfaces/media_renderer.mojom.h" |
| 69 #include "media/mojo/services/mojo_renderer_service.h" |
| 70 #endif |
| 71 |
67 using base::TimeDelta; | 72 using base::TimeDelta; |
68 | 73 |
69 namespace content { | 74 namespace content { |
70 | 75 |
71 namespace { | 76 namespace { |
72 | 77 |
73 // The next value to use for the accessibility reset token. | 78 // The next value to use for the accessibility reset token. |
74 int g_next_accessibility_reset_token = 1; | 79 int g_next_accessibility_reset_token = 1; |
75 | 80 |
76 // The (process id, routing id) pair that identifies one RenderFrame. | 81 // The (process id, routing id) pair that identifies one RenderFrame. |
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1146 } | 1151 } |
1147 | 1152 |
1148 void RenderFrameHostImpl::OnHidePopup() { | 1153 void RenderFrameHostImpl::OnHidePopup() { |
1149 RenderViewHostDelegateView* view = | 1154 RenderViewHostDelegateView* view = |
1150 render_view_host_->delegate_->GetDelegateView(); | 1155 render_view_host_->delegate_->GetDelegateView(); |
1151 if (view) | 1156 if (view) |
1152 view->HidePopupMenu(); | 1157 view->HidePopupMenu(); |
1153 } | 1158 } |
1154 #endif | 1159 #endif |
1155 | 1160 |
| 1161 #if defined(ENABLE_MEDIA_MOJO_RENDERER) |
| 1162 static void CreateMediaRendererService( |
| 1163 mojo::InterfaceRequest<mojo::MediaRenderer> request) { |
| 1164 media::MojoRendererService* service = new media::MojoRendererService(); |
| 1165 mojo::BindToRequest(service, &request); |
| 1166 } |
| 1167 #endif |
| 1168 |
1156 void RenderFrameHostImpl::RegisterMojoServices() { | 1169 void RenderFrameHostImpl::RegisterMojoServices() { |
1157 GeolocationServiceContext* geolocation_service_context = | 1170 GeolocationServiceContext* geolocation_service_context = |
1158 delegate_ ? delegate_->GetGeolocationServiceContext() : NULL; | 1171 delegate_ ? delegate_->GetGeolocationServiceContext() : NULL; |
1159 if (geolocation_service_context) { | 1172 if (geolocation_service_context) { |
1160 // TODO(creis): Bind process ID here so that GeolocationServiceImpl | 1173 // TODO(creis): Bind process ID here so that GeolocationServiceImpl |
1161 // can perform permissions checks once site isolation is complete. | 1174 // can perform permissions checks once site isolation is complete. |
1162 // crbug.com/426384 | 1175 // crbug.com/426384 |
1163 GetServiceRegistry()->AddService<GeolocationService>( | 1176 GetServiceRegistry()->AddService<GeolocationService>( |
1164 base::Bind(&GeolocationServiceContext::CreateService, | 1177 base::Bind(&GeolocationServiceContext::CreateService, |
1165 base::Unretained(geolocation_service_context), | 1178 base::Unretained(geolocation_service_context), |
1166 base::Bind(&RenderFrameHostImpl::DidUseGeolocationPermission, | 1179 base::Bind(&RenderFrameHostImpl::DidUseGeolocationPermission, |
1167 base::Unretained(this)))); | 1180 base::Unretained(this)))); |
1168 } | 1181 } |
1169 | 1182 |
1170 if (!permission_service_context_) | 1183 if (!permission_service_context_) |
1171 permission_service_context_.reset(new PermissionServiceContext(this)); | 1184 permission_service_context_.reset(new PermissionServiceContext(this)); |
1172 | 1185 |
1173 GetServiceRegistry()->AddService<PermissionService>( | 1186 GetServiceRegistry()->AddService<PermissionService>( |
1174 base::Bind(&PermissionServiceContext::CreateService, | 1187 base::Bind(&PermissionServiceContext::CreateService, |
1175 base::Unretained(permission_service_context_.get()))); | 1188 base::Unretained(permission_service_context_.get()))); |
| 1189 |
| 1190 #if defined(ENABLE_MEDIA_MOJO_RENDERER) |
| 1191 GetServiceRegistry()->AddService<mojo::MediaRenderer>( |
| 1192 base::Bind(&CreateMediaRendererService)); |
| 1193 #endif |
1176 } | 1194 } |
1177 | 1195 |
1178 void RenderFrameHostImpl::SetState(RenderFrameHostImplState rfh_state) { | 1196 void RenderFrameHostImpl::SetState(RenderFrameHostImplState rfh_state) { |
1179 // Only main frames should be swapped out and retained inside a proxy host. | 1197 // Only main frames should be swapped out and retained inside a proxy host. |
1180 if (rfh_state == STATE_SWAPPED_OUT) | 1198 if (rfh_state == STATE_SWAPPED_OUT) |
1181 CHECK(!GetParent()); | 1199 CHECK(!GetParent()); |
1182 | 1200 |
1183 // We update the number of RenderFrameHosts in a SiteInstance when the swapped | 1201 // We update the number of RenderFrameHosts in a SiteInstance when the swapped |
1184 // out status of a RenderFrameHost gets flipped to/from active. | 1202 // out status of a RenderFrameHost gets flipped to/from active. |
1185 if (!IsRFHStateActive(rfh_state_) && IsRFHStateActive(rfh_state)) | 1203 if (!IsRFHStateActive(rfh_state_) && IsRFHStateActive(rfh_state)) |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1606 void RenderFrameHostImpl::DidUseGeolocationPermission() { | 1624 void RenderFrameHostImpl::DidUseGeolocationPermission() { |
1607 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); | 1625 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); |
1608 GetContentClient()->browser()->RegisterPermissionUsage( | 1626 GetContentClient()->browser()->RegisterPermissionUsage( |
1609 PERMISSION_GEOLOCATION, | 1627 PERMISSION_GEOLOCATION, |
1610 delegate_->GetAsWebContents(), | 1628 delegate_->GetAsWebContents(), |
1611 GetLastCommittedURL().GetOrigin(), | 1629 GetLastCommittedURL().GetOrigin(), |
1612 top_frame->GetLastCommittedURL().GetOrigin()); | 1630 top_frame->GetLastCommittedURL().GetOrigin()); |
1613 } | 1631 } |
1614 | 1632 |
1615 } // namespace content | 1633 } // namespace content |
OLD | NEW |