Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js

Issue 2533483002: [DevTools] Typed events and event listeners. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 this._uiSourceCode.addEventListener( 52 this._uiSourceCode.addEventListener(
53 Workspace.UISourceCode.Events.WorkingCopyChanged, this._onWorkingCopyCha nged, this); 53 Workspace.UISourceCode.Events.WorkingCopyChanged, this._onWorkingCopyCha nged, this);
54 this._uiSourceCode.addEventListener( 54 this._uiSourceCode.addEventListener(
55 Workspace.UISourceCode.Events.WorkingCopyCommitted, this._onWorkingCopyC ommitted, this); 55 Workspace.UISourceCode.Events.WorkingCopyCommitted, this._onWorkingCopyC ommitted, this);
56 this._uiSourceCode.addEventListener(Workspace.UISourceCode.Events.MessageAdd ed, this._onMessageAdded, this); 56 this._uiSourceCode.addEventListener(Workspace.UISourceCode.Events.MessageAdd ed, this._onMessageAdded, this);
57 this._uiSourceCode.addEventListener(Workspace.UISourceCode.Events.MessageRem oved, this._onMessageRemoved, this); 57 this._uiSourceCode.addEventListener(Workspace.UISourceCode.Events.MessageRem oved, this._onMessageRemoved, this);
58 this._uiSourceCode.addEventListener( 58 this._uiSourceCode.addEventListener(
59 Workspace.UISourceCode.Events.LineDecorationAdded, this._onLineDecoratio nAdded, this); 59 Workspace.UISourceCode.Events.LineDecorationAdded, this._onLineDecoratio nAdded, this);
60 this._uiSourceCode.addEventListener( 60 this._uiSourceCode.addEventListener(
61 Workspace.UISourceCode.Events.LineDecorationRemoved, this._onLineDecorat ionRemoved, this); 61 Workspace.UISourceCode.Events.LineDecorationRemoved, this._onLineDecorat ionRemoved, this);
62 Persistence.persistence.addEventListener( 62 Persistence.persistence.addEventListener(Persistence.Persistence.BindingChan gedEvent, this._onBindingChanged, this);
63 Persistence.Persistence.Events.BindingCreated, this._onBindingChanged, t his);
64 Persistence.persistence.addEventListener(
65 Persistence.Persistence.Events.BindingRemoved, this._onBindingChanged, t his);
66 63
67 this.textEditor.addEventListener( 64 this.textEditor.addEventListener(
68 SourceFrame.SourcesTextEditor.Events.EditorBlurred, 65 SourceFrame.SourcesTextEditor.Events.EditorBlurred,
69 () => UI.context.setFlavor(Sources.UISourceCodeFrame, null)); 66 () => UI.context.setFlavor(Sources.UISourceCodeFrame, null));
70 this.textEditor.addEventListener( 67 this.textEditor.addEventListener(
71 SourceFrame.SourcesTextEditor.Events.EditorFocused, 68 SourceFrame.SourcesTextEditor.Events.EditorFocused,
72 () => UI.context.setFlavor(Sources.UISourceCodeFrame, this)); 69 () => UI.context.setFlavor(Sources.UISourceCodeFrame, this));
73 70
74 this._updateStyle(); 71 this._updateStyle();
75 72
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 _onWorkingCopyCommitted(event) { 198 _onWorkingCopyCommitted(event) {
202 if (!this._muteSourceCodeEvents) { 199 if (!this._muteSourceCodeEvents) {
203 this._innerSetContent(this._uiSourceCode.workingCopy()); 200 this._innerSetContent(this._uiSourceCode.workingCopy());
204 this.onUISourceCodeContentChanged(); 201 this.onUISourceCodeContentChanged();
205 } 202 }
206 this._textEditor.markClean(); 203 this._textEditor.markClean();
207 this._updateStyle(); 204 this._updateStyle();
208 } 205 }
209 206
210 /** 207 /**
211 * @param {!Common.Event} event 208 * @param {!Persistence.Persistence.BindingChangedEvent} event
212 */ 209 */
213 _onBindingChanged(event) { 210 _onBindingChanged(event) {
214 var binding = /** @type {!Persistence.PersistenceBinding} */ (event.data); 211 if (event.binding.network === this._uiSourceCode || event.binding.fileSystem === this._uiSourceCode)
215 if (binding.network === this._uiSourceCode || binding.fileSystem === this._u iSourceCode)
216 this._updateStyle(); 212 this._updateStyle();
217 } 213 }
218 214
219 _updateStyle() { 215 _updateStyle() {
220 this.element.classList.toggle( 216 this.element.classList.toggle(
221 'source-frame-unsaved-committed-changes', 217 'source-frame-unsaved-committed-changes',
222 Persistence.persistence.hasUnsavedCommittedChanges(this._uiSourceCode)); 218 Persistence.persistence.hasUnsavedCommittedChanges(this._uiSourceCode));
223 this.setEditable(!this._canEditSource()); 219 this.setEditable(!this._canEditSource());
224 } 220 }
225 221
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 649
654 /** 650 /**
655 * @param {!Workspace.UISourceCode.Message} a 651 * @param {!Workspace.UISourceCode.Message} a
656 * @param {!Workspace.UISourceCode.Message} b 652 * @param {!Workspace.UISourceCode.Message} b
657 * @return {number} 653 * @return {number}
658 */ 654 */
659 Workspace.UISourceCode.Message.messageLevelComparator = function(a, b) { 655 Workspace.UISourceCode.Message.messageLevelComparator = function(a, b) {
660 return Workspace.UISourceCode.Message._messageLevelPriority[a.level()] - 656 return Workspace.UISourceCode.Message._messageLevelPriority[a.level()] -
661 Workspace.UISourceCode.Message._messageLevelPriority[b.level()]; 657 Workspace.UISourceCode.Message._messageLevelPriority[b.level()];
662 }; 658 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698