| OLD | NEW |
| 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 * * 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 contentType !== WebInspector.resourceTypes.Script) | 120 contentType !== WebInspector.resourceTypes.Script) |
| 121 return; | 121 return; |
| 122 | 122 |
| 123 function doSave(forceSaveAs, content) | 123 function doSave(forceSaveAs, content) |
| 124 { | 124 { |
| 125 WebInspector.fileManager.save(contentProvider.contentURL(), content,
forceSaveAs); | 125 WebInspector.fileManager.save(contentProvider.contentURL(), content,
forceSaveAs); |
| 126 } | 126 } |
| 127 | 127 |
| 128 function save(forceSaveAs) | 128 function save(forceSaveAs) |
| 129 { | 129 { |
| 130 if (contentProvider instanceof WebInspector.UISourceCode) { |
| 131 var uiSourceCode = /** @type {WebInspector.UISourceCode} */ cont
entProvider; |
| 132 if (uiSourceCode.isDirty()) { |
| 133 doSave(forceSaveAs, uiSourceCode.workingCopy()); |
| 134 return; |
| 135 } |
| 136 } |
| 130 contentProvider.requestContent(doSave.bind(this, forceSaveAs)); | 137 contentProvider.requestContent(doSave.bind(this, forceSaveAs)); |
| 131 } | 138 } |
| 132 | 139 |
| 133 contextMenu.appendSeparator(); | 140 contextMenu.appendSeparator(); |
| 134 contextMenu.appendItem(WebInspector.UIString("Save"), save.bind(this, fa
lse)); | 141 contextMenu.appendItem(WebInspector.UIString("Save"), save.bind(this, fa
lse)); |
| 135 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe
nuTitles() ? "Save as..." : "Save As..."), save.bind(this, true)); | 142 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe
nuTitles() ? "Save as..." : "Save As..."), save.bind(this, true)); |
| 136 } | 143 } |
| 137 } | 144 } |
| 138 | 145 |
| 139 WebInspector.HandlerRegistry.EventTypes = { | 146 WebInspector.HandlerRegistry.EventTypes = { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 170 } | 177 } |
| 171 this.element.disabled = names.length <= 1; | 178 this.element.disabled = names.length <= 1; |
| 172 }, | 179 }, |
| 173 | 180 |
| 174 _onChange: function(event) | 181 _onChange: function(event) |
| 175 { | 182 { |
| 176 var value = event.target.value; | 183 var value = event.target.value; |
| 177 this._handlerRegistry.activeHandler = value; | 184 this._handlerRegistry.activeHandler = value; |
| 178 } | 185 } |
| 179 } | 186 } |
| OLD | NEW |