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

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

Issue 2594883002: DevTools: [Persistence] introduce badged icons instead of checkmarks (Closed)
Patch Set: address comments Created 3 years, 12 months 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 Persistence.PersistenceUtils = class { 5 Persistence.PersistenceUtils = class {
6 /** 6 /**
7 * @param {!Workspace.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 = Persistence.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 Common.UIString('Persisted to file system: %s', binding.fileSystem. 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 Common.UIString('Linked to source map: %s', binding.network.url().t rimMiddle(150)); 17 return Common.UIString('Linked to source map: %s', binding.network.url().t rimMiddle(150));
18 return Common.UIString('Linked to %s', binding.network.url().trimMiddle(150) ); 18 return Common.UIString('Linked to %s', binding.network.url().trimMiddle(150) );
19 } 19 }
20
21 /**
22 * @param {!Workspace.UISourceCode} uiSourceCode
23 * @return {?UI.Icon}
24 */
25 static iconForUISourceCode(uiSourceCode) {
26 if (!Runtime.experiments.isEnabled('persistence2'))
27 return null;
28 var binding = Persistence.persistence.binding(uiSourceCode);
29 if (binding) {
30 var icon = UI.Icon.create('smallicon-file-sync');
31 icon.title = Persistence.PersistenceUtils.tooltipForUISourceCode(binding.f ileSystem);
32 return icon;
33 }
34 if (uiSourceCode.project().type() !== Workspace.projectTypes.FileSystem)
35 return null;
36 var icon = UI.Icon.create('smallicon-file');
37 icon.title = Persistence.PersistenceUtils.tooltipForUISourceCode(uiSourceCod e);
38 return icon;
39 }
20 }; 40 };
21 41
22 /** 42 /**
23 * @extends {Common.Object} 43 * @extends {Common.Object}
24 * @implements {Components.LinkDecorator} 44 * @implements {Components.LinkDecorator}
25 */ 45 */
26 Persistence.PersistenceUtils.LinkDecorator = class extends Common.Object { 46 Persistence.PersistenceUtils.LinkDecorator = class extends Common.Object {
27 /** 47 /**
28 * @param {!Persistence.Persistence} persistence 48 * @param {!Persistence.Persistence} persistence
29 */ 49 */
(...skipping 10 matching lines...) Expand all
40 var binding = /** @type {!Persistence.PersistenceBinding} */ (event.data); 60 var binding = /** @type {!Persistence.PersistenceBinding} */ (event.data);
41 this.dispatchEventToListeners(Components.LinkDecorator.Events.LinkIconChange d, binding.network); 61 this.dispatchEventToListeners(Components.LinkDecorator.Events.LinkIconChange d, binding.network);
42 } 62 }
43 63
44 /** 64 /**
45 * @override 65 * @override
46 * @param {!Workspace.UISourceCode} uiSourceCode 66 * @param {!Workspace.UISourceCode} uiSourceCode
47 * @return {?UI.Icon} 67 * @return {?UI.Icon}
48 */ 68 */
49 linkIcon(uiSourceCode) { 69 linkIcon(uiSourceCode) {
50 var binding = Persistence.persistence.binding(uiSourceCode); 70 return Persistence.PersistenceUtils.iconForUISourceCode(uiSourceCode);
51 if (!binding)
52 return null;
53 var icon = UI.Icon.create('smallicon-green-checkmark');
54 icon.title = Persistence.PersistenceUtils.tooltipForUISourceCode(uiSourceCod e);
55 return icon;
56 } 71 }
57 }; 72 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698