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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 1707233003: Expose mojo bindings to subframes in layout tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@layout-test-mojom
Patch Set: Created 4 years, 9 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/renderer/render_frame_impl.h ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 5b9e5a1c2a30fb36139584ee69881c34f8a61f24..43567b9c05b33a2d18134714deb437771a2c4705 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -1090,10 +1090,7 @@ void RenderFrameImpl::Initialize() {
"parent", parent_id);
}
- if (IsMainFrame() &&
- RenderProcess::current()->GetEnabledBindings() & BINDINGS_POLICY_WEB_UI) {
- EnableMojoBindings(false /* for_layout_tests */);
- }
+ MaybeEnableMojoBindings();
#if defined(ENABLE_PLUGINS)
new PepperBrowserConnection(this);
@@ -5766,12 +5763,26 @@ void RenderFrameImpl::SendUpdateState() {
routing_id_, SingleHistoryItemToPageState(current_history_item_)));
}
-void RenderFrameImpl::EnableMojoBindings(bool for_layout_tests) {
+void RenderFrameImpl::MaybeEnableMojoBindings() {
+ int enabled_bindings = RenderProcess::current()->GetEnabledBindings();
+ // BINDINGS_POLICY_WEB_UI and BINDINGS_POLICY_MOJO are mutually exclusive.
+ // They both provide access to Mojo bindings, but do so in incompatible ways.
+ const int kMojoAndWebUiBindings =
+ BINDINGS_POLICY_WEB_UI | BINDINGS_POLICY_MOJO;
+ DCHECK_NE(enabled_bindings & kMojoAndWebUiBindings, kMojoAndWebUiBindings);
+
// If an MojoBindingsController already exists for this RenderFrameImpl, avoid
// creating another one. It is not kept as a member, as it deletes itself when
// the frame is destroyed.
- if (!RenderFrameObserverTracker<MojoBindingsController>::Get(this))
- new MojoBindingsController(this, for_layout_tests);
+ if (RenderFrameObserverTracker<MojoBindingsController>::Get(this))
+ return;
+
+ if (IsMainFrame() &&
+ enabled_bindings & BINDINGS_POLICY_WEB_UI) {
+ new MojoBindingsController(this, false /* for_layout_tests */);
+ } else if (enabled_bindings & BINDINGS_POLICY_MOJO) {
+ new MojoBindingsController(this, true /* for_layout_tests */);
+ }
}
void RenderFrameImpl::SendFailedProvisionalLoad(
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698