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

Unified Diff: content/renderer/web_ui_runner.cc

Issue 302573002: Add a Javascript wrapper around ServiceRegistry and expose it to WebUI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@render-view-shell
Patch Set: Created 6 years, 6 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
Index: content/renderer/web_ui_runner.cc
diff --git a/content/renderer/web_ui_runner.cc b/content/renderer/web_ui_runner.cc
index a091636cc942b83699cbb43ef86975268ddebb1a..77b0b04538c701840d1f57e04e56081eec49e830 100644
--- a/content/renderer/web_ui_runner.cc
+++ b/content/renderer/web_ui_runner.cc
@@ -4,6 +4,9 @@
#include "content/renderer/web_ui_runner.h"
+#include "content/public/common/service_registry.h"
+#include "content/public/renderer/render_frame.h"
+#include "content/public/renderer/service_registry_js.h"
#include "gin/modules/module_registry.h"
#include "gin/per_context_data.h"
#include "gin/public/context_holder.h"
@@ -47,6 +50,12 @@ void WebUIRunner::RegisterBuiltinModules() {
mojo::js::Support::kModuleName,
mojo::js::Support::GetModule(
context_holder_->isolate()));
+ registry->AddBuiltinModule(
+ context_holder_->isolate(),
+ kServiceRegistryModuleName,
+ WrapServiceRegistry(
+ context_holder_->isolate(),
+ RenderFrame::FromWebFrame(frame_)->GetServiceRegistry()));
}
void WebUIRunner::Run(const std::string& source,

Powered by Google App Engine
This is Rietveld 408576698