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

Unified Diff: third_party/WebKit/Source/core/xml/DocumentXMLTreeViewer.cpp

Issue 2562093002: Move DocumentXMLTreeViewer off of private script (Closed)
Patch Set: Use V8PerIsolateData::mainThreadIsolate() Created 4 years 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: third_party/WebKit/Source/core/xml/DocumentXMLTreeViewer.cpp
diff --git a/third_party/WebKit/Source/core/xml/DocumentXMLTreeViewer.cpp b/third_party/WebKit/Source/core/xml/DocumentXMLTreeViewer.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..56967b293e2a06c7309f8c8f1abb674b9528f6c2
--- /dev/null
+++ b/third_party/WebKit/Source/core/xml/DocumentXMLTreeViewer.cpp
@@ -0,0 +1,35 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/xml/DocumentXMLTreeViewer.h"
+
+#include "bindings/core/v8/DOMWrapperWorld.h"
+#include "bindings/core/v8/ScriptController.h"
+#include "bindings/core/v8/ScriptSourceCode.h"
+#include "bindings/core/v8/V8PerIsolateData.h"
+#include "core/dom/Document.h"
+#include "core/dom/Element.h"
+#include "core/frame/LocalFrame.h"
+#include "platform/PlatformResourceLoader.h"
+
+namespace blink {
+
+void transformDocumentToXMLTreeView(Document& document) {
+ String scriptString = loadResourceAsASCIIString("DocumentXMLTreeViewer.js");
+ String cssString = loadResourceAsASCIIString("DocumentXMLTreeViewer.css");
+
+ HeapVector<ScriptSourceCode> sources;
+ sources.append(ScriptSourceCode(scriptString));
+ v8::HandleScope handleScope(V8PerIsolateData::mainThreadIsolate());
+
+ document.frame()->script().executeScriptInIsolatedWorld(
+ WorldIdConstants::DocumentXMLTreeViewerWorldId, sources, 0, nullptr);
+
+ Element* element = document.getElementById("xml-viewer-style");
+ if (element) {
+ element->setTextContent(cssString);
+ }
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698