| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 16 matching lines...) Expand all Loading... |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 /** | 29 /** |
| 30 * @constructor | 30 * @constructor |
| 31 * @extends {WebInspector.NavigatorView} | 31 * @extends {WebInspector.NavigatorView} |
| 32 */ | 32 */ |
| 33 WebInspector.SourcesNavigatorView = function() | 33 WebInspector.SourcesNavigatorView = function() |
| 34 { | 34 { |
| 35 WebInspector.NavigatorView.call(this); | 35 WebInspector.NavigatorView.call(this); |
| 36 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event
s.InspectedURLChanged, this._inspectedURLChanged, this); | 36 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event
s.InspectedURLChanged, this._inspectedURLChanged, this); |
| 37 } | 37 }; |
| 38 | 38 |
| 39 WebInspector.SourcesNavigatorView.prototype = { | 39 WebInspector.SourcesNavigatorView.prototype = { |
| 40 /** | 40 /** |
| 41 * @override | 41 * @override |
| 42 * @param {!WebInspector.UISourceCode} uiSourceCode | 42 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 43 * @return {boolean} | 43 * @return {boolean} |
| 44 */ | 44 */ |
| 45 accept: function(uiSourceCode) | 45 accept: function(uiSourceCode) |
| 46 { | 46 { |
| 47 if (!WebInspector.NavigatorView.prototype.accept(uiSourceCode)) | 47 if (!WebInspector.NavigatorView.prototype.accept(uiSourceCode)) |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 * @param {!Event} event | 86 * @param {!Event} event |
| 87 */ | 87 */ |
| 88 handleContextMenu: function(event) | 88 handleContextMenu: function(event) |
| 89 { | 89 { |
| 90 var contextMenu = new WebInspector.ContextMenu(event); | 90 var contextMenu = new WebInspector.ContextMenu(event); |
| 91 WebInspector.NavigatorView.appendAddFolderItem(contextMenu); | 91 WebInspector.NavigatorView.appendAddFolderItem(contextMenu); |
| 92 contextMenu.show(); | 92 contextMenu.show(); |
| 93 }, | 93 }, |
| 94 | 94 |
| 95 __proto__: WebInspector.NavigatorView.prototype | 95 __proto__: WebInspector.NavigatorView.prototype |
| 96 } | 96 }; |
| 97 | 97 |
| 98 /** | 98 /** |
| 99 * @constructor | 99 * @constructor |
| 100 * @extends {WebInspector.NavigatorView} | 100 * @extends {WebInspector.NavigatorView} |
| 101 */ | 101 */ |
| 102 WebInspector.NetworkNavigatorView = function() | 102 WebInspector.NetworkNavigatorView = function() |
| 103 { | 103 { |
| 104 WebInspector.NavigatorView.call(this); | 104 WebInspector.NavigatorView.call(this); |
| 105 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event
s.InspectedURLChanged, this._inspectedURLChanged, this); | 105 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event
s.InspectedURLChanged, this._inspectedURLChanged, this); |
| 106 } | 106 }; |
| 107 | 107 |
| 108 WebInspector.NetworkNavigatorView.prototype = { | 108 WebInspector.NetworkNavigatorView.prototype = { |
| 109 /** | 109 /** |
| 110 * @override | 110 * @override |
| 111 * @param {!WebInspector.UISourceCode} uiSourceCode | 111 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 112 * @return {boolean} | 112 * @return {boolean} |
| 113 */ | 113 */ |
| 114 accept: function(uiSourceCode) | 114 accept: function(uiSourceCode) |
| 115 { | 115 { |
| 116 return uiSourceCode.project().type() === WebInspector.projectTypes.Netwo
rk; | 116 return uiSourceCode.project().type() === WebInspector.projectTypes.Netwo
rk; |
| 117 }, | 117 }, |
| 118 | 118 |
| 119 /** | 119 /** |
| 120 * @param {!WebInspector.Event} event | 120 * @param {!WebInspector.Event} event |
| 121 */ | 121 */ |
| 122 _inspectedURLChanged: function(event) | 122 _inspectedURLChanged: function(event) |
| 123 { | 123 { |
| 124 var mainTarget = WebInspector.targetManager.mainTarget(); | 124 var mainTarget = WebInspector.targetManager.mainTarget(); |
| 125 if (event.data !== mainTarget) | 125 if (event.data !== mainTarget) |
| 126 return; | 126 return; |
| 127 var inspectedURL = mainTarget && mainTarget.inspectedURL(); | 127 var inspectedURL = mainTarget && mainTarget.inspectedURL(); |
| 128 if (!inspectedURL) | 128 if (!inspectedURL) |
| 129 return | 129 return; |
| 130 for (var node of this._uiSourceCodeNodes.valuesArray()) { | 130 for (var node of this._uiSourceCodeNodes.valuesArray()) { |
| 131 var uiSourceCode = node.uiSourceCode(); | 131 var uiSourceCode = node.uiSourceCode(); |
| 132 if (uiSourceCode.url() === inspectedURL) | 132 if (uiSourceCode.url() === inspectedURL) |
| 133 this.revealUISourceCode(uiSourceCode, true); | 133 this.revealUISourceCode(uiSourceCode, true); |
| 134 } | 134 } |
| 135 }, | 135 }, |
| 136 | 136 |
| 137 /** | 137 /** |
| 138 * @override | 138 * @override |
| 139 * @param {!WebInspector.UISourceCode} uiSourceCode | 139 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 140 */ | 140 */ |
| 141 uiSourceCodeAdded: function(uiSourceCode) | 141 uiSourceCodeAdded: function(uiSourceCode) |
| 142 { | 142 { |
| 143 var mainTarget = WebInspector.targetManager.mainTarget(); | 143 var mainTarget = WebInspector.targetManager.mainTarget(); |
| 144 var inspectedURL = mainTarget && mainTarget.inspectedURL(); | 144 var inspectedURL = mainTarget && mainTarget.inspectedURL(); |
| 145 if (!inspectedURL) | 145 if (!inspectedURL) |
| 146 return; | 146 return; |
| 147 if (uiSourceCode.url() === inspectedURL) | 147 if (uiSourceCode.url() === inspectedURL) |
| 148 this.revealUISourceCode(uiSourceCode, true); | 148 this.revealUISourceCode(uiSourceCode, true); |
| 149 }, | 149 }, |
| 150 | 150 |
| 151 __proto__: WebInspector.NavigatorView.prototype | 151 __proto__: WebInspector.NavigatorView.prototype |
| 152 } | 152 }; |
| 153 | 153 |
| 154 /** | 154 /** |
| 155 * @constructor | 155 * @constructor |
| 156 * @extends {WebInspector.NavigatorView} | 156 * @extends {WebInspector.NavigatorView} |
| 157 */ | 157 */ |
| 158 WebInspector.FilesNavigatorView = function() | 158 WebInspector.FilesNavigatorView = function() |
| 159 { | 159 { |
| 160 WebInspector.NavigatorView.call(this); | 160 WebInspector.NavigatorView.call(this); |
| 161 } | 161 }; |
| 162 | 162 |
| 163 WebInspector.FilesNavigatorView.prototype = { | 163 WebInspector.FilesNavigatorView.prototype = { |
| 164 /** | 164 /** |
| 165 * @override | 165 * @override |
| 166 * @param {!WebInspector.UISourceCode} uiSourceCode | 166 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 167 * @return {boolean} | 167 * @return {boolean} |
| 168 */ | 168 */ |
| 169 accept: function(uiSourceCode) | 169 accept: function(uiSourceCode) |
| 170 { | 170 { |
| 171 return uiSourceCode.project().type() === WebInspector.projectTypes.FileS
ystem; | 171 return uiSourceCode.project().type() === WebInspector.projectTypes.FileS
ystem; |
| 172 }, | 172 }, |
| 173 | 173 |
| 174 /** | 174 /** |
| 175 * @override | 175 * @override |
| 176 * @param {!Event} event | 176 * @param {!Event} event |
| 177 */ | 177 */ |
| 178 handleContextMenu: function(event) | 178 handleContextMenu: function(event) |
| 179 { | 179 { |
| 180 var contextMenu = new WebInspector.ContextMenu(event); | 180 var contextMenu = new WebInspector.ContextMenu(event); |
| 181 WebInspector.NavigatorView.appendAddFolderItem(contextMenu); | 181 WebInspector.NavigatorView.appendAddFolderItem(contextMenu); |
| 182 contextMenu.show(); | 182 contextMenu.show(); |
| 183 }, | 183 }, |
| 184 | 184 |
| 185 __proto__: WebInspector.NavigatorView.prototype | 185 __proto__: WebInspector.NavigatorView.prototype |
| 186 } | 186 }; |
| 187 | 187 |
| 188 /** | 188 /** |
| 189 * @constructor | 189 * @constructor |
| 190 * @extends {WebInspector.NavigatorView} | 190 * @extends {WebInspector.NavigatorView} |
| 191 */ | 191 */ |
| 192 WebInspector.ContentScriptsNavigatorView = function() | 192 WebInspector.ContentScriptsNavigatorView = function() |
| 193 { | 193 { |
| 194 WebInspector.NavigatorView.call(this); | 194 WebInspector.NavigatorView.call(this); |
| 195 } | 195 }; |
| 196 | 196 |
| 197 WebInspector.ContentScriptsNavigatorView.prototype = { | 197 WebInspector.ContentScriptsNavigatorView.prototype = { |
| 198 /** | 198 /** |
| 199 * @override | 199 * @override |
| 200 * @param {!WebInspector.UISourceCode} uiSourceCode | 200 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 201 * @return {boolean} | 201 * @return {boolean} |
| 202 */ | 202 */ |
| 203 accept: function(uiSourceCode) | 203 accept: function(uiSourceCode) |
| 204 { | 204 { |
| 205 return uiSourceCode.project().type() === WebInspector.projectTypes.Conte
ntScripts; | 205 return uiSourceCode.project().type() === WebInspector.projectTypes.Conte
ntScripts; |
| 206 }, | 206 }, |
| 207 | 207 |
| 208 __proto__: WebInspector.NavigatorView.prototype | 208 __proto__: WebInspector.NavigatorView.prototype |
| 209 } | 209 }; |
| 210 | 210 |
| 211 /** | 211 /** |
| 212 * @constructor | 212 * @constructor |
| 213 * @extends {WebInspector.NavigatorView} | 213 * @extends {WebInspector.NavigatorView} |
| 214 */ | 214 */ |
| 215 WebInspector.SnippetsNavigatorView = function() | 215 WebInspector.SnippetsNavigatorView = function() |
| 216 { | 216 { |
| 217 WebInspector.NavigatorView.call(this); | 217 WebInspector.NavigatorView.call(this); |
| 218 var toolbar = new WebInspector.Toolbar("snippets-navigator-toolbar"); | 218 var toolbar = new WebInspector.Toolbar("snippets-navigator-toolbar"); |
| 219 var newButton = new WebInspector.ToolbarButton(WebInspector.UIString("New"),
"add-toolbar-item"); | 219 var newButton = new WebInspector.ToolbarButton(WebInspector.UIString("New"),
"add-toolbar-item"); |
| 220 newButton.addEventListener("click", this._handleCreateSnippet.bind(this)); | 220 newButton.addEventListener("click", this._handleCreateSnippet.bind(this)); |
| 221 toolbar.appendToolbarItem(newButton); | 221 toolbar.appendToolbarItem(newButton); |
| 222 this.element.insertBefore(toolbar.element, this.element.firstChild); | 222 this.element.insertBefore(toolbar.element, this.element.firstChild); |
| 223 } | 223 }; |
| 224 | 224 |
| 225 WebInspector.SnippetsNavigatorView.prototype = { | 225 WebInspector.SnippetsNavigatorView.prototype = { |
| 226 /** | 226 /** |
| 227 * @override | 227 * @override |
| 228 * @param {!WebInspector.UISourceCode} uiSourceCode | 228 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 229 * @return {boolean} | 229 * @return {boolean} |
| 230 */ | 230 */ |
| 231 accept: function(uiSourceCode) | 231 accept: function(uiSourceCode) |
| 232 { | 232 { |
| 233 return uiSourceCode.project().type() === WebInspector.projectTypes.Snipp
ets; | 233 return uiSourceCode.project().type() === WebInspector.projectTypes.Snipp
ets; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 | 300 |
| 301 /** | 301 /** |
| 302 * @override | 302 * @override |
| 303 */ | 303 */ |
| 304 sourceDeleted: function(uiSourceCode) | 304 sourceDeleted: function(uiSourceCode) |
| 305 { | 305 { |
| 306 this._handleRemoveSnippet(uiSourceCode); | 306 this._handleRemoveSnippet(uiSourceCode); |
| 307 }, | 307 }, |
| 308 | 308 |
| 309 __proto__: WebInspector.NavigatorView.prototype | 309 __proto__: WebInspector.NavigatorView.prototype |
| 310 } | 310 }; |
| OLD | NEW |