| 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 SavedStateUpdated: "SavedStateUpdated", | 64 SavedStateUpdated: "SavedStateUpdated", |
| 67 SourceMappingChanged: "SourceMappingChanged", | 65 SourceMappingChanged: "SourceMappingChanged", |
| 68 } | 66 } |
| 69 | 67 |
| 70 WebInspector.UISourceCode.prototype = { | 68 WebInspector.UISourceCode.prototype = { |
| 71 /** | 69 /** |
| 72 * @return {string} | 70 * @return {string} |
| 73 */ | 71 */ |
| 74 networkURL: function() | |
| 75 { | |
| 76 return this._url; | |
| 77 }, | |
| 78 | |
| 79 /** | |
| 80 * @return {string} | |
| 81 */ | |
| 82 name: function() | 72 name: function() |
| 83 { | 73 { |
| 84 return this._name; | 74 return this._name; |
| 85 }, | 75 }, |
| 86 | 76 |
| 87 /** | 77 /** |
| 88 * @return {string} | 78 * @return {string} |
| 89 */ | 79 */ |
| 90 parentPath: function() | 80 parentPath: function() |
| 91 { | 81 { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 * @param {string} newName | 141 * @param {string} newName |
| 152 * @param {function(boolean)} callback | 142 * @param {function(boolean)} callback |
| 153 */ | 143 */ |
| 154 rename: function(newName, callback) | 144 rename: function(newName, callback) |
| 155 { | 145 { |
| 156 this._project.rename(this, newName, innerCallback.bind(this)); | 146 this._project.rename(this, newName, innerCallback.bind(this)); |
| 157 | 147 |
| 158 /** | 148 /** |
| 159 * @param {boolean} success | 149 * @param {boolean} success |
| 160 * @param {string=} newName | 150 * @param {string=} newName |
| 161 * @param {string=} newURL | |
| 162 * @param {string=} newOriginURL | 151 * @param {string=} newOriginURL |
| 163 * @param {!WebInspector.ResourceType=} newContentType | 152 * @param {!WebInspector.ResourceType=} newContentType |
| 164 * @this {WebInspector.UISourceCode} | 153 * @this {WebInspector.UISourceCode} |
| 165 */ | 154 */ |
| 166 function innerCallback(success, newName, newURL, newOriginURL, newConten
tType) | 155 function innerCallback(success, newName, newOriginURL, newContentType) |
| 167 { | 156 { |
| 168 if (success) | 157 if (success) |
| 169 this._updateName(/** @type {string} */ (newName), /** @type {str
ing} */ (newURL), /** @type {string} */ (newOriginURL), /** @type {!WebInspector
.ResourceType} */ (newContentType)); | 158 this._updateName(/** @type {string} */ (newName), /** @type {str
ing} */ (newOriginURL), /** @type {!WebInspector.ResourceType} */ (newContentTyp
e)); |
| 170 callback(success); | 159 callback(success); |
| 171 } | 160 } |
| 172 }, | 161 }, |
| 173 | 162 |
| 174 remove: function() | 163 remove: function() |
| 175 { | 164 { |
| 176 this._project.deleteFile(this.path()); | 165 this._project.deleteFile(this.path()); |
| 177 }, | 166 }, |
| 178 | 167 |
| 179 /** | 168 /** |
| 180 * @param {string} name | 169 * @param {string} name |
| 181 * @param {string} url | |
| 182 * @param {string} originURL | 170 * @param {string} originURL |
| 183 * @param {!WebInspector.ResourceType=} contentType | 171 * @param {!WebInspector.ResourceType=} contentType |
| 184 */ | 172 */ |
| 185 _updateName: function(name, url, originURL, contentType) | 173 _updateName: function(name, originURL, contentType) |
| 186 { | 174 { |
| 187 var oldURI = this.uri(); | 175 var oldURI = this.uri(); |
| 188 this._name = name; | 176 this._name = name; |
| 189 if (url) | |
| 190 this._url = url; | |
| 191 if (originURL) | 177 if (originURL) |
| 192 this._originURL = originURL; | 178 this._originURL = originURL; |
| 193 if (contentType) | 179 if (contentType) |
| 194 this._contentType = contentType; | 180 this._contentType = contentType; |
| 195 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.TitleChan
ged, oldURI); | 181 this.dispatchEventToListeners(WebInspector.UISourceCode.Events.TitleChan
ged, oldURI); |
| 196 }, | 182 }, |
| 197 | 183 |
| 198 /** | 184 /** |
| 199 * @override | 185 * @override |
| 200 * @return {string} | 186 * @return {string} |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 * @param {string} query | 713 * @param {string} query |
| 728 * @param {boolean} caseSensitive | 714 * @param {boolean} caseSensitive |
| 729 * @param {boolean} isRegex | 715 * @param {boolean} isRegex |
| 730 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} cal
lback | 716 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} cal
lback |
| 731 */ | 717 */ |
| 732 searchInContent: function(query, caseSensitive, isRegex, callback) | 718 searchInContent: function(query, caseSensitive, isRegex, callback) |
| 733 { | 719 { |
| 734 callback([]); | 720 callback([]); |
| 735 } | 721 } |
| 736 } | 722 } |
| OLD | NEW |