Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 2850743004: Replace ServiceInfo with BindSourceInfo. (Closed)
Patch Set: . Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after
1682 1682
1683 bool deleted = 1683 bool deleted =
1684 frame_tree_node_->render_manager()->DeleteFromPendingList(this); 1684 frame_tree_node_->render_manager()->DeleteFromPendingList(this);
1685 CHECK(deleted); 1685 CHECK(deleted);
1686 } 1686 }
1687 1687
1688 void RenderFrameHostImpl::DisableSwapOutTimerForTesting() { 1688 void RenderFrameHostImpl::DisableSwapOutTimerForTesting() {
1689 swapout_event_monitor_timeout_.reset(); 1689 swapout_event_monitor_timeout_.reset();
1690 } 1690 }
1691 1691
1692 void RenderFrameHostImpl::OnRendererConnect(
1693 const service_manager::ServiceInfo& local_info,
1694 const service_manager::ServiceInfo& remote_info) {
1695 if (remote_info.identity.name() != mojom::kRendererServiceName)
1696 return;
1697 browser_info_ = local_info;
1698 renderer_info_ = remote_info;
1699 }
1700
1701 void RenderFrameHostImpl::OnContextMenu(const ContextMenuParams& params) { 1692 void RenderFrameHostImpl::OnContextMenu(const ContextMenuParams& params) {
1702 if (!is_active()) 1693 if (!is_active())
1703 return; 1694 return;
1704 1695
1705 // Validate the URLs in |params|. If the renderer can't request the URLs 1696 // Validate the URLs in |params|. If the renderer can't request the URLs
1706 // directly, don't show them in the context menu. 1697 // directly, don't show them in the context menu.
1707 ContextMenuParams validated_params(params); 1698 ContextMenuParams validated_params(params);
1708 RenderProcessHost* process = GetProcess(); 1699 RenderProcessHost* process = GetProcess();
1709 1700
1710 // We don't validate |unfiltered_link_url| so that this field can be used 1701 // We don't validate |unfiltered_link_url| so that this field can be used
(...skipping 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after
3080 associated_registry_ = base::MakeUnique<AssociatedInterfaceRegistryImpl>(); 3071 associated_registry_ = base::MakeUnique<AssociatedInterfaceRegistryImpl>();
3081 interface_registry_ = base::MakeUnique<service_manager::BinderRegistry>(); 3072 interface_registry_ = base::MakeUnique<service_manager::BinderRegistry>();
3082 3073
3083 auto make_binding = [](RenderFrameHostImpl* impl, 3074 auto make_binding = [](RenderFrameHostImpl* impl,
3084 mojom::FrameHostAssociatedRequest request) { 3075 mojom::FrameHostAssociatedRequest request) {
3085 impl->frame_host_associated_binding_.Bind(std::move(request)); 3076 impl->frame_host_associated_binding_.Bind(std::move(request));
3086 }; 3077 };
3087 static_cast<AssociatedInterfaceRegistry*>(associated_registry_.get()) 3078 static_cast<AssociatedInterfaceRegistry*>(associated_registry_.get())
3088 ->AddInterface(base::Bind(make_binding, base::Unretained(this))); 3079 ->AddInterface(base::Bind(make_binding, base::Unretained(this)));
3089 3080
3090 ServiceManagerConnection* service_manager_connection =
3091 BrowserContext::GetServiceManagerConnectionFor(
3092 GetProcess()->GetBrowserContext());
3093 // |service_manager_connection| may not be set in unit tests using
3094 // TestBrowserContext.
3095 if (service_manager_connection) {
3096 on_connect_handler_id_ = service_manager_connection->AddOnConnectHandler(
3097 base::Bind(&RenderFrameHostImpl::OnRendererConnect,
3098 weak_ptr_factory_.GetWeakPtr()));
3099 }
3100
3101 RegisterMojoInterfaces(); 3081 RegisterMojoInterfaces();
3102 mojom::FrameFactoryPtr frame_factory; 3082 mojom::FrameFactoryPtr frame_factory;
3103 BindInterface(GetProcess(), &frame_factory); 3083 BindInterface(GetProcess(), &frame_factory);
3104 frame_factory->CreateFrame( 3084 frame_factory->CreateFrame(
3105 routing_id_, MakeRequest(&frame_), 3085 routing_id_, MakeRequest(&frame_),
3106 frame_host_interface_broker_binding_.CreateInterfacePtrAndBind()); 3086 frame_host_interface_broker_binding_.CreateInterfacePtrAndBind());
3107 3087
3108 service_manager::mojom::InterfaceProviderPtr remote_interfaces; 3088 service_manager::mojom::InterfaceProviderPtr remote_interfaces;
3109 service_manager::mojom::InterfaceProviderRequest remote_interfaces_request( 3089 service_manager::mojom::InterfaceProviderRequest remote_interfaces_request(
3110 &remote_interfaces); 3090 &remote_interfaces);
3111 remote_interfaces_.reset(new service_manager::InterfaceProvider); 3091 remote_interfaces_.reset(new service_manager::InterfaceProvider);
3112 remote_interfaces_->Bind(std::move(remote_interfaces)); 3092 remote_interfaces_->Bind(std::move(remote_interfaces));
3113 frame_->GetInterfaceProvider(std::move(remote_interfaces_request)); 3093 frame_->GetInterfaceProvider(std::move(remote_interfaces_request));
3114 } 3094 }
3115 3095
3116 void RenderFrameHostImpl::InvalidateMojoConnection() { 3096 void RenderFrameHostImpl::InvalidateMojoConnection() {
3117 interface_registry_.reset(); 3097 interface_registry_.reset();
3118 3098
3119 ServiceManagerConnection* service_manager_connection =
3120 BrowserContext::GetServiceManagerConnectionFor(
3121 GetProcess()->GetBrowserContext());
3122 // |service_manager_connection| may be null in tests using TestBrowserContext.
3123 if (service_manager_connection) {
3124 service_manager_connection->RemoveOnConnectHandler(on_connect_handler_id_);
3125 on_connect_handler_id_ = 0;
3126 }
3127
3128 frame_.reset(); 3099 frame_.reset();
3129 frame_host_interface_broker_binding_.Close(); 3100 frame_host_interface_broker_binding_.Close();
3130 frame_bindings_control_.reset(); 3101 frame_bindings_control_.reset();
3131 3102
3132 // Disconnect with ImageDownloader Mojo service in RenderFrame. 3103 // Disconnect with ImageDownloader Mojo service in RenderFrame.
3133 mojo_image_downloader_.reset(); 3104 mojo_image_downloader_.reset();
3134 } 3105 }
3135 3106
3136 bool RenderFrameHostImpl::IsFocused() { 3107 bool RenderFrameHostImpl::IsFocused() {
3137 return GetRenderWidgetHost()->is_focused() && 3108 return GetRenderWidgetHost()->is_focused() &&
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
3881 } 3852 }
3882 3853
3883 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( 3854 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame(
3884 const std::string& interface_name, 3855 const std::string& interface_name,
3885 mojo::ScopedMessagePipeHandle pipe) { 3856 mojo::ScopedMessagePipeHandle pipe) {
3886 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); 3857 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe));
3887 } 3858 }
3888 #endif 3859 #endif
3889 3860
3890 } // namespace content 3861 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/browser/gpu/gpu_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698