| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 | 31 |
| 32 /** | 32 /** |
| 33 * @constructor | 33 * @constructor |
| 34 * @extends {WebInspector.Object} | 34 * @extends {WebInspector.Object} |
| 35 * @implements {WebInspector.ContentProvider} | 35 * @implements {WebInspector.ContentProvider} |
| 36 * @param {!WebInspector.Project} project | 36 * @param {!WebInspector.Project} project |
| 37 * @param {string} parentPath | 37 * @param {string} parentPath |
| 38 * @param {string} name | 38 * @param {string} name |
| 39 * @param {string} originURL | 39 * @param {string} originURL |
| 40 * @param {string} url | |
| 41 * @param {!WebInspector.ResourceType} contentType | 40 * @param {!WebInspector.ResourceType} contentType |
| 42 */ | 41 */ |
| 43 WebInspector.UISourceCode = function(project, parentPath, name, originURL, url,
contentType) | 42 WebInspector.UISourceCode = function(project, parentPath, name, originURL, conte
ntType) |
| 44 { | 43 { |
| 45 this._project = project; | 44 this._project = project; |
| 46 this._parentPath = parentPath; | 45 this._parentPath = parentPath; |
| 47 this._name = name; | 46 this._name = name; |
| 48 this._originURL = originURL; | 47 this._originURL = originURL; |
| 49 this._url = url; | |
| 50 this._contentType = contentType; | 48 this._contentType = contentType; |
| 51 /** @type {!Array.<function(?string)>} */ | 49 /** @type {!Array.<function(?string)>} */ |
| 52 this._requestContentCallbacks = []; | 50 this._requestContentCallbacks = []; |
| 53 | 51 |
| 54 /** @type {!Array.<!WebInspector.Revision>} */ | 52 /** @type {!Array.<!WebInspector.Revision>} */ |
| 55 this.history = []; | 53 this.history = []; |
| 56 this._hasUnsavedCommittedChanges = false; | 54 this._hasUnsavedCommittedChanges = false; |
| 57 } | 55 } |
| 58 | 56 |
| 59 /** | 57 /** |
| 60 * @enum {string} | 58 * @enum {string} |
| 61 */ | 59 */ |
| 62 WebInspector.UISourceCode.Events = { | 60 WebInspector.UISourceCode.Events = { |
| 63 WorkingCopyChanged: "WorkingCopyChanged", | 61 WorkingCopyChanged: "WorkingCopyChanged", |
| 64 WorkingCopyCommitted: "WorkingCopyCommitted", | 62 WorkingCopyCommitted: "WorkingCopyCommitted", |
| 65 TitleChanged: "TitleChanged", | 63 TitleChanged: "TitleChanged", |
| 66 SourceMappingChanged: "SourceMappingChanged", | 64 SourceMappingChanged: "SourceMappingChanged", |
| 67 } | 65 } |
| 68 | 66 |
| 69 WebInspector.UISourceCode.prototype = { | 67 WebInspector.UISourceCode.prototype = { |
| 70 /** | 68 /** |
| 71 * @return {string} | 69 * @return {string} |
| 72 */ | 70 */ |
| 73 networkURL: function() | |
| 74 { | |
| 75 return this._url; | |
| 76 }, | |
| 77 | |
| 78 /** | |
| 79 * @return {string} | |
| 80 */ | |
| 81 name: function() | 71 name: function() |
| 82 { | 72 { |
| 83 return this._name; | 73 return this._name; |
| 84 }, | 74 }, |
| 85 | 75 |
| 86 /** | 76 /** |
| 87 * @return {string} | 77 * @return {string} |
| 88 */ | 78 */ |
| 89 parentPath: function() | 79 parentPath: function() |
| 90 { | 80 { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 * @param {string} newName | 140 * @param {string} newName |
| 151 * @param {function(boolean)} callback | 141 * @param {function(boolean)} callback |
| 152 */ | 142 */ |
| 153 rename: function(newName, callback) | 143 rename: function(newName, callback) |
| 154 { | 144 { |
| 155 this._project.rename(this, newName, innerCallback.bind(this)); | 145 this._project.rename(this, newName, innerCallback.bind(this)); |
| 156 | 146 |
| 157 /** | 147 /** |
| 158 * @param {boolean} success | 148 * @param {boolean} success |
| 159 * @param {string=} newName | 149 * @param {string=} newName |
| 160 * @param {string=} newURL | |
| 161 * @param {string=} newOriginURL | 150 * @param {string=} newOriginURL |
| 162 * @param {!WebInspector.ResourceType=} newContentType | 151 * @param {!WebInspector.ResourceType=} newContentType |
| 163 * @this {WebInspector.UISourceCode} | 152 * @this {WebInspector.UISourceCode} |
| 164 */ | 153 */ |
| 165 function innerCallback(success, newName, newURL, newOriginURL, newConten
tType) | 154 function innerCallback(success, newName, newOriginURL, newContentType) |
| 166 { | 155 { |
| 167 if (success) | 156 if (success) |
| 168 this._updateName(/** @type {string} */ (newName), /** @type {str
ing} */ (newURL), /** @type {string} */ (newOriginURL), /** @type {!WebInspector
.ResourceType} */ (newContentType)); | 157 this._updateName(/** @type {string} */ (newName), /** @type {str
ing} */ (newOriginURL), /** @type {!WebInspector.ResourceType} */ (newContentTyp
e)); |
| 169 callback(success); | 158 callback(success); |
| 170 } | 159 } |
| 171 }, | 160 }, |
| 172 | 161 |
| 173 remove: function() | 162 remove: function() |
| 174 { | 163 { |
| 175 this._project.deleteFile(this.path()); | 164 this._project.deleteFile(this.path()); |
| 176 }, | 165 }, |
| 177 | 166 |
| 178 /** | 167 /** |
| 179 * @param {string} name | 168 * @param {string} name |
| 180 * @param {string} url | |
| 181 * @param {string} originURL | 169 * @param {string} originURL |
| 182 * @param {!WebInspector.ResourceType=} contentType | 170 * @param {!WebInspector.ResourceType=} contentType |
| 183 */ | 171 */ |
| 184 _updateName: function(name, url, originURL, contentType) | 172 _updateName: function(name, originURL, contentType) |
| 185 { | 173 { |
| 186 var oldURI = this.uri(); | 174 var oldURI = this.uri(); |
| 187 this._name = name; | 175 this._name = name; |
| 188 if (url) | |
| 189 this._url = url; | |
| 190 if (originURL) | 176 if (originURL) |
| 191 this._originURL = originURL; | 177 this._originURL = originURL; |
| 192 if (contentType) | 178 if (contentType) |
| 193 this._contentType = contentType; | 179 this._contentType = contentType; |
| 194 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.TitleChan
ged, oldURI); | 180 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.TitleChan
ged, oldURI); |
| 195 }, | 181 }, |
| 196 | 182 |
| 197 /** | 183 /** |
| 198 * @override | 184 * @override |
| 199 * @return {string} | 185 * @return {string} |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 * @param {string} query | 701 * @param {string} query |
| 716 * @param {boolean} caseSensitive | 702 * @param {boolean} caseSensitive |
| 717 * @param {boolean} isRegex | 703 * @param {boolean} isRegex |
| 718 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} cal
lback | 704 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} cal
lback |
| 719 */ | 705 */ |
| 720 searchInContent: function(query, caseSensitive, isRegex, callback) | 706 searchInContent: function(query, caseSensitive, isRegex, callback) |
| 721 { | 707 { |
| 722 callback([]); | 708 callback([]); |
| 723 } | 709 } |
| 724 } | 710 } |
| OLD | NEW |