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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/WorkspaceMappingTip.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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 /** 4 /**
5 * @unrestricted 5 * @unrestricted
6 */ 6 */
7 Sources.WorkspaceMappingTip = class { 7 Sources.WorkspaceMappingTip = class {
8 /** 8 /**
9 * @param {!Sources.SourcesPanel} sourcesPanel 9 * @param {!Sources.SourcesPanel} sourcesPanel
10 * @param {!Workspace.Workspace} workspace 10 * @param {!Workspace.Workspace} workspace
11 */ 11 */
12 constructor(sourcesPanel, workspace) { 12 constructor(sourcesPanel, workspace) {
13 this._sourcesPanel = sourcesPanel; 13 this._sourcesPanel = sourcesPanel;
14 this._workspace = workspace; 14 this._workspace = workspace;
15 15
16 this._sourcesView = this._sourcesPanel.sourcesView(); 16 this._sourcesView = this._sourcesPanel.sourcesView();
17 this._workspaceInfobarDisabledSetting = Common.settings.createSetting('works paceInfobarDisabled', false); 17 this._workspaceInfobarDisabledSetting = Common.settings.createSetting('works paceInfobarDisabled', false);
18 this._workspaceMappingInfobarDisabledSetting = 18 this._workspaceMappingInfobarDisabledSetting =
19 Common.settings.createSetting('workspaceMappingInfobarDisabled', false); 19 Common.settings.createSetting('workspaceMappingInfobarDisabled', false);
20 20
21 if (this._workspaceInfobarDisabledSetting.get() && this._workspaceMappingInf obarDisabledSetting.get()) 21 if (this._workspaceInfobarDisabledSetting.get() && this._workspaceMappingInf obarDisabledSetting.get())
22 return; 22 return;
23 this._sourcesView.addEventListener(Sources.SourcesView.Events.EditorSelected , this._editorSelected.bind(this)); 23 this._sourcesView.addEventListener(Sources.SourcesView.Events.EditorSelected , this._editorSelected.bind(this));
24 Persistence.persistence.addEventListener(Persistence.Persistence.Events.Bind ingCreated, this._bindingCreated, this); 24 Persistence.persistence.addEventListener(Persistence.Persistence.BindingChan gedEvent, this._bindingChanged, this);
25 } 25 }
26 26
27 /** 27 /**
28 * @param {!Common.Event} event 28 * @param {!Persistence.Persistence.BindingChangedEvent} event
29 */ 29 */
30 _bindingCreated(event) { 30 _bindingChanged(event) {
31 var binding = /** @type {!Persistence.PersistenceBinding} */ (event.data); 31 if (!event.created)
32 if (binding.network[Sources.WorkspaceMappingTip._infobarSymbol]) 32 return;
33 binding.network[Sources.WorkspaceMappingTip._infobarSymbol].dispose(); 33 if (event.binding.network[Sources.WorkspaceMappingTip._infobarSymbol])
34 if (binding.fileSystem[Sources.WorkspaceMappingTip._infobarSymbol]) 34 event.binding.network[Sources.WorkspaceMappingTip._infobarSymbol].dispose( );
35 binding.fileSystem[Sources.WorkspaceMappingTip._infobarSymbol].dispose(); 35 if (event.binding.fileSystem[Sources.WorkspaceMappingTip._infobarSymbol])
36 event.binding.fileSystem[Sources.WorkspaceMappingTip._infobarSymbol].dispo se();
36 } 37 }
37 38
38 /** 39 /**
39 * @param {!Common.Event} event 40 * @param {!Common.Event} event
40 */ 41 */
41 _editorSelected(event) { 42 _editorSelected(event) {
42 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data); 43 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data);
43 if (this._editorSelectedTimer) 44 if (this._editorSelectedTimer)
44 clearTimeout(this._editorSelectedTimer); 45 clearTimeout(this._editorSelectedTimer);
45 this._editorSelectedTimer = setTimeout(this._updateSuggestedMappingInfobar.b ind(this, uiSourceCode), 3000); 46 this._editorSelectedTimer = setTimeout(this._updateSuggestedMappingInfobar.b ind(this, uiSourceCode), 3000);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 rowElement.appendChild( 173 rowElement.appendChild(
173 UI.createDocumentationLink('../setup/setup-workflow', Common.UIString('w orkspaces documentation'))); 174 UI.createDocumentationLink('../setup/setup-workflow', Common.UIString('w orkspaces documentation')));
174 rowElement.createTextChild('.'); 175 rowElement.createTextChild('.');
175 uiSourceCode[Sources.WorkspaceMappingTip._infobarSymbol] = infobar; 176 uiSourceCode[Sources.WorkspaceMappingTip._infobarSymbol] = infobar;
176 uiSourceCodeFrame.attachInfobars([infobar]); 177 uiSourceCodeFrame.attachInfobars([infobar]);
177 UI.runCSSAnimationOnce(infobar.element, 'source-frame-infobar-animation'); 178 UI.runCSSAnimationOnce(infobar.element, 'source-frame-infobar-animation');
178 } 179 }
179 }; 180 };
180 181
181 Sources.WorkspaceMappingTip._infobarSymbol = Symbol('infobar'); 182 Sources.WorkspaceMappingTip._infobarSymbol = Symbol('infobar');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698