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

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

Issue 2562093002: Move DocumentXMLTreeViewer off of private script (Closed)
Patch Set: Code review changes 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..5fc9721158408d96bf8358f91b9057822b780f14
--- /dev/null
+++ b/third_party/WebKit/Source/core/xml/DocumentXMLTreeViewer.cpp
@@ -0,0 +1,31 @@
+// 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 "platform/PlatformResourceLoader.h"
+#include "public/platform/Platform.h"
jbroman 2016/12/13 15:41:05 last minute nit: this include is now unused
adithyas 2016/12/13 16:18:16 Removed.
+
+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(v8::Isolate::GetCurrent());
jbroman 2016/12/13 15:41:05 super-nit: V8PerIsolateData::mainThreadIsolate() i
adithyas 2016/12/13 16:18:16 Changed to use V8PerIsolateData::mainThreadIsolate
+
+ document->frame()->script().executeScriptInIsolatedWorld(
+ WorldIdConstants::DocumentXMLTreeViewerWorldId, sources, 0, nullptr);
+ document->getElementById("xml-viewer-style")->setTextContent(cssString);
esprehn 2016/12/12 22:21:57 I'm pretty sure you can actually get into a situat
adithyas 2016/12/13 16:18:17 Fixed
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698