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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 10 *
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 * @param {!Sources.NavigatorUISourceCodeTreeNode} node 934 * @param {!Sources.NavigatorUISourceCodeTreeNode} node
935 */ 935 */
936 constructor(navigatorView, uiSourceCode, title, node) { 936 constructor(navigatorView, uiSourceCode, title, node) {
937 super('', false); 937 super('', false);
938 this._nodeType = Sources.NavigatorView.Types.File; 938 this._nodeType = Sources.NavigatorView.Types.File;
939 this._node = node; 939 this._node = node;
940 this.title = title; 940 this.title = title;
941 this.listItemElement.classList.add( 941 this.listItemElement.classList.add(
942 'navigator-' + uiSourceCode.contentType().name() + '-tree-item', 'naviga tor-file-tree-item'); 942 'navigator-' + uiSourceCode.contentType().name() + '-tree-item', 'naviga tor-file-tree-item');
943 this.tooltip = uiSourceCode.url(); 943 this.tooltip = uiSourceCode.url();
944 var iconType = 'largeicon-navigator-file';
945 if (uiSourceCode.contentType() === Common.resourceTypes.Snippet)
946 iconType = 'largeicon-navigator-snippet';
947 this.setLeadingIcons([UI.Icon.create(iconType, 'icon')]);
948
949 this._navigatorView = navigatorView; 944 this._navigatorView = navigatorView;
950 this._uiSourceCode = uiSourceCode; 945 this._uiSourceCode = uiSourceCode;
946 this.updateIcon();
947 }
948
949 updateIcon() {
950 var binding = Persistence.persistence.binding(this._uiSourceCode);
951 if (binding && Runtime.experiments.isEnabled('persistence2')) {
952 var container = createElementWithClass('span', 'icon-stack');
953 var icon = UI.Icon.create('largeicon-navigator-file-sync', 'icon');
954 var badge = UI.Icon.create('badge-navigator-file-sync', 'icon-badge');
955 container.appendChild(icon);
956 container.appendChild(badge);
957 container.title = Persistence.PersistenceUtils.tooltipForUISourceCode(this ._uiSourceCode);
958 this.setLeadingIcons([container]);
959 } else {
960 var iconType = 'largeicon-navigator-file';
961 if (this._uiSourceCode.contentType() === Common.resourceTypes.Snippet)
962 iconType = 'largeicon-navigator-snippet';
963 var defaultIcon = UI.Icon.create(iconType, 'icon');
964 this.setLeadingIcons([defaultIcon]);
965 }
951 } 966 }
952 967
953 /** 968 /**
954 * @return {!Workspace.UISourceCode} 969 * @return {!Workspace.UISourceCode}
955 */ 970 */
956 get uiSourceCode() { 971 get uiSourceCode() {
957 return this._uiSourceCode; 972 return this._uiSourceCode;
958 } 973 }
959 974
960 /** 975 /**
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 updateTitle(ignoreIsDirty) { 1280 updateTitle(ignoreIsDirty) {
1266 if (!this._treeElement) 1281 if (!this._treeElement)
1267 return; 1282 return;
1268 1283
1269 var titleText = this._uiSourceCode.displayName(); 1284 var titleText = this._uiSourceCode.displayName();
1270 if (!ignoreIsDirty && 1285 if (!ignoreIsDirty &&
1271 (this._uiSourceCode.isDirty() || Persistence.persistence.hasUnsavedCommi ttedChanges(this._uiSourceCode))) 1286 (this._uiSourceCode.isDirty() || Persistence.persistence.hasUnsavedCommi ttedChanges(this._uiSourceCode)))
1272 titleText = '*' + titleText; 1287 titleText = '*' + titleText;
1273 1288
1274 this._treeElement.title = titleText; 1289 this._treeElement.title = titleText;
1275 1290 this._treeElement.updateIcon();
1276 var binding = Persistence.persistence.binding(this._uiSourceCode);
1277 if (binding && Runtime.experiments.isEnabled('persistence2')) {
1278 var icon = UI.Icon.create('smallicon-green-checkmark');
1279 icon.title = Persistence.PersistenceUtils.tooltipForUISourceCode(this._uiS ourceCode);
1280 this._treeElement.setTrailingIcons([icon]);
1281 } else {
1282 this._treeElement.setTrailingIcons([]);
1283 }
1284 1291
1285 var tooltip = this._uiSourceCode.url(); 1292 var tooltip = this._uiSourceCode.url();
1286 if (this._uiSourceCode.contentType().isFromSourceMap()) 1293 if (this._uiSourceCode.contentType().isFromSourceMap())
1287 tooltip = Common.UIString('%s (from source map)', this._uiSourceCode.displ ayName()); 1294 tooltip = Common.UIString('%s (from source map)', this._uiSourceCode.displ ayName());
1288 this._treeElement.tooltip = tooltip; 1295 this._treeElement.tooltip = tooltip;
1289 } 1296 }
1290 1297
1291 /** 1298 /**
1292 * @override 1299 * @override
1293 * @return {boolean} 1300 * @return {boolean}
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1603 /** 1610 /**
1604 * @param {string} title 1611 * @param {string} title
1605 * @override 1612 * @override
1606 */ 1613 */
1607 setTitle(title) { 1614 setTitle(title) {
1608 this._title = title; 1615 this._title = title;
1609 if (this._treeElement) 1616 if (this._treeElement)
1610 this._treeElement.title = this._title; 1617 this._treeElement.title = this._title;
1611 } 1618 }
1612 }; 1619 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698