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

Unified Diff: Source/core/xml/XMLTreeViewer.cpp

Issue 391963002: [Blink] XMLTreeViewer should load resources from blink_resources.grd instead of relying upon xxd.py (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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
« no previous file with comments | « Source/core/inspector/InspectorOverlay.cpp ('k') | public/blink_resources.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/xml/XMLTreeViewer.cpp
diff --git a/Source/core/xml/XMLTreeViewer.cpp b/Source/core/xml/XMLTreeViewer.cpp
index 6531bae1d7c8dfb911621782c6a006cadccb96af..3aabf3500aa4ea0d334a6f1eebb08d1e26d705e1 100644
--- a/Source/core/xml/XMLTreeViewer.cpp
+++ b/Source/core/xml/XMLTreeViewer.cpp
@@ -32,12 +32,11 @@
#include "bindings/core/v8/ExceptionStatePlaceholder.h"
#include "bindings/core/v8/ScriptController.h"
#include "bindings/core/v8/ScriptSourceCode.h"
-#include "core/XMLViewerCSS.h"
-#include "core/XMLViewerJS.h"
#include "core/dom/Document.h"
#include "core/dom/Element.h"
#include "core/dom/Text.h"
#include "core/frame/LocalFrame.h"
+#include "public/platform/Platform.h"
namespace blink {
@@ -48,13 +47,18 @@ XMLTreeViewer::XMLTreeViewer(Document* document)
void XMLTreeViewer::transformDocumentToTreeView()
{
+ const blink::WebData& xmlViewerJSResource = blink::Platform::current()->loadResource("XMLViewer.js");
+ const blink::WebData& xmlViewerCSSResource = blink::Platform::current()->loadResource("XMLViewer.css");
+ if (xmlViewerJSResource.isEmpty() || xmlViewerCSSResource.isEmpty())
+ return;
+
m_document->setIsViewSource(true);
- String scriptString(reinterpret_cast<const char*>(XMLViewer_js), sizeof(XMLViewer_js));
+ String scriptString(xmlViewerJSResource.data(), xmlViewerJSResource.size());
m_document->frame()->script().executeScriptInMainWorld(scriptString, ScriptController::ExecuteScriptWhenScriptsDisabled);
String noStyleMessage("This XML file does not appear to have any style information associated with it. The document tree is shown below.");
m_document->frame()->script().executeScriptInMainWorld("prepareWebKitXMLViewer('" + noStyleMessage + "');", ScriptController::ExecuteScriptWhenScriptsDisabled);
- String cssString(reinterpret_cast<const char*>(XMLViewer_css), sizeof(XMLViewer_css));
+ String cssString(xmlViewerCSSResource.data(), xmlViewerCSSResource.size());
m_document->getElementById("xml-viewer-style")->appendChild(m_document->createTextNode(cssString), IGNORE_EXCEPTION);
}
« no previous file with comments | « Source/core/inspector/InspectorOverlay.cpp ('k') | public/blink_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698