Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/persistence/PersistenceUtils.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/persistence/PersistenceUtils.js b/third_party/WebKit/Source/devtools/front_end/persistence/PersistenceUtils.js |
| index 62b9de0e24e7c9975399f2302f192c4a6be4a28f..3db5bfd2614c6c40cd3620289f95f1423aaf2214 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/persistence/PersistenceUtils.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/persistence/PersistenceUtils.js |
| @@ -18,3 +18,37 @@ WebInspector.PersistenceUtils = class { |
| return WebInspector.UIString('Linked to %s', binding.network.url().trimMiddle(150)); |
| } |
| }; |
| + |
| +/** |
| + * @extends {WebInspector.Object} |
| + * @implements {WebInspector.LinkDecorator} |
| + */ |
| +WebInspector.PersistenceUtils.LinkDecorator = class extends WebInspector.Object { |
| + constructor(persistence) { |
|
dgozman
2016/11/10 01:01:43
JSDoc
lushnikov
2016/11/10 01:13:45
Done.
|
| + super(); |
| + persistence.addEventListener(WebInspector.Persistence.Events.BindingCreated, this._bindingChanged, this); |
| + persistence.addEventListener(WebInspector.Persistence.Events.BindingRemoved, this._bindingChanged, this); |
| + } |
| + |
| + /** |
| + * @param {!WebInspector.Event} event |
| + */ |
| + _bindingChanged(event) { |
| + var binding = /** @type {!WebInspector.PersistenceBinding} */(event.data); |
| + this.dispatchEventToListeners(WebInspector.LinkDecorator.Events.LinkIconChanged, binding.network); |
| + } |
| + |
| + /** |
| + * @override |
| + * @param {!WebInspector.UISourceCode} uiSourceCode |
| + * @return {?WebInspector.Icon} |
| + */ |
| + linkIcon(uiSourceCode) { |
| + var binding = WebInspector.persistence.binding(uiSourceCode); |
| + if (!binding) |
| + return null; |
| + var icon = WebInspector.Icon.create('smallicon-green-checkmark'); |
| + icon.title = WebInspector.PersistenceUtils.tooltipForUISourceCode(uiSourceCode); |
| + return icon; |
| + } |
| +}; |