Index: content/browser/web_contents/web_contents_impl.cc |
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc |
index 683bd7154d435222b2627e276aa7c6a001a10d12..be05e4a4ca60fb83e2428c815946c0b8a5f038ec 100644 |
--- a/content/browser/web_contents/web_contents_impl.cc |
+++ b/content/browser/web_contents/web_contents_impl.cc |
@@ -104,6 +104,7 @@ |
#include "content/public/browser/security_style_explanations.h" |
#include "content/public/browser/storage_partition.h" |
#include "content/public/browser/user_metrics.h" |
+#include "content/public/browser/web_contents_binding_set.h" |
#include "content/public/browser/web_contents_delegate.h" |
#include "content/public/common/bindings_policy.h" |
#include "content/public/common/browser_plugin_guest_mode.h" |
@@ -459,6 +460,9 @@ WebContentsImpl::~WebContentsImpl() { |
rwh_input_event_router_.reset(); |
+ for (auto& entry : binding_sets_) |
+ entry.second->CloseAllBindings(); |
+ |
WebContentsImpl* outermost = GetOutermostWebContents(); |
if (GetFocusedWebContents() == this && this != outermost) { |
// If the current WebContents is in focus, unset it. |
@@ -986,6 +990,16 @@ void WebContentsImpl::UpdateZoomIfNecessary(const std::string& scheme, |
UpdateZoom(level); |
} |
+base::Closure WebContentsImpl::AddBindingSet( |
+ const std::string& interface_name, |
+ WebContentsBindingSet* binding_set) { |
+ auto result = |
+ binding_sets_.insert(std::make_pair(interface_name, binding_set)); |
+ DCHECK(result.second); |
+ return base::Bind(&WebContentsImpl::RemoveBindingSet, |
+ weak_factory_.GetWeakPtr(), interface_name); |
+} |
+ |
void WebContentsImpl::UpdateDeviceScaleFactor(double device_scale_factor) { |
SendPageMessage( |
new PageMsg_SetDeviceScaleFactor(MSG_ROUTING_NONE, device_scale_factor)); |
@@ -4040,6 +4054,15 @@ bool WebContentsImpl::OnMessageReceived(RenderFrameHost* render_frame_host, |
return OnMessageReceived(NULL, render_frame_host, message); |
} |
+void WebContentsImpl::OnAssociatedInterfaceRequest( |
+ RenderFrameHost* render_frame_host, |
+ const std::string& interface_name, |
+ mojo::ScopedInterfaceEndpointHandle handle) { |
+ auto it = binding_sets_.find(interface_name); |
+ if (it != binding_sets_.end()) |
+ it->second->OnRequestForFrame(render_frame_host, std::move(handle)); |
+} |
+ |
const GURL& WebContentsImpl::GetMainFrameLastCommittedURL() const { |
return GetLastCommittedURL(); |
} |
@@ -5209,4 +5232,10 @@ void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
dialog_manager_ = dialog_manager; |
} |
+void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) { |
+ auto it = binding_sets_.find(interface_name); |
+ if (it != binding_sets_.end()) |
+ binding_sets_.erase(it); |
+} |
+ |
} // namespace content |