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

Side by Side Diff: Source/devtools/front_end/sources/SourcesView.js

Issue 362273002: DevTools: Reduce code via using document.createElementWithClass and document.createChild. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @implements {WebInspector.TabbedEditorContainerDelegate} 7 * @implements {WebInspector.TabbedEditorContainerDelegate}
8 * @implements {WebInspector.Searchable} 8 * @implements {WebInspector.Searchable}
9 * @implements {WebInspector.Replaceable} 9 * @implements {WebInspector.Replaceable}
10 * @extends {WebInspector.VBox} 10 * @extends {WebInspector.VBox}
(...skipping 18 matching lines...) Expand all
29 this._sourceFramesByUISourceCode = new Map(); 29 this._sourceFramesByUISourceCode = new Map();
30 30
31 var tabbedEditorPlaceholderText = WebInspector.isMac() ? WebInspector.UIStri ng("Hit Cmd+P to open a file") : WebInspector.UIString("Hit Ctrl+P to open a fil e"); 31 var tabbedEditorPlaceholderText = WebInspector.isMac() ? WebInspector.UIStri ng("Hit Cmd+P to open a file") : WebInspector.UIString("Hit Ctrl+P to open a fil e");
32 this._editorContainer = new WebInspector.TabbedEditorContainer(this, "previo uslyViewedFiles", tabbedEditorPlaceholderText); 32 this._editorContainer = new WebInspector.TabbedEditorContainer(this, "previo uslyViewedFiles", tabbedEditorPlaceholderText);
33 this._editorContainer.show(this._searchableView.element); 33 this._editorContainer.show(this._searchableView.element);
34 this._editorContainer.addEventListener(WebInspector.TabbedEditorContainer.Ev ents.EditorSelected, this._editorSelected, this); 34 this._editorContainer.addEventListener(WebInspector.TabbedEditorContainer.Ev ents.EditorSelected, this._editorSelected, this);
35 this._editorContainer.addEventListener(WebInspector.TabbedEditorContainer.Ev ents.EditorClosed, this._editorClosed, this); 35 this._editorContainer.addEventListener(WebInspector.TabbedEditorContainer.Ev ents.EditorClosed, this._editorClosed, this);
36 36
37 this._historyManager = new WebInspector.EditingLocationHistoryManager(this, this.currentSourceFrame.bind(this)); 37 this._historyManager = new WebInspector.EditingLocationHistoryManager(this, this.currentSourceFrame.bind(this));
38 38
39 this._scriptViewStatusBarItemsContainer = document.createElement("div");
40 this._scriptViewStatusBarItemsContainer.className = "inline-block";
41
42 this._scriptViewStatusBarTextContainer = document.createElement("div");
43 this._scriptViewStatusBarTextContainer.className = "hbox";
44
45 this._statusBarContainerElement = this.element.createChild("div", "sources-s tatus-bar"); 39 this._statusBarContainerElement = this.element.createChild("div", "sources-s tatus-bar");
46 40
47 /** 41 /**
48 * @this {WebInspector.SourcesView} 42 * @this {WebInspector.SourcesView}
49 * @param {!WebInspector.SourcesView.EditorAction} EditorAction 43 * @param {!WebInspector.SourcesView.EditorAction} EditorAction
50 */ 44 */
51 function appendButtonForExtension(EditorAction) 45 function appendButtonForExtension(EditorAction)
52 { 46 {
53 this._statusBarContainerElement.appendChild(EditorAction.button(this)); 47 this._statusBarContainerElement.appendChild(EditorAction.button(this));
54 } 48 }
55 var editorActions = /** @type {!Array.<!WebInspector.SourcesView.EditorActio n>} */ (WebInspector.moduleManager.instances(WebInspector.SourcesView.EditorActi on)); 49 var editorActions = /** @type {!Array.<!WebInspector.SourcesView.EditorActio n>} */ (WebInspector.moduleManager.instances(WebInspector.SourcesView.EditorActi on));
56 editorActions.forEach(appendButtonForExtension.bind(this)); 50 editorActions.forEach(appendButtonForExtension.bind(this));
57 51
58 this._statusBarContainerElement.appendChild(this._scriptViewStatusBarItemsCo ntainer); 52 this._scriptViewStatusBarItemsContainer = this._statusBarContainerElement.cr eateChild("div", "inline-block");
59 this._statusBarContainerElement.appendChild(this._scriptViewStatusBarTextCon tainer); 53 this._scriptViewStatusBarTextContainer = this._statusBarContainerElement.cre ateChild("div", "hbox");
60 54
61 WebInspector.startBatchUpdate(); 55 WebInspector.startBatchUpdate();
62 this._workspace.uiSourceCodes().forEach(this._addUISourceCode.bind(this)); 56 this._workspace.uiSourceCodes().forEach(this._addUISourceCode.bind(this));
63 WebInspector.endBatchUpdate(); 57 WebInspector.endBatchUpdate();
64 58
65 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeA dded, this._uiSourceCodeAdded, this); 59 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeA dded, this._uiSourceCodeAdded, this);
66 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeR emoved, this._uiSourceCodeRemoved, this); 60 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeR emoved, this._uiSourceCodeRemoved, this);
67 this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemove d, this._projectRemoved.bind(this), this); 61 this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemove d, this._projectRemoved.bind(this), this);
68 62
69 function handleBeforeUnload(event) 63 function handleBeforeUnload(event)
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 { 693 {
700 } 694 }
701 695
702 WebInspector.SourcesView.EditorAction.prototype = { 696 WebInspector.SourcesView.EditorAction.prototype = {
703 /** 697 /**
704 * @param {!WebInspector.SourcesView} sourcesView 698 * @param {!WebInspector.SourcesView} sourcesView
705 * @return {!Element} 699 * @return {!Element}
706 */ 700 */
707 button: function(sourcesView) { } 701 button: function(sourcesView) { }
708 } 702 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/sources/SourcesPanel.js ('k') | Source/devtools/front_end/ui/Checkbox.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698