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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "core/xml/DocumentXMLTreeViewer.h"
6
7 #include "bindings/core/v8/DOMWrapperWorld.h"
8 #include "bindings/core/v8/ScriptController.h"
9 #include "bindings/core/v8/ScriptSourceCode.h"
10 #include "core/dom/Document.h"
11 #include "core/dom/Element.h"
12 #include "core/frame/LocalFrame.h"
13 #include "public/platform/Platform.h"
14
15 namespace blink {
16
17 void DocumentXMLTreeViewer::transformDocumentToTreeView() {
18 WebData DocumentXMLTreeViewerJs =
19 blink::Platform::current()->loadResource("DocumentXMLTreeViewer.js");
20 WebData DocumentXMLTreeViewerCSS =
21 blink::Platform::current()->loadResource("DocumentXMLTreeViewer.css");
22
23 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.
24 DocumentXMLTreeViewerJs.size());
25 String cssString(DocumentXMLTreeViewerCSS.data(),
26 DocumentXMLTreeViewerCSS.size());
27
28 HeapVector<ScriptSourceCode> sources;
29 sources.append(ScriptSourceCode(scriptString));
30 v8::HandleScope handleScope(v8::Isolate::GetCurrent());
31
32 m_document->frame()->script().executeScriptInIsolatedWorld(
33 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
34 m_document->getElementById("xml-viewer-style")->setTextContent(cssString);
35 }
36
37 DEFINE_TRACE(DocumentXMLTreeViewer) {
38 visitor->trace(m_document);
39 }
40
41 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698