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

Unified Diff: content/renderer/dom_automation_controller.cc

Issue 1231083007: Expose distiller functions to JavaScript (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor-content
Patch Set: Comment for test util Created 5 years, 4 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/dom_automation_controller.cc
diff --git a/content/renderer/dom_automation_controller.cc b/content/renderer/dom_automation_controller.cc
index da6907202083d8144151b72d7f728b90485613ce..2443022910b0196f38282ba2537d5483512f64b6 100644
--- a/content/renderer/dom_automation_controller.cc
+++ b/content/renderer/dom_automation_controller.cc
@@ -58,6 +58,29 @@ gin::ObjectTemplateBuilder DomAutomationController::GetObjectTemplateBuilder(
void DomAutomationController::OnDestruct() {}
+void DomAutomationController::DidCreateScriptContext(
+ v8::Local<v8::Context> context,
+ int extension_group,
+ int world_id) {
+ // Add the domAutomationController to isolated worlds as well.
+ v8::Isolate* isolate = blink::mainThreadIsolate();
+ v8::HandleScope handle_scope(isolate);
+ if (context.IsEmpty())
+ return;
+
+ v8::Context::Scope context_scope(context);
+
+ // Resuse this object instead of creating others.
+ gin::Handle<DomAutomationController> controller =
+ gin::CreateHandle(isolate, this);
+ if (controller.IsEmpty())
+ return;
+
+ v8::Local<v8::Object> global = context->Global();
+ global->Set(gin::StringToV8(isolate, "domAutomationController"),
+ controller.ToV8());
+}
+
bool DomAutomationController::SendMsg(const gin::Arguments& args) {
if (!render_frame())
return false;
« content/public/test/browser_test_utils.cc ('K') | « content/renderer/dom_automation_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698