Commit 51b59b3a authored by pfeldman's avatar pfeldman Committed by Commit bot

DevTools: move DOMExtension.js into ui module.

Review-Url: https://codereview.chromium.org/2611843010
Cr-Commit-Position: refs/heads/master@{#442103}
parent da741e20
...@@ -324,7 +324,6 @@ all_devtools_files = [ ...@@ -324,7 +324,6 @@ all_devtools_files = [
"front_end/persistence/FileSystemWorkspaceBinding.js", "front_end/persistence/FileSystemWorkspaceBinding.js",
"front_end/persistence/Persistence.js", "front_end/persistence/Persistence.js",
"front_end/persistence/PersistenceUtils.js", "front_end/persistence/PersistenceUtils.js",
"front_end/platform/DOMExtension.js",
"front_end/platform/module.json", "front_end/platform/module.json",
"front_end/platform/utilities.js", "front_end/platform/utilities.js",
"front_end/platform/utilities.js", "front_end/platform/utilities.js",
...@@ -579,6 +578,7 @@ all_devtools_files = [ ...@@ -579,6 +578,7 @@ all_devtools_files = [
"front_end/ui/cssShadowSwatch.css", "front_end/ui/cssShadowSwatch.css",
"front_end/ui/dialog.css", "front_end/ui/dialog.css",
"front_end/ui/Dialog.js", "front_end/ui/Dialog.js",
"front_end/ui/DOMExtension.js",
"front_end/ui/DOMSyntaxHighlighter.js", "front_end/ui/DOMSyntaxHighlighter.js",
"front_end/ui/DropDownMenu.js", "front_end/ui/DropDownMenu.js",
"front_end/ui/dropTarget.css", "front_end/ui/dropTarget.css",
......
...@@ -175,22 +175,6 @@ Bindings.ChunkedFileReader = class { ...@@ -175,22 +175,6 @@ Bindings.ChunkedFileReader = class {
} }
}; };
/**
* @param {function(!File)} callback
* @return {!Node}
*/
Bindings.createFileSelectorElement = function(callback) {
var fileSelectorElement = createElement('input');
fileSelectorElement.type = 'file';
fileSelectorElement.style.display = 'none';
fileSelectorElement.setAttribute('tabindex', -1);
fileSelectorElement.onchange = onChange;
function onChange(event) {
callback(fileSelectorElement.files[0]);
}
return fileSelectorElement;
};
/** /**
* @implements {Common.OutputStream} * @implements {Common.OutputStream}
* @unrestricted * @unrestricted
......
{ {
"modules": [ "modules": [
{ "name": "platform", "type": "autostart" },
{ "name": "formatter_worker", "type": "autostart" }, { "name": "formatter_worker", "type": "autostart" },
{ "name": "gonzales", "type": "remote" } { "name": "gonzales", "type": "remote" }
], ],
......
{ {
"dependencies": [
"platform"
],
"scripts": [ "scripts": [
"../platform/utilities.js",
"../cm/headlesscodemirror.js", "../cm/headlesscodemirror.js",
"../cm/css.js", "../cm/css.js",
"../cm/xml.js", "../cm/xml.js",
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
"dependencies": [ "dependencies": [
], ],
"scripts": [ "scripts": [
"utilities.js", "utilities.js"
"DOMExtension.js"
] ]
} }
...@@ -1441,3 +1441,23 @@ Map.prototype.diff = function(other, isEqual) { ...@@ -1441,3 +1441,23 @@ Map.prototype.diff = function(other, isEqual) {
} }
return {added: added, removed: removed, equal: equal}; return {added: added, removed: removed, equal: equal};
}; };
/**
* TODO: move into its own module
* @param {function()} callback
* @suppressGlobalPropertiesCheck
*/
function runOnWindowLoad(callback) {
/**
* @suppressGlobalPropertiesCheck
*/
function windowLoaded() {
self.removeEventListener('DOMContentLoaded', windowLoaded, false);
callback();
}
if (document.readyState === 'complete' || document.readyState === 'interactive')
callback();
else
self.addEventListener('DOMContentLoaded', windowLoaded, false);
}
...@@ -487,7 +487,7 @@ Profiler.ProfilesPanel = class extends UI.PanelWithSidebar { ...@@ -487,7 +487,7 @@ Profiler.ProfilesPanel = class extends UI.PanelWithSidebar {
_createFileSelectorElement() { _createFileSelectorElement() {
if (this._fileSelectorElement) if (this._fileSelectorElement)
this.element.removeChild(this._fileSelectorElement); this.element.removeChild(this._fileSelectorElement);
this._fileSelectorElement = Bindings.createFileSelectorElement(this._loadFromFile.bind(this)); this._fileSelectorElement = UI.createFileSelectorElement(this._loadFromFile.bind(this));
Profiler.ProfilesPanel._fileSelectorElement = this._fileSelectorElement; Profiler.ProfilesPanel._fileSelectorElement = this._fileSelectorElement;
this.element.appendChild(this._fileSelectorElement); this.element.appendChild(this._fileSelectorElement);
} }
......
...@@ -398,7 +398,7 @@ Timeline.TimelinePanel = class extends UI.Panel { ...@@ -398,7 +398,7 @@ Timeline.TimelinePanel = class extends UI.Panel {
_createFileSelector() { _createFileSelector() {
if (this._fileSelectorElement) if (this._fileSelectorElement)
this._fileSelectorElement.remove(); this._fileSelectorElement.remove();
this._fileSelectorElement = Bindings.createFileSelectorElement(this._loadFromFile.bind(this)); this._fileSelectorElement = UI.createFileSelectorElement(this._loadFromFile.bind(this));
this.element.appendChild(this._fileSelectorElement); this.element.appendChild(this._fileSelectorElement);
} }
......
...@@ -812,22 +812,3 @@ function isEnterKey(event) { ...@@ -812,22 +812,3 @@ function isEnterKey(event) {
function isEscKey(event) { function isEscKey(event) {
return event.keyCode === 27; return event.keyCode === 27;
} }
/**
* @param {function()} callback
* @suppressGlobalPropertiesCheck
*/
function runOnWindowLoad(callback) {
/**
* @suppressGlobalPropertiesCheck
*/
function windowLoaded() {
window.removeEventListener('DOMContentLoaded', windowLoaded, false);
callback();
}
if (document.readyState === 'complete' || document.readyState === 'interactive')
callback();
else
window.addEventListener('DOMContentLoaded', windowLoaded, false);
}
...@@ -2016,3 +2016,19 @@ UI.loadImage = function(url) { ...@@ -2016,3 +2016,19 @@ UI.loadImage = function(url) {
/** @type {!UI.ThemeSupport} */ /** @type {!UI.ThemeSupport} */
UI.themeSupport; UI.themeSupport;
/**
* @param {function(!File)} callback
* @return {!Node}
*/
UI.createFileSelectorElement = function(callback) {
var fileSelectorElement = createElement('input');
fileSelectorElement.type = 'file';
fileSelectorElement.style.display = 'none';
fileSelectorElement.setAttribute('tabindex', -1);
fileSelectorElement.onchange = onChange;
function onChange(event) {
callback(fileSelectorElement.files[0]);
}
return fileSelectorElement;
};
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
"host" "host"
], ],
"scripts": [ "scripts": [
"DOMExtension.js",
"Widget.js", "Widget.js",
"View.js", "View.js",
"treeoutline.js", "treeoutline.js",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment