OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 UISourceCodeRemoved: Symbol("UISourceCodeRemoved"), | 359 UISourceCodeRemoved: Symbol("UISourceCodeRemoved"), |
360 WorkingCopyChanged: Symbol("WorkingCopyChanged"), | 360 WorkingCopyChanged: Symbol("WorkingCopyChanged"), |
361 WorkingCopyCommitted: Symbol("WorkingCopyCommitted"), | 361 WorkingCopyCommitted: Symbol("WorkingCopyCommitted"), |
362 WorkingCopyCommittedByUser: Symbol("WorkingCopyCommittedByUser"), | 362 WorkingCopyCommittedByUser: Symbol("WorkingCopyCommittedByUser"), |
363 ProjectAdded: Symbol("ProjectAdded"), | 363 ProjectAdded: Symbol("ProjectAdded"), |
364 ProjectRemoved: Symbol("ProjectRemoved") | 364 ProjectRemoved: Symbol("ProjectRemoved") |
365 } | 365 } |
366 | 366 |
367 WebInspector.Workspace.prototype = { | 367 WebInspector.Workspace.prototype = { |
368 /** | 368 /** |
369 * @return {!Array.<!WebInspector.UISourceCode>} | |
370 */ | |
371 unsavedSourceCodes: function() | |
372 { | |
373 /** | |
374 * @param {!WebInspector.UISourceCode} sourceCode | |
375 * @return {boolean} | |
376 */ | |
377 function filterUnsaved(sourceCode) | |
378 { | |
379 return sourceCode.isDirty(); | |
380 } | |
381 | |
382 var unsavedSourceCodes = []; | |
383 var projects = this.projectsForType(WebInspector.projectTypes.FileSystem
); | |
384 for (var i = 0; i < projects.length; ++i) | |
385 unsavedSourceCodes = unsavedSourceCodes.concat(projects[i].uiSourceC
odes().filter(filterUnsaved)); | |
386 | |
387 return unsavedSourceCodes; | |
388 }, | |
389 | |
390 /** | |
391 * @param {string} projectId | 369 * @param {string} projectId |
392 * @param {string} url | 370 * @param {string} url |
393 * @return {?WebInspector.UISourceCode} | 371 * @return {?WebInspector.UISourceCode} |
394 */ | 372 */ |
395 uiSourceCode: function(projectId, url) | 373 uiSourceCode: function(projectId, url) |
396 { | 374 { |
397 var project = this._projects.get(projectId); | 375 var project = this._projects.get(projectId); |
398 return project ? project.uiSourceCodeForURL(url) : null; | 376 return project ? project.uiSourceCodeForURL(url) : null; |
399 }, | 377 }, |
400 | 378 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 return this._hasResourceContentTrackingExtensions; | 480 return this._hasResourceContentTrackingExtensions; |
503 }, | 481 }, |
504 | 482 |
505 __proto__: WebInspector.Object.prototype | 483 __proto__: WebInspector.Object.prototype |
506 } | 484 } |
507 | 485 |
508 /** | 486 /** |
509 * @type {!WebInspector.Workspace} | 487 * @type {!WebInspector.Workspace} |
510 */ | 488 */ |
511 WebInspector.workspace; | 489 WebInspector.workspace; |
OLD | NEW |