OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 { | 929 { |
930 WebInspector.context.setFlavor(WebInspector.ProfilesPanel, null); | 930 WebInspector.context.setFlavor(WebInspector.ProfilesPanel, null); |
931 }, | 931 }, |
932 | 932 |
933 __proto__: WebInspector.PanelWithSidebar.prototype | 933 __proto__: WebInspector.PanelWithSidebar.prototype |
934 } | 934 } |
935 | 935 |
936 | 936 |
937 /** | 937 /** |
938 * @constructor | 938 * @constructor |
939 * @extends {WebInspector.SidebarSectionTreeElement} | 939 * @extends {TreeElement} |
940 * @param {!WebInspector.ProfileType.DataDisplayDelegate} dataDisplayDelegate | 940 * @param {!WebInspector.ProfileType.DataDisplayDelegate} dataDisplayDelegate |
941 * @param {!WebInspector.ProfileType} profileType | 941 * @param {!WebInspector.ProfileType} profileType |
942 */ | 942 */ |
943 WebInspector.ProfileTypeSidebarSection = function(dataDisplayDelegate, profileTy
pe) | 943 WebInspector.ProfileTypeSidebarSection = function(dataDisplayDelegate, profileTy
pe) |
944 { | 944 { |
945 WebInspector.SidebarSectionTreeElement.call(this, profileType.treeItemTitle)
; | 945 TreeElement.call(this, profileType.treeItemTitle.escapeHTML(), true); |
946 this._dataDisplayDelegate = dataDisplayDelegate; | 946 this._dataDisplayDelegate = dataDisplayDelegate; |
| 947 /** @type {!Array<!WebInspector.ProfileSidebarTreeElement>} */ |
947 this._profileTreeElements = []; | 948 this._profileTreeElements = []; |
| 949 /** @type {!Object<string, !WebInspector.ProfileTypeSidebarSection.ProfileGr
oup>} */ |
948 this._profileGroups = {}; | 950 this._profileGroups = {}; |
| 951 this.expand(); |
949 this.hidden = true; | 952 this.hidden = true; |
950 } | 953 } |
951 | 954 |
952 /** | 955 /** |
953 * @constructor | 956 * @constructor |
954 */ | 957 */ |
955 WebInspector.ProfileTypeSidebarSection.ProfileGroup = function() | 958 WebInspector.ProfileTypeSidebarSection.ProfileGroup = function() |
956 { | 959 { |
| 960 /** @type {!Array<!WebInspector.ProfileSidebarTreeElement>} */ |
957 this.profileSidebarTreeElements = []; | 961 this.profileSidebarTreeElements = []; |
| 962 /** @type {?WebInspector.ProfileGroupSidebarTreeElement} */ |
958 this.sidebarTreeElement = null; | 963 this.sidebarTreeElement = null; |
959 } | 964 } |
960 | 965 |
961 WebInspector.ProfileTypeSidebarSection.prototype = { | 966 WebInspector.ProfileTypeSidebarSection.prototype = { |
962 /** | 967 /** |
963 * @param {!WebInspector.ProfileHeader} profile | 968 * @param {!WebInspector.ProfileHeader} profile |
964 */ | 969 */ |
965 addProfileHeader: function(profile) | 970 addProfileHeader: function(profile) |
966 { | 971 { |
967 this.hidden = false; | 972 this.hidden = false; |
(...skipping 21 matching lines...) Expand all Loading... |
989 var index = this.children().indexOf(firstProfileTreeElement); | 994 var index = this.children().indexOf(firstProfileTreeElement); |
990 this.insertChild(group.sidebarTreeElement, index); | 995 this.insertChild(group.sidebarTreeElement, index); |
991 | 996 |
992 // Move the first profile to the group. | 997 // Move the first profile to the group. |
993 var selected = firstProfileTreeElement.selected; | 998 var selected = firstProfileTreeElement.selected; |
994 this.removeChild(firstProfileTreeElement); | 999 this.removeChild(firstProfileTreeElement); |
995 group.sidebarTreeElement.appendChild(firstProfileTreeElement); | 1000 group.sidebarTreeElement.appendChild(firstProfileTreeElement); |
996 if (selected) | 1001 if (selected) |
997 firstProfileTreeElement.revealAndSelect(); | 1002 firstProfileTreeElement.revealAndSelect(); |
998 | 1003 |
999 firstProfileTreeElement.small = true; | 1004 firstProfileTreeElement.setSmall(true); |
1000 firstProfileTreeElement.mainTitle = WebInspector.UIString("Run %
d", 1); | 1005 firstProfileTreeElement.setMainTitle(WebInspector.UIString("Run
%d", 1)); |
1001 | 1006 |
1002 this.treeOutline.element.classList.add("some-expandable"); | 1007 this.treeOutline.element.classList.add("some-expandable"); |
1003 } | 1008 } |
1004 | 1009 |
1005 if (groupSize >= 2) { | 1010 if (groupSize >= 2) { |
1006 sidebarParent = group.sidebarTreeElement; | 1011 sidebarParent = group.sidebarTreeElement; |
1007 profileTreeElement.small = true; | 1012 profileTreeElement.setSmall(true); |
1008 profileTreeElement.mainTitle = WebInspector.UIString("Run %d", g
roupSize); | 1013 profileTreeElement.setMainTitle(WebInspector.UIString("Run %d",
groupSize)); |
1009 } | 1014 } |
1010 } | 1015 } |
1011 | 1016 |
1012 sidebarParent.appendChild(profileTreeElement); | 1017 sidebarParent.appendChild(profileTreeElement); |
1013 }, | 1018 }, |
1014 | 1019 |
1015 /** | 1020 /** |
1016 * @param {!WebInspector.ProfileHeader} profile | 1021 * @param {!WebInspector.ProfileHeader} profile |
1017 * @return {boolean} | 1022 * @return {boolean} |
1018 */ | 1023 */ |
1019 removeProfileHeader: function(profile) | 1024 removeProfileHeader: function(profile) |
1020 { | 1025 { |
1021 var index = this._sidebarElementIndex(profile); | 1026 var index = this._sidebarElementIndex(profile); |
1022 if (index === -1) | 1027 if (index === -1) |
1023 return false; | 1028 return false; |
1024 var profileTreeElement = this._profileTreeElements[index]; | 1029 var profileTreeElement = this._profileTreeElements[index]; |
1025 this._profileTreeElements.splice(index, 1); | 1030 this._profileTreeElements.splice(index, 1); |
1026 | 1031 |
1027 var sidebarParent = this; | 1032 var sidebarParent = this; |
1028 var group = this._profileGroups[profile.title]; | 1033 var group = this._profileGroups[profile.title]; |
1029 if (group) { | 1034 if (group) { |
1030 var groupElements = group.profileSidebarTreeElements; | 1035 var groupElements = group.profileSidebarTreeElements; |
1031 groupElements.splice(groupElements.indexOf(profileTreeElement), 1); | 1036 groupElements.splice(groupElements.indexOf(profileTreeElement), 1); |
1032 if (groupElements.length === 1) { | 1037 if (groupElements.length === 1) { |
1033 // Move the last profile out of its group and remove the group. | 1038 // Move the last profile out of its group and remove the group. |
1034 var pos = sidebarParent.children().indexOf(group.sidebarTreeElem
ent); | 1039 var pos = sidebarParent.children().indexOf(/** @type {!WebInspec
tor.ProfileGroupSidebarTreeElement} */ (group.sidebarTreeElement)); |
1035 group.sidebarTreeElement.removeChild(groupElements[0]); | 1040 group.sidebarTreeElement.removeChild(groupElements[0]); |
1036 this.insertChild(groupElements[0], pos); | 1041 this.insertChild(groupElements[0], pos); |
1037 groupElements[0].small = false; | 1042 groupElements[0].setSmall(false); |
1038 groupElements[0].mainTitle = group.sidebarTreeElement.title; | 1043 groupElements[0].setMainTitle(profile.title); |
1039 this.removeChild(group.sidebarTreeElement); | 1044 this.removeChild(group.sidebarTreeElement); |
1040 } | 1045 } |
1041 if (groupElements.length !== 0) | 1046 if (groupElements.length !== 0) |
1042 sidebarParent = group.sidebarTreeElement; | 1047 sidebarParent = group.sidebarTreeElement; |
1043 } | 1048 } |
1044 sidebarParent.removeChild(profileTreeElement); | 1049 sidebarParent.removeChild(profileTreeElement); |
1045 profileTreeElement.dispose(); | 1050 profileTreeElement.dispose(); |
1046 | 1051 |
1047 if (this.childCount()) | 1052 if (this.childCount()) |
1048 return false; | 1053 return false; |
(...skipping 18 matching lines...) Expand all Loading... |
1067 _sidebarElementIndex: function(profile) | 1072 _sidebarElementIndex: function(profile) |
1068 { | 1073 { |
1069 var elements = this._profileTreeElements; | 1074 var elements = this._profileTreeElements; |
1070 for (var i = 0; i < elements.length; i++) { | 1075 for (var i = 0; i < elements.length; i++) { |
1071 if (elements[i].profile === profile) | 1076 if (elements[i].profile === profile) |
1072 return i; | 1077 return i; |
1073 } | 1078 } |
1074 return -1; | 1079 return -1; |
1075 }, | 1080 }, |
1076 | 1081 |
1077 __proto__: WebInspector.SidebarSectionTreeElement.prototype | 1082 /** |
| 1083 * @override |
| 1084 */ |
| 1085 onattach: function() |
| 1086 { |
| 1087 this.listItemElement.classList.add("sidebar-tree-section"); |
| 1088 }, |
| 1089 |
| 1090 __proto__: TreeElement.prototype |
1078 } | 1091 } |
1079 | 1092 |
1080 | 1093 |
1081 /** | 1094 /** |
1082 * @constructor | 1095 * @constructor |
1083 * @implements {WebInspector.ContextMenu.Provider} | 1096 * @implements {WebInspector.ContextMenu.Provider} |
1084 */ | 1097 */ |
1085 WebInspector.ProfilesPanel.ContextMenuProvider = function() | 1098 WebInspector.ProfilesPanel.ContextMenuProvider = function() |
1086 { | 1099 { |
1087 } | 1100 } |
1088 | 1101 |
1089 WebInspector.ProfilesPanel.ContextMenuProvider.prototype = { | 1102 WebInspector.ProfilesPanel.ContextMenuProvider.prototype = { |
1090 /** | 1103 /** |
1091 * @override | 1104 * @override |
1092 * @param {!Event} event | 1105 * @param {!Event} event |
1093 * @param {!WebInspector.ContextMenu} contextMenu | 1106 * @param {!WebInspector.ContextMenu} contextMenu |
1094 * @param {!Object} target | 1107 * @param {!Object} target |
1095 */ | 1108 */ |
1096 appendApplicableItems: function(event, contextMenu, target) | 1109 appendApplicableItems: function(event, contextMenu, target) |
1097 { | 1110 { |
1098 WebInspector.ProfilesPanel._instance().appendApplicableItems(event, cont
extMenu, target); | 1111 WebInspector.ProfilesPanel._instance().appendApplicableItems(event, cont
extMenu, target); |
1099 } | 1112 } |
1100 } | 1113 } |
1101 | 1114 |
1102 /** | 1115 /** |
1103 * @constructor | 1116 * @constructor |
1104 * @extends {WebInspector.SidebarTreeElement} | 1117 * @extends {TreeElement} |
1105 * @param {!WebInspector.ProfileType.DataDisplayDelegate} dataDisplayDelegate | 1118 * @param {!WebInspector.ProfileType.DataDisplayDelegate} dataDisplayDelegate |
1106 * @param {!WebInspector.ProfileHeader} profile | 1119 * @param {!WebInspector.ProfileHeader} profile |
1107 * @param {string} className | 1120 * @param {string} className |
1108 */ | 1121 */ |
1109 WebInspector.ProfileSidebarTreeElement = function(dataDisplayDelegate, profile,
className) | 1122 WebInspector.ProfileSidebarTreeElement = function(dataDisplayDelegate, profile,
className) |
1110 { | 1123 { |
| 1124 TreeElement.call(this, "", false); |
| 1125 this._iconElement = createElementWithClass("div", "icon"); |
| 1126 this._titlesElement = createElementWithClass("div", "titles no-subtitle"); |
| 1127 this._titleContainer = this._titlesElement.createChild("span", "title-contai
ner"); |
| 1128 this._titleElement = this._titleContainer.createChild("span", "title"); |
| 1129 this._subtitleElement = this._titlesElement.createChild("span", "subtitle"); |
| 1130 |
| 1131 this._titleElement.textContent = profile.title; |
| 1132 this._className = className; |
| 1133 this._small = false; |
1111 this._dataDisplayDelegate = dataDisplayDelegate; | 1134 this._dataDisplayDelegate = dataDisplayDelegate; |
1112 this.profile = profile; | 1135 this.profile = profile; |
1113 WebInspector.SidebarTreeElement.call(this, className, profile.title); | |
1114 this.refreshTitles(); | |
1115 profile.addEventListener(WebInspector.ProfileHeader.Events.UpdateStatus, thi
s._updateStatus, this); | 1136 profile.addEventListener(WebInspector.ProfileHeader.Events.UpdateStatus, thi
s._updateStatus, this); |
1116 if (profile.canSaveToFile()) | 1137 if (profile.canSaveToFile()) |
1117 this._createSaveLink(); | 1138 this._createSaveLink(); |
1118 else | 1139 else |
1119 profile.addEventListener(WebInspector.ProfileHeader.Events.ProfileReceiv
ed, this._onProfileReceived, this); | 1140 profile.addEventListener(WebInspector.ProfileHeader.Events.ProfileReceiv
ed, this._onProfileReceived, this); |
1120 } | 1141 } |
1121 | 1142 |
1122 WebInspector.ProfileSidebarTreeElement.prototype = { | 1143 WebInspector.ProfileSidebarTreeElement.prototype = { |
1123 _createSaveLink: function() | 1144 _createSaveLink: function() |
1124 { | 1145 { |
1125 this._saveLinkElement = this.titleContainer.createChild("span", "save-li
nk"); | 1146 this._saveLinkElement = this._titleContainer.createChild("span", "save-l
ink"); |
1126 this._saveLinkElement.textContent = WebInspector.UIString("Save"); | 1147 this._saveLinkElement.textContent = WebInspector.UIString("Save"); |
1127 this._saveLinkElement.addEventListener("click", this._saveProfile.bind(t
his), false); | 1148 this._saveLinkElement.addEventListener("click", this._saveProfile.bind(t
his), false); |
1128 }, | 1149 }, |
1129 | 1150 |
1130 _onProfileReceived: function(event) | 1151 _onProfileReceived: function(event) |
1131 { | 1152 { |
1132 this._createSaveLink(); | 1153 this._createSaveLink(); |
1133 }, | 1154 }, |
1134 | 1155 |
1135 /** | 1156 /** |
1136 * @param {!WebInspector.Event} event | 1157 * @param {!WebInspector.Event} event |
1137 */ | 1158 */ |
1138 _updateStatus: function(event) | 1159 _updateStatus: function(event) |
1139 { | 1160 { |
1140 var statusUpdate = event.data; | 1161 var statusUpdate = event.data; |
1141 if (statusUpdate.subtitle !== null) | 1162 if (statusUpdate.subtitle !== null) { |
1142 this.subtitle = statusUpdate.subtitle; | 1163 this._subtitleElement.textContent = statusUpdate.subtitle || ""; |
1143 if (typeof statusUpdate.wait === "boolean") | 1164 this._titlesElement.classList.toggle("no-subtitle", !statusUpdate.su
btitle); |
1144 this.wait = statusUpdate.wait; | 1165 } |
1145 this.refreshTitles(); | 1166 if (typeof statusUpdate.wait === "boolean" && this.listItemElement) |
| 1167 this.listItemElement.classList.toggle("wait", statusUpdate.wait); |
1146 }, | 1168 }, |
1147 | 1169 |
1148 dispose: function() | 1170 dispose: function() |
1149 { | 1171 { |
1150 this.profile.removeEventListener(WebInspector.ProfileHeader.Events.Updat
eStatus, this._updateStatus, this); | 1172 this.profile.removeEventListener(WebInspector.ProfileHeader.Events.Updat
eStatus, this._updateStatus, this); |
1151 this.profile.removeEventListener(WebInspector.ProfileHeader.Events.Profi
leReceived, this._onProfileReceived, this); | 1173 this.profile.removeEventListener(WebInspector.ProfileHeader.Events.Profi
leReceived, this._onProfileReceived, this); |
1152 }, | 1174 }, |
1153 | 1175 |
1154 /** | 1176 /** |
1155 * @override | 1177 * @override |
1156 * @return {boolean} | 1178 * @return {boolean} |
1157 */ | 1179 */ |
1158 onselect: function() | 1180 onselect: function() |
1159 { | 1181 { |
1160 this._dataDisplayDelegate.showProfile(this.profile); | 1182 this._dataDisplayDelegate.showProfile(this.profile); |
1161 return true; | 1183 return true; |
1162 }, | 1184 }, |
1163 | 1185 |
1164 /** | 1186 /** |
1165 * @override | 1187 * @override |
1166 * @return {boolean} | 1188 * @return {boolean} |
1167 */ | 1189 */ |
1168 ondelete: function() | 1190 ondelete: function() |
1169 { | 1191 { |
1170 this.profile.profileType().removeProfile(this.profile); | 1192 this.profile.profileType().removeProfile(this.profile); |
1171 return true; | 1193 return true; |
1172 }, | 1194 }, |
1173 | 1195 |
1174 /** | 1196 /** |
| 1197 * @override |
| 1198 */ |
| 1199 onattach: function() |
| 1200 { |
| 1201 this.listItemElement.classList.add("sidebar-tree-item"); |
| 1202 if (this._className) |
| 1203 this.listItemElement.classList.add(this._className); |
| 1204 if (this._small) |
| 1205 this.listItemElement.classList.add("small"); |
| 1206 this.listItemElement.appendChildren(this._iconElement, this._titlesEleme
nt); |
| 1207 }, |
| 1208 |
| 1209 /** |
1175 * @param {!Event} event | 1210 * @param {!Event} event |
1176 * @param {!WebInspector.ProfilesPanel} panel | 1211 * @param {!WebInspector.ProfilesPanel} panel |
1177 */ | 1212 */ |
1178 handleContextMenuEvent: function(event, panel) | 1213 handleContextMenuEvent: function(event, panel) |
1179 { | 1214 { |
1180 var profile = this.profile; | 1215 var profile = this.profile; |
1181 var contextMenu = new WebInspector.ContextMenu(event); | 1216 var contextMenu = new WebInspector.ContextMenu(event); |
1182 // FIXME: use context menu provider | 1217 // FIXME: use context menu provider |
1183 contextMenu.appendItem(WebInspector.UIString("Load\u2026"), panel._fileS
electorElement.click.bind(panel._fileSelectorElement)); | 1218 contextMenu.appendItem(WebInspector.UIString("Load\u2026"), panel._fileS
electorElement.click.bind(panel._fileSelectorElement)); |
1184 if (profile.canSaveToFile()) | 1219 if (profile.canSaveToFile()) |
1185 contextMenu.appendItem(WebInspector.UIString("Save\u2026"), profile.
saveToFile.bind(profile)); | 1220 contextMenu.appendItem(WebInspector.UIString("Save\u2026"), profile.
saveToFile.bind(profile)); |
1186 contextMenu.appendItem(WebInspector.UIString("Delete"), this.ondelete.bi
nd(this)); | 1221 contextMenu.appendItem(WebInspector.UIString("Delete"), this.ondelete.bi
nd(this)); |
1187 contextMenu.show(); | 1222 contextMenu.show(); |
1188 }, | 1223 }, |
1189 | 1224 |
1190 _saveProfile: function(event) | 1225 _saveProfile: function(event) |
1191 { | 1226 { |
1192 this.profile.saveToFile(); | 1227 this.profile.saveToFile(); |
1193 }, | 1228 }, |
1194 | 1229 |
1195 __proto__: WebInspector.SidebarTreeElement.prototype | 1230 /** |
| 1231 * @param {boolean} small |
| 1232 */ |
| 1233 setSmall: function(small) |
| 1234 { |
| 1235 this._small = small; |
| 1236 if (this.listItemElement) |
| 1237 this.listItemElement.classList.toggle("small", this._small); |
| 1238 }, |
| 1239 |
| 1240 /** |
| 1241 * @param {string} title |
| 1242 */ |
| 1243 setMainTitle: function(title) |
| 1244 { |
| 1245 this._titleElement.textContent = title; |
| 1246 }, |
| 1247 |
| 1248 __proto__: TreeElement.prototype |
1196 } | 1249 } |
1197 | 1250 |
1198 /** | 1251 /** |
1199 * @constructor | 1252 * @constructor |
1200 * @extends {WebInspector.SidebarTreeElement} | 1253 * @extends {TreeElement} |
1201 * @param {!WebInspector.ProfileType.DataDisplayDelegate} dataDisplayDelegate | 1254 * @param {!WebInspector.ProfileType.DataDisplayDelegate} dataDisplayDelegate |
1202 * @param {string} title | 1255 * @param {string} title |
1203 * @param {string=} subtitle | |
1204 */ | 1256 */ |
1205 WebInspector.ProfileGroupSidebarTreeElement = function(dataDisplayDelegate, titl
e, subtitle) | 1257 WebInspector.ProfileGroupSidebarTreeElement = function(dataDisplayDelegate, titl
e) |
1206 { | 1258 { |
1207 WebInspector.SidebarTreeElement.call(this, "profile-group-sidebar-tree-item"
, title, subtitle, true); | 1259 TreeElement.call(this, "", true); |
| 1260 this.selectable = false; |
1208 this._dataDisplayDelegate = dataDisplayDelegate; | 1261 this._dataDisplayDelegate = dataDisplayDelegate; |
| 1262 this._title = title; |
1209 } | 1263 } |
1210 | 1264 |
1211 WebInspector.ProfileGroupSidebarTreeElement.prototype = { | 1265 WebInspector.ProfileGroupSidebarTreeElement.prototype = { |
1212 /** | 1266 /** |
1213 * @override | 1267 * @override |
1214 * @return {boolean} | 1268 * @return {boolean} |
1215 */ | 1269 */ |
1216 onselect: function() | 1270 onselect: function() |
1217 { | 1271 { |
1218 var hasChildren = this.childCount() > 0; | 1272 var hasChildren = this.childCount() > 0; |
1219 if (hasChildren) | 1273 if (hasChildren) |
1220 this._dataDisplayDelegate.showProfile(this.lastChild().profile); | 1274 this._dataDisplayDelegate.showProfile(this.lastChild().profile); |
1221 return hasChildren; | 1275 return hasChildren; |
1222 }, | 1276 }, |
1223 | 1277 |
1224 __proto__: WebInspector.SidebarTreeElement.prototype | 1278 /** |
| 1279 * @override |
| 1280 */ |
| 1281 onattach: function() |
| 1282 { |
| 1283 this.listItemElement.classList.add("sidebar-tree-item", "profile-group-s
idebar-tree-item"); |
| 1284 this._disclosureButton = this.listItemElement.createChild("button", "dis
closure-button"); |
| 1285 this.listItemElement.createChild("div", "icon"); |
| 1286 this.listItemElement.createChild("div", "titles no-subtitle").createChil
d("span", "title-container").createChild("span", "title").textContent = this._ti
tle; |
| 1287 }, |
| 1288 |
| 1289 /** |
| 1290 * @override |
| 1291 * @param {!Event} event |
| 1292 * @return {boolean} |
| 1293 */ |
| 1294 isEventWithinDisclosureTriangle: function(event) |
| 1295 { |
| 1296 return event.target === this._disclosureButton; |
| 1297 }, |
| 1298 |
| 1299 __proto__: TreeElement.prototype |
1225 } | 1300 } |
1226 | 1301 |
1227 /** | 1302 /** |
1228 * @constructor | 1303 * @constructor |
1229 * @extends {WebInspector.SidebarTreeElement} | 1304 * @extends {TreeElement} |
1230 * @param {!WebInspector.ProfilesPanel} panel | 1305 * @param {!WebInspector.ProfilesPanel} panel |
1231 */ | 1306 */ |
1232 WebInspector.ProfilesSidebarTreeElement = function(panel) | 1307 WebInspector.ProfilesSidebarTreeElement = function(panel) |
1233 { | 1308 { |
| 1309 TreeElement.call(this, "", false); |
| 1310 this.selectable = true; |
1234 this._panel = panel; | 1311 this._panel = panel; |
1235 this.small = false; | |
1236 | |
1237 WebInspector.SidebarTreeElement.call(this, "profile-launcher-view-tree-item"
, WebInspector.UIString("Profiles")); | |
1238 } | 1312 } |
1239 | 1313 |
1240 WebInspector.ProfilesSidebarTreeElement.prototype = { | 1314 WebInspector.ProfilesSidebarTreeElement.prototype = { |
1241 /** | 1315 /** |
1242 * @override | 1316 * @override |
1243 * @return {boolean} | 1317 * @return {boolean} |
1244 */ | 1318 */ |
1245 onselect: function() | 1319 onselect: function() |
1246 { | 1320 { |
1247 this._panel._showLauncherView(); | 1321 this._panel._showLauncherView(); |
1248 return true; | 1322 return true; |
1249 }, | 1323 }, |
1250 | 1324 |
1251 get selectable() | 1325 /** |
| 1326 * @override |
| 1327 */ |
| 1328 onattach: function() |
1252 { | 1329 { |
1253 return true; | 1330 this.listItemElement.classList.add("sidebar-tree-item", "profile-launche
r-view-tree-item"); |
| 1331 this.listItemElement.createChild("div", "icon"); |
| 1332 this.listItemElement.createChild("div", "titles no-subtitle").createChil
d("span", "title-container").createChild("span", "title").textContent = WebInspe
ctor.UIString("Profiles"); |
1254 }, | 1333 }, |
1255 | 1334 |
1256 __proto__: WebInspector.SidebarTreeElement.prototype | 1335 __proto__: TreeElement.prototype |
1257 } | 1336 } |
1258 | 1337 |
1259 WebInspector.ProfilesPanel.show = function() | 1338 WebInspector.ProfilesPanel.show = function() |
1260 { | 1339 { |
1261 WebInspector.inspectorView.setCurrentPanel(WebInspector.ProfilesPanel._insta
nce()); | 1340 WebInspector.inspectorView.setCurrentPanel(WebInspector.ProfilesPanel._insta
nce()); |
1262 } | 1341 } |
1263 | 1342 |
1264 /** | 1343 /** |
1265 * @return {!WebInspector.ProfilesPanel} | 1344 * @return {!WebInspector.ProfilesPanel} |
1266 */ | 1345 */ |
(...skipping 18 matching lines...) Expand all Loading... |
1285 * @return {boolean} | 1364 * @return {boolean} |
1286 */ | 1365 */ |
1287 handleAction: function(context, actionId) | 1366 handleAction: function(context, actionId) |
1288 { | 1367 { |
1289 var panel = WebInspector.context.flavor(WebInspector.ProfilesPanel); | 1368 var panel = WebInspector.context.flavor(WebInspector.ProfilesPanel); |
1290 console.assert(panel && panel instanceof WebInspector.ProfilesPanel); | 1369 console.assert(panel && panel instanceof WebInspector.ProfilesPanel); |
1291 panel.toggleRecord(); | 1370 panel.toggleRecord(); |
1292 return true; | 1371 return true; |
1293 } | 1372 } |
1294 } | 1373 } |
OLD | NEW |