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

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: missing jsdoc Created 4 years 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 icon = UI.Icon.create('largeicon-navigator-file-synced', 'icon');
953 var badge = UI.Icon.create('badge-navigator-file-synced', 'icon-badge');
954 var combined = UI.Icon.combine([icon, badge]);
955 combined.title = Persistence.PersistenceUtils.tooltipForUISourceCode(this. _uiSourceCode);
956 this.setLeadingIcons([combined]);
957 } else {
958 var iconType = 'largeicon-navigator-file';
959 if (this._uiSourceCode.contentType() === Common.resourceTypes.Snippet)
960 iconType = 'largeicon-navigator-snippet';
961 var defaultIcon = UI.Icon.create(iconType, 'icon');
962 defaultIcon.classList.add('icon-container');
963 this.setLeadingIcons([defaultIcon]);
964 }
951 } 965 }
952 966
953 /** 967 /**
954 * @return {!Workspace.UISourceCode} 968 * @return {!Workspace.UISourceCode}
955 */ 969 */
956 get uiSourceCode() { 970 get uiSourceCode() {
957 return this._uiSourceCode; 971 return this._uiSourceCode;
958 } 972 }
959 973
960 /** 974 /**
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 updateTitle(ignoreIsDirty) { 1279 updateTitle(ignoreIsDirty) {
1266 if (!this._treeElement) 1280 if (!this._treeElement)
1267 return; 1281 return;
1268 1282
1269 var titleText = this._uiSourceCode.displayName(); 1283 var titleText = this._uiSourceCode.displayName();
1270 if (!ignoreIsDirty && 1284 if (!ignoreIsDirty &&
1271 (this._uiSourceCode.isDirty() || Persistence.persistence.hasUnsavedCommi ttedChanges(this._uiSourceCode))) 1285 (this._uiSourceCode.isDirty() || Persistence.persistence.hasUnsavedCommi ttedChanges(this._uiSourceCode)))
1272 titleText = '*' + titleText; 1286 titleText = '*' + titleText;
1273 1287
1274 this._treeElement.title = titleText; 1288 this._treeElement.title = titleText;
1275 1289 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 1290
1285 var tooltip = this._uiSourceCode.url(); 1291 var tooltip = this._uiSourceCode.url();
1286 if (this._uiSourceCode.contentType().isFromSourceMap()) 1292 if (this._uiSourceCode.contentType().isFromSourceMap())
1287 tooltip = Common.UIString('%s (from source map)', this._uiSourceCode.displ ayName()); 1293 tooltip = Common.UIString('%s (from source map)', this._uiSourceCode.displ ayName());
1288 this._treeElement.tooltip = tooltip; 1294 this._treeElement.tooltip = tooltip;
1289 } 1295 }
1290 1296
1291 /** 1297 /**
1292 * @override 1298 * @override
1293 * @return {boolean} 1299 * @return {boolean}
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1603 /** 1609 /**
1604 * @param {string} title 1610 * @param {string} title
1605 * @override 1611 * @override
1606 */ 1612 */
1607 setTitle(title) { 1613 setTitle(title) {
1608 this._title = title; 1614 this._title = title;
1609 if (this._treeElement) 1615 if (this._treeElement)
1610 this._treeElement.title = this._title; 1616 this._treeElement.title = this._title;
1611 } 1617 }
1612 }; 1618 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698