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

Unified Diff: third_party/WebKit/Source/devtools/front_end/persistence/Persistence.js

Issue 2487293002: DevTools: introduce sync checkmarks icons in StylesSidebarPane. (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/persistence/Persistence.js
diff --git a/third_party/WebKit/Source/devtools/front_end/persistence/Persistence.js b/third_party/WebKit/Source/devtools/front_end/persistence/Persistence.js
index 209cfb6d99c616038bb3263c06df6d1012842075..af560e2efb9b635c64e419c0f4340338e5149107 100644
--- a/third_party/WebKit/Source/devtools/front_end/persistence/Persistence.js
+++ b/third_party/WebKit/Source/devtools/front_end/persistence/Persistence.js
@@ -17,12 +17,15 @@ WebInspector.Persistence = class extends WebInspector.Object {
/** @type {!Map<string, number>} */
this._filePathPrefixesToBindingCount = new Map();
- if (Runtime.experiments.isEnabled('persistence2'))
+ if (Runtime.experiments.isEnabled('persistence2')) {
+ var iconProvider = new WebInspector.Persistence.LinkifierIconProvider(this);
+ WebInspector.Linkifier.registerIconProvider(iconProvider);
this._mapping =
new WebInspector.Automapping(workspace, this._onBindingCreated.bind(this), this._onBindingRemoved.bind(this));
- else
+ } else {
this._mapping = new WebInspector.DefaultMapping(
workspace, fileSystemMapping, this._onBindingCreated.bind(this), this._onBindingRemoved.bind(this));
+ }
}
/**
@@ -254,5 +257,34 @@ WebInspector.PersistenceBinding = class {
}
};
+/**
+ * @extends {WebInspector.Object}
+ * @implements {WebInspector.LinkifierIconProvider}
+ */
+WebInspector.Persistence.LinkifierIconProvider = class extends WebInspector.Object {
+ constructor(persistence) {
+ 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.LinkifierIconProvider.Events.IconChanged, binding.network);
+ }
+
+ /**
+ * @override
+ * @param {!WebInspector.UISourceCode} uiSourceCode
+ */
+ iconType(uiSourceCode) {
+ var binding = WebInspector.persistence.binding(uiSourceCode);
+ return binding ? 'smallicon-checkmark' : '';
+ }
+};
+
/** @type {!WebInspector.Persistence} */
WebInspector.persistence;

Powered by Google App Engine
This is Rietveld 408576698