Chromium Code Reviews| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 #include "content/public/browser/browser_thread.h" | 50 #include "content/public/browser/browser_thread.h" |
| 51 #include "content/public/browser/content_browser_client.h" | 51 #include "content/public/browser/content_browser_client.h" |
| 52 #include "content/public/browser/render_process_host.h" | 52 #include "content/public/browser/render_process_host.h" |
| 53 #include "content/public/browser/render_widget_host_view.h" | 53 #include "content/public/browser/render_widget_host_view.h" |
| 54 #include "content/public/browser/stream_handle.h" | 54 #include "content/public/browser/stream_handle.h" |
| 55 #include "content/public/browser/user_metrics.h" | 55 #include "content/public/browser/user_metrics.h" |
| 56 #include "content/public/common/content_constants.h" | 56 #include "content/public/common/content_constants.h" |
| 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 "media/mojo/interfaces/media_renderer.mojom.h" | |
| 61 #include "media/mojo/services/mojo_renderer_service.h" | |
| 60 #include "ui/accessibility/ax_tree.h" | 62 #include "ui/accessibility/ax_tree.h" |
| 61 #include "url/gurl.h" | 63 #include "url/gurl.h" |
| 62 | 64 |
| 63 #if defined(OS_MACOSX) | 65 #if defined(OS_MACOSX) |
| 64 #include "content/browser/frame_host/popup_menu_helper_mac.h" | 66 #include "content/browser/frame_host/popup_menu_helper_mac.h" |
| 65 #endif | 67 #endif |
| 66 | 68 |
| 67 using base::TimeDelta; | 69 using base::TimeDelta; |
| 68 | 70 |
| 69 namespace content { | 71 namespace content { |
| (...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1154 } | 1156 } |
| 1155 | 1157 |
| 1156 void RenderFrameHostImpl::OnHidePopup() { | 1158 void RenderFrameHostImpl::OnHidePopup() { |
| 1157 RenderViewHostDelegateView* view = | 1159 RenderViewHostDelegateView* view = |
| 1158 render_view_host_->delegate_->GetDelegateView(); | 1160 render_view_host_->delegate_->GetDelegateView(); |
| 1159 if (view) | 1161 if (view) |
| 1160 view->HidePopupMenu(); | 1162 view->HidePopupMenu(); |
| 1161 } | 1163 } |
| 1162 #endif | 1164 #endif |
| 1163 | 1165 |
| 1166 static void CreateMediaRendererService( | |
| 1167 mojo::InterfaceRequest<mojo::MediaRenderer> request) { | |
| 1168 media::MojoRendererService* service = new media::MojoRendererService(); | |
| 1169 mojo::BindToRequest(service, &request); | |
| 1170 } | |
| 1171 | |
| 1164 void RenderFrameHostImpl::RegisterMojoServices() { | 1172 void RenderFrameHostImpl::RegisterMojoServices() { |
| 1165 GeolocationServiceContext* geolocation_service_context = | 1173 GeolocationServiceContext* geolocation_service_context = |
| 1166 delegate_ ? delegate_->GetGeolocationServiceContext() : NULL; | 1174 delegate_ ? delegate_->GetGeolocationServiceContext() : NULL; |
| 1167 if (geolocation_service_context) { | 1175 if (geolocation_service_context) { |
| 1168 // TODO(creis): Bind process ID here so that GeolocationServiceImpl | 1176 // TODO(creis): Bind process ID here so that GeolocationServiceImpl |
| 1169 // can perform permissions checks once site isolation is complete. | 1177 // can perform permissions checks once site isolation is complete. |
| 1170 // crbug.com/426384 | 1178 // crbug.com/426384 |
| 1171 GetServiceRegistry()->AddService<GeolocationService>( | 1179 GetServiceRegistry()->AddService<GeolocationService>( |
| 1172 base::Bind(&GeolocationServiceContext::CreateService, | 1180 base::Bind(&GeolocationServiceContext::CreateService, |
| 1173 base::Unretained(geolocation_service_context), | 1181 base::Unretained(geolocation_service_context), |
| 1174 base::Bind(&RenderFrameHostImpl::DidUseGeolocationPermission, | 1182 base::Bind(&RenderFrameHostImpl::DidUseGeolocationPermission, |
| 1175 base::Unretained(this)))); | 1183 base::Unretained(this)))); |
| 1176 } | 1184 } |
| 1177 | 1185 |
| 1178 if (!permission_service_context_) | 1186 if (!permission_service_context_) |
| 1179 permission_service_context_.reset(new PermissionServiceContext(this)); | 1187 permission_service_context_.reset(new PermissionServiceContext(this)); |
| 1180 | 1188 |
| 1181 GetServiceRegistry()->AddService<PermissionService>( | 1189 GetServiceRegistry()->AddService<PermissionService>( |
| 1182 base::Bind(&PermissionServiceContext::CreateService, | 1190 base::Bind(&PermissionServiceContext::CreateService, |
| 1183 base::Unretained(permission_service_context_.get()))); | 1191 base::Unretained(permission_service_context_.get()))); |
| 1192 | |
| 1193 GetServiceRegistry()->AddService<mojo::MediaRenderer>( | |
|
xhwang
2014/12/15 21:32:30
Currently we don't want to provide this service by
DaleCurtis
2014/12/15 23:21:17
I think an EXTERNAL_MEDIA_RENDERER define would wo
| |
| 1194 base::Bind(&CreateMediaRendererService)); | |
| 1184 } | 1195 } |
| 1185 | 1196 |
| 1186 void RenderFrameHostImpl::SetState(RenderFrameHostImplState rfh_state) { | 1197 void RenderFrameHostImpl::SetState(RenderFrameHostImplState rfh_state) { |
| 1187 // Only main frames should be swapped out and retained inside a proxy host. | 1198 // Only main frames should be swapped out and retained inside a proxy host. |
| 1188 if (rfh_state == STATE_SWAPPED_OUT) | 1199 if (rfh_state == STATE_SWAPPED_OUT) |
| 1189 CHECK(!GetParent()); | 1200 CHECK(!GetParent()); |
| 1190 | 1201 |
| 1191 // We update the number of RenderFrameHosts in a SiteInstance when the swapped | 1202 // We update the number of RenderFrameHosts in a SiteInstance when the swapped |
| 1192 // out status of a RenderFrameHost gets flipped to/from active. | 1203 // out status of a RenderFrameHost gets flipped to/from active. |
| 1193 if (!IsRFHStateActive(rfh_state_) && IsRFHStateActive(rfh_state)) | 1204 if (!IsRFHStateActive(rfh_state_) && IsRFHStateActive(rfh_state)) |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1605 void RenderFrameHostImpl::DidUseGeolocationPermission() { | 1616 void RenderFrameHostImpl::DidUseGeolocationPermission() { |
| 1606 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); | 1617 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); |
| 1607 GetContentClient()->browser()->RegisterPermissionUsage( | 1618 GetContentClient()->browser()->RegisterPermissionUsage( |
| 1608 PERMISSION_GEOLOCATION, | 1619 PERMISSION_GEOLOCATION, |
| 1609 delegate_->GetAsWebContents(), | 1620 delegate_->GetAsWebContents(), |
| 1610 GetLastCommittedURL().GetOrigin(), | 1621 GetLastCommittedURL().GetOrigin(), |
| 1611 top_frame->GetLastCommittedURL().GetOrigin()); | 1622 top_frame->GetLastCommittedURL().GetOrigin()); |
| 1612 } | 1623 } |
| 1613 | 1624 |
| 1614 } // namespace content | 1625 } // namespace content |
| OLD | NEW |