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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 2310563002: Adds routed interface support between RenderFrameHost and RenderFrame (Closed)
Patch Set: nit Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/child/child_thread_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/child/child_thread_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698