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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/persistence/PersistenceUtils.js

Issue 2487293002: DevTools: introduce sync checkmarks icons in StylesSidebarPane. (Closed)
Patch Set: DevTools: introduce icons in linkifier. 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 unified diff | Download patch
OLDNEW
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 WebInspector.PersistenceUtils = class {
6 /** 6 /**
7 * @param {!WebInspector.UISourceCode} uiSourceCode 7 * @param {!WebInspector.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 = WebInspector.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 WebInspector.UIString('Persisted to file system: %s', binding.fileS ystem.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 WebInspector.UIString('Linked to source map: %s', binding.network.u rl().trimMiddle(150));
18 return WebInspector.UIString('Linked to %s', binding.network.url().trimMiddl e(150)); 18 return WebInspector.UIString('Linked to %s', binding.network.url().trimMiddl e(150));
19 } 19 }
20 }; 20 };
21
22 /**
23 * @extends {WebInspector.Object}
24 * @implements {WebInspector.LinkDecorator}
25 */
26 WebInspector.PersistenceUtils.LinkDecorator = class extends WebInspector.Object {
27 constructor(persistence) {
dgozman 2016/11/10 01:01:43 JSDoc
lushnikov 2016/11/10 01:13:45 Done.
28 super();
29 persistence.addEventListener(WebInspector.Persistence.Events.BindingCreated, this._bindingChanged, this);
30 persistence.addEventListener(WebInspector.Persistence.Events.BindingRemoved, this._bindingChanged, this);
31 }
32
33 /**
34 * @param {!WebInspector.Event} event
35 */
36 _bindingChanged(event) {
37 var binding = /** @type {!WebInspector.PersistenceBinding} */(event.data);
38 this.dispatchEventToListeners(WebInspector.LinkDecorator.Events.LinkIconChan ged, binding.network);
39 }
40
41 /**
42 * @override
43 * @param {!WebInspector.UISourceCode} uiSourceCode
44 * @return {?WebInspector.Icon}
45 */
46 linkIcon(uiSourceCode) {
47 var binding = WebInspector.persistence.binding(uiSourceCode);
48 if (!binding)
49 return null;
50 var icon = WebInspector.Icon.create('smallicon-green-checkmark');
51 icon.title = WebInspector.PersistenceUtils.tooltipForUISourceCode(uiSourceCo de);
52 return icon;
53 }
54 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698