| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Intel Inc. All rights reserved. | 3 * Copyright (C) 2012 Intel Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 this._fileSelectorElement = WebInspector.createFileSelectorElement(this.
_loadFromFile.bind(this)); | 438 this._fileSelectorElement = WebInspector.createFileSelectorElement(this.
_loadFromFile.bind(this)); |
| 439 this.element.appendChild(this._fileSelectorElement); | 439 this.element.appendChild(this._fileSelectorElement); |
| 440 }, | 440 }, |
| 441 | 441 |
| 442 /** | 442 /** |
| 443 * @param {!Event} event | 443 * @param {!Event} event |
| 444 */ | 444 */ |
| 445 _contextMenu: function(event) | 445 _contextMenu: function(event) |
| 446 { | 446 { |
| 447 var contextMenu = new WebInspector.ContextMenu(event); | 447 var contextMenu = new WebInspector.ContextMenu(event); |
| 448 var disabled = this._state !== WebInspector.TimelinePanel.State.Idle; | 448 contextMenu.appendItemsAtLocation("timelineMenu"); |
| 449 contextMenu.appendItem(WebInspector.UIString.capitalize("Save Timeline ^
data\u2026"), this._saveToFile.bind(this), disabled); | |
| 450 contextMenu.appendItem(WebInspector.UIString.capitalize("Load Timeline ^
data\u2026"), this._selectFileToLoad.bind(this), disabled); | |
| 451 contextMenu.show(); | 449 contextMenu.show(); |
| 452 }, | 450 }, |
| 453 | 451 |
| 454 /** | 452 /** |
| 455 * @return {boolean} | 453 * @return {boolean} |
| 456 */ | 454 */ |
| 457 _saveToFile: function() | 455 _saveToFile: function() |
| 458 { | 456 { |
| 459 if (this._state !== WebInspector.TimelinePanel.State.Idle) | 457 if (this._state !== WebInspector.TimelinePanel.State.Idle) |
| 460 return true; | 458 return true; |
| 459 if (this._model.isEmpty()) |
| 460 return true; |
| 461 | 461 |
| 462 var now = new Date(); | 462 var now = new Date(); |
| 463 var fileName = "TimelineRawData-" + now.toISO8601Compact() + ".json"; | 463 var fileName = "TimelineRawData-" + now.toISO8601Compact() + ".json"; |
| 464 var stream = new WebInspector.FileOutputStream(); | 464 var stream = new WebInspector.FileOutputStream(); |
| 465 | 465 |
| 466 /** | 466 /** |
| 467 * @param {boolean} accepted | 467 * @param {boolean} accepted |
| 468 * @this {WebInspector.TimelinePanel} | 468 * @this {WebInspector.TimelinePanel} |
| 469 */ | 469 */ |
| 470 function callback(accepted) | 470 function callback(accepted) |
| (...skipping 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2037 * @override | 2037 * @override |
| 2038 * @param {!WebInspector.Target} target | 2038 * @param {!WebInspector.Target} target |
| 2039 */ | 2039 */ |
| 2040 targetRemoved: function(target) | 2040 targetRemoved: function(target) |
| 2041 { | 2041 { |
| 2042 this._targets.remove(target, true); | 2042 this._targets.remove(target, true); |
| 2043 }, | 2043 }, |
| 2044 | 2044 |
| 2045 __proto__: WebInspector.Object.prototype | 2045 __proto__: WebInspector.Object.prototype |
| 2046 } | 2046 } |
| OLD | NEW |