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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * | 10 * |
(...skipping 22 matching lines...) Expand all Loading... |
33 */ | 33 */ |
34 WebInspector.UISourceCodeFrame = function(uiSourceCode) | 34 WebInspector.UISourceCodeFrame = function(uiSourceCode) |
35 { | 35 { |
36 this._uiSourceCode = uiSourceCode; | 36 this._uiSourceCode = uiSourceCode; |
37 WebInspector.SourceFrame.call(this, this._uiSourceCode); | 37 WebInspector.SourceFrame.call(this, this._uiSourceCode); |
38 WebInspector.settings.textEditorAutocompletion.addChangeListener(this._enabl
eAutocompletionIfNeeded, this); | 38 WebInspector.settings.textEditorAutocompletion.addChangeListener(this._enabl
eAutocompletionIfNeeded, this); |
39 this._enableAutocompletionIfNeeded(); | 39 this._enableAutocompletionIfNeeded(); |
40 | 40 |
41 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Working
CopyChanged, this._onWorkingCopyChanged, this); | 41 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Working
CopyChanged, this._onWorkingCopyChanged, this); |
42 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Working
CopyCommitted, this._onWorkingCopyCommitted, this); | 42 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Working
CopyCommitted, this._onWorkingCopyCommitted, this); |
| 43 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.SavedSt
ateUpdated, this._onSavedStateUpdated, this); |
43 this._updateStyle(); | 44 this._updateStyle(); |
44 } | 45 } |
45 | 46 |
46 WebInspector.UISourceCodeFrame.prototype = { | 47 WebInspector.UISourceCodeFrame.prototype = { |
47 /** | 48 /** |
48 * @return {!WebInspector.UISourceCode} | 49 * @return {!WebInspector.UISourceCode} |
49 */ | 50 */ |
50 uiSourceCode: function() | 51 uiSourceCode: function() |
51 { | 52 { |
52 return this._uiSourceCode; | 53 return this._uiSourceCode; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 this.onUISourceCodeContentChanged(); | 143 this.onUISourceCodeContentChanged(); |
143 } | 144 } |
144 this._textEditor.markClean(); | 145 this._textEditor.markClean(); |
145 this._updateStyle(); | 146 this._updateStyle(); |
146 WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMet
rics.UserAction, { | 147 WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMet
rics.UserAction, { |
147 action: WebInspector.UserMetrics.UserActionNames.FileSaved, | 148 action: WebInspector.UserMetrics.UserActionNames.FileSaved, |
148 url: this._uiSourceCode.url | 149 url: this._uiSourceCode.url |
149 }); | 150 }); |
150 }, | 151 }, |
151 | 152 |
| 153 /** |
| 154 * @param {!WebInspector.Event} event |
| 155 */ |
| 156 _onSavedStateUpdated: function(event) |
| 157 { |
| 158 this._updateStyle(); |
| 159 }, |
| 160 |
152 _updateStyle: function() | 161 _updateStyle: function() |
153 { | 162 { |
154 this.element.classList.toggle("source-frame-unsaved-committed-changes",
this._uiSourceCode.hasUnsavedCommittedChanges()); | 163 this.element.classList.toggle("source-frame-unsaved-committed-changes",
this._uiSourceCode.hasUnsavedCommittedChanges()); |
155 }, | 164 }, |
156 | 165 |
157 onUISourceCodeContentChanged: function() | 166 onUISourceCodeContentChanged: function() |
158 { | 167 { |
159 }, | 168 }, |
160 | 169 |
161 /** | 170 /** |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 return detailsRowMessage; | 286 return detailsRowMessage; |
278 }, | 287 }, |
279 | 288 |
280 dispose: function() | 289 dispose: function() |
281 { | 290 { |
282 this.element.remove(); | 291 this.element.remove(); |
283 this._onResize(); | 292 this._onResize(); |
284 delete this._uiSourceCodeFrame; | 293 delete this._uiSourceCodeFrame; |
285 } | 294 } |
286 } | 295 } |
OLD | NEW |