| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 WebInspector.PersistenceUtils = class { | 5 Persistence.PersistenceUtils = class { |
| 6 /** | 6 /** |
| 7 * @param {!WebInspector.UISourceCode} uiSourceCode | 7 * @param {!Workspace.UISourceCode} uiSourceCode |
| 8 * @return {string} | 8 * @return {string} |
| 9 */ | 9 */ |
| 10 static tooltipForUISourceCode(uiSourceCode) { | 10 static tooltipForUISourceCode(uiSourceCode) { |
| 11 var binding = WebInspector.persistence.binding(uiSourceCode); | 11 var binding = Persistence.persistence.binding(uiSourceCode); |
| 12 if (!binding) | 12 if (!binding) |
| 13 return ''; | 13 return ''; |
| 14 if (uiSourceCode === binding.network) | 14 if (uiSourceCode === binding.network) |
| 15 return WebInspector.UIString('Persisted to file system: %s', binding.fileS
ystem.url().trimMiddle(150)); | 15 return Common.UIString('Persisted to file system: %s', binding.fileSystem.
url().trimMiddle(150)); |
| 16 if (binding.network.contentType().isFromSourceMap()) | 16 if (binding.network.contentType().isFromSourceMap()) |
| 17 return WebInspector.UIString('Linked to source map: %s', binding.network.u
rl().trimMiddle(150)); | 17 return Common.UIString('Linked to source map: %s', binding.network.url().t
rimMiddle(150)); |
| 18 return WebInspector.UIString('Linked to %s', binding.network.url().trimMiddl
e(150)); | 18 return Common.UIString('Linked to %s', binding.network.url().trimMiddle(150)
); |
| 19 } | 19 } |
| 20 }; | 20 }; |
| 21 | 21 |
| 22 /** | 22 /** |
| 23 * @extends {WebInspector.Object} | 23 * @extends {Common.Object} |
| 24 * @implements {WebInspector.LinkDecorator} | 24 * @implements {Components.LinkDecorator} |
| 25 */ | 25 */ |
| 26 WebInspector.PersistenceUtils.LinkDecorator = class extends WebInspector.Object
{ | 26 Persistence.PersistenceUtils.LinkDecorator = class extends Common.Object { |
| 27 /** | 27 /** |
| 28 * @param {!WebInspector.Persistence} persistence | 28 * @param {!Persistence.Persistence} persistence |
| 29 */ | 29 */ |
| 30 constructor(persistence) { | 30 constructor(persistence) { |
| 31 super(); | 31 super(); |
| 32 persistence.addEventListener(WebInspector.Persistence.Events.BindingCreated,
this._bindingChanged, this); | 32 persistence.addEventListener(Persistence.Persistence.Events.BindingCreated,
this._bindingChanged, this); |
| 33 persistence.addEventListener(WebInspector.Persistence.Events.BindingRemoved,
this._bindingChanged, this); | 33 persistence.addEventListener(Persistence.Persistence.Events.BindingRemoved,
this._bindingChanged, this); |
| 34 } | 34 } |
| 35 | 35 |
| 36 /** | 36 /** |
| 37 * @param {!WebInspector.Event} event | 37 * @param {!Common.Event} event |
| 38 */ | 38 */ |
| 39 _bindingChanged(event) { | 39 _bindingChanged(event) { |
| 40 var binding = /** @type {!WebInspector.PersistenceBinding} */(event.data); | 40 var binding = /** @type {!Persistence.PersistenceBinding} */(event.data); |
| 41 this.dispatchEventToListeners(WebInspector.LinkDecorator.Events.LinkIconChan
ged, binding.network); | 41 this.dispatchEventToListeners(Components.LinkDecorator.Events.LinkIconChange
d, binding.network); |
| 42 } | 42 } |
| 43 | 43 |
| 44 /** | 44 /** |
| 45 * @override | 45 * @override |
| 46 * @param {!WebInspector.UISourceCode} uiSourceCode | 46 * @param {!Workspace.UISourceCode} uiSourceCode |
| 47 * @return {?WebInspector.Icon} | 47 * @return {?UI.Icon} |
| 48 */ | 48 */ |
| 49 linkIcon(uiSourceCode) { | 49 linkIcon(uiSourceCode) { |
| 50 var binding = WebInspector.persistence.binding(uiSourceCode); | 50 var binding = Persistence.persistence.binding(uiSourceCode); |
| 51 if (!binding) | 51 if (!binding) |
| 52 return null; | 52 return null; |
| 53 var icon = WebInspector.Icon.create('smallicon-green-checkmark'); | 53 var icon = UI.Icon.create('smallicon-green-checkmark'); |
| 54 icon.title = WebInspector.PersistenceUtils.tooltipForUISourceCode(uiSourceCo
de); | 54 icon.title = Persistence.PersistenceUtils.tooltipForUISourceCode(uiSourceCod
e); |
| 55 return icon; | 55 return icon; |
| 56 } | 56 } |
| 57 }; | 57 }; |
| OLD | NEW |