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

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

Issue 2562093002: Move DocumentXMLTreeViewer off of private script (Closed)
Patch Set: Removed the wrong include 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..ace03f446d025d836bf4da82101ff461b363dea2
--- /dev/null
+++ b/third_party/WebKit/Source/core/xml/DocumentXMLTreeViewer.cpp
@@ -0,0 +1,41 @@
+// 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 "core/dom/Document.h"
+#include "core/dom/Element.h"
+#include "core/frame/LocalFrame.h"
+#include "public/platform/Platform.h"
+
+namespace blink {
+
+void DocumentXMLTreeViewer::transformDocumentToTreeView() {
+ WebData DocumentXMLTreeViewerJs =
+ blink::Platform::current()->loadResource("DocumentXMLTreeViewer.js");
+ WebData DocumentXMLTreeViewerCSS =
+ blink::Platform::current()->loadResource("DocumentXMLTreeViewer.css");
+
+ String scriptString(DocumentXMLTreeViewerJs.data(),
jbroman 2016/12/10 20:35:31 Nit: this assumes with no check that the data will
adithyas 2016/12/12 16:13:50 Done.
+ DocumentXMLTreeViewerJs.size());
+ String cssString(DocumentXMLTreeViewerCSS.data(),
+ DocumentXMLTreeViewerCSS.size());
+
+ HeapVector<ScriptSourceCode> sources;
+ sources.append(ScriptSourceCode(scriptString));
+ v8::HandleScope handleScope(v8::Isolate::GetCurrent());
+
+ m_document->frame()->script().executeScriptInIsolatedWorld(
+ WorldIdConstants::DocumentXMLTreeViewerWorldId, sources, 0, nullptr);
haraken 2016/12/12 01:09:56 Does this need to be executed in an isolated world
adithyas 2016/12/12 16:13:50 We used to use the main world to execute the scrip
+ m_document->getElementById("xml-viewer-style")->setTextContent(cssString);
+}
+
+DEFINE_TRACE(DocumentXMLTreeViewer) {
+ visitor->trace(m_document);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698