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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js

Issue 2570503003: [DevTools] Prepare navigator to multiple nodes per UISourceCode. (Closed)
Patch Set: 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
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 10 *
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 /** 50 /**
51 * @param {!Common.Event} event 51 * @param {!Common.Event} event
52 */ 52 */
53 _inspectedURLChanged(event) { 53 _inspectedURLChanged(event) {
54 var mainTarget = SDK.targetManager.mainTarget(); 54 var mainTarget = SDK.targetManager.mainTarget();
55 if (event.data !== mainTarget) 55 if (event.data !== mainTarget)
56 return; 56 return;
57 var inspectedURL = mainTarget && mainTarget.inspectedURL(); 57 var inspectedURL = mainTarget && mainTarget.inspectedURL();
58 if (!inspectedURL) 58 if (!inspectedURL)
59 return; 59 return;
60 for (var node of this.uiSourceCodeNodes()) { 60 for (var uiSourceCode of this.workspace().uiSourceCodes()) {
61 var uiSourceCode = node.uiSourceCode(); 61 if (this.accept(uiSourceCode) && uiSourceCode.url() === inspectedURL)
62 if (uiSourceCode.url() === inspectedURL)
63 this.revealUISourceCode(uiSourceCode, true); 62 this.revealUISourceCode(uiSourceCode, true);
64 } 63 }
65 } 64 }
66 65
67 /** 66 /**
68 * @override 67 * @override
69 * @param {!Workspace.UISourceCode} uiSourceCode 68 * @param {!Workspace.UISourceCode} uiSourceCode
70 */ 69 */
71 uiSourceCodeAdded(uiSourceCode) { 70 uiSourceCodeAdded(uiSourceCode) {
72 var mainTarget = SDK.targetManager.mainTarget(); 71 var mainTarget = SDK.targetManager.mainTarget();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 /** 108 /**
110 * @param {!Common.Event} event 109 * @param {!Common.Event} event
111 */ 110 */
112 _inspectedURLChanged(event) { 111 _inspectedURLChanged(event) {
113 var mainTarget = SDK.targetManager.mainTarget(); 112 var mainTarget = SDK.targetManager.mainTarget();
114 if (event.data !== mainTarget) 113 if (event.data !== mainTarget)
115 return; 114 return;
116 var inspectedURL = mainTarget && mainTarget.inspectedURL(); 115 var inspectedURL = mainTarget && mainTarget.inspectedURL();
117 if (!inspectedURL) 116 if (!inspectedURL)
118 return; 117 return;
119 for (var node of this.uiSourceCodeNodes()) { 118 for (var uiSourceCode of this.workspace().uiSourceCodes()) {
120 var uiSourceCode = node.uiSourceCode(); 119 if (this.accept(uiSourceCode) && uiSourceCode.url() === inspectedURL)
121 if (uiSourceCode.url() === inspectedURL)
122 this.revealUISourceCode(uiSourceCode, true); 120 this.revealUISourceCode(uiSourceCode, true);
123 } 121 }
124 } 122 }
125 123
126 /** 124 /**
127 * @override 125 * @override
128 * @param {!Workspace.UISourceCode} uiSourceCode 126 * @param {!Workspace.UISourceCode} uiSourceCode
129 */ 127 */
130 uiSourceCodeAdded(uiSourceCode) { 128 uiSourceCodeAdded(uiSourceCode) {
131 var mainTarget = SDK.targetManager.mainTarget(); 129 var mainTarget = SDK.targetManager.mainTarget();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 */ 215 */
218 handleContextMenu(event) { 216 handleContextMenu(event) {
219 var contextMenu = new UI.ContextMenu(event); 217 var contextMenu = new UI.ContextMenu(event);
220 contextMenu.appendItem(Common.UIString('New'), this._handleCreateSnippet.bin d(this)); 218 contextMenu.appendItem(Common.UIString('New'), this._handleCreateSnippet.bin d(this));
221 contextMenu.show(); 219 contextMenu.show();
222 } 220 }
223 221
224 /** 222 /**
225 * @override 223 * @override
226 * @param {!Event} event 224 * @param {!Event} event
227 * @param {!Workspace.UISourceCode} uiSourceCode 225 * @param {!Sources.NavigatorUISourceCodeTreeNode} node
228 */ 226 */
229 handleFileContextMenu(event, uiSourceCode) { 227 handleFileContextMenu(event, node) {
228 var uiSourceCode = node.uiSourceCode();
230 var contextMenu = new UI.ContextMenu(event); 229 var contextMenu = new UI.ContextMenu(event);
231 contextMenu.appendItem(Common.UIString('Run'), this._handleEvaluateSnippet.b ind(this, uiSourceCode)); 230 contextMenu.appendItem(Common.UIString('Run'), this._handleEvaluateSnippet.b ind(this, uiSourceCode));
232 contextMenu.appendItem(Common.UIString('Rename'), this.rename.bind(this, uiS ourceCode)); 231 contextMenu.appendItem(Common.UIString('Rename'), this.rename.bind(this, nod e));
233 contextMenu.appendItem(Common.UIString('Remove'), this._handleRemoveSnippet. bind(this, uiSourceCode)); 232 contextMenu.appendItem(Common.UIString('Remove'), this._handleRemoveSnippet. bind(this, uiSourceCode));
234 contextMenu.appendSeparator(); 233 contextMenu.appendSeparator();
235 contextMenu.appendItem(Common.UIString('New'), this._handleCreateSnippet.bin d(this)); 234 contextMenu.appendItem(Common.UIString('New'), this._handleCreateSnippet.bin d(this));
236 contextMenu.appendSeparator(); 235 contextMenu.appendSeparator();
237 contextMenu.appendItem(Common.UIString('Save as...'), this._handleSaveAs.bin d(this, uiSourceCode)); 236 contextMenu.appendItem(Common.UIString('Save as...'), this._handleSaveAs.bin d(this, uiSourceCode));
238 contextMenu.show(); 237 contextMenu.show();
239 } 238 }
240 239
241 /** 240 /**
242 * @param {!Workspace.UISourceCode} uiSourceCode 241 * @param {!Workspace.UISourceCode} uiSourceCode
(...skipping 27 matching lines...) Expand all
270 this.create(Snippets.scriptSnippetModel.project(), ''); 269 this.create(Snippets.scriptSnippetModel.project(), '');
271 } 270 }
272 271
273 /** 272 /**
274 * @override 273 * @override
275 */ 274 */
276 sourceDeleted(uiSourceCode) { 275 sourceDeleted(uiSourceCode) {
277 this._handleRemoveSnippet(uiSourceCode); 276 this._handleRemoveSnippet(uiSourceCode);
278 } 277 }
279 }; 278 };
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698