| OLD | NEW |
| 1 (function() { | 1 (function() { |
| 2 /* | 2 /* |
| 3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 CancelSearch: "cancelSearch", | 54 CancelSearch: "cancelSearch", |
| 55 PerformSearch: "performSearch", | 55 PerformSearch: "performSearch", |
| 56 NextSearchResult: "nextSearchResult", | 56 NextSearchResult: "nextSearchResult", |
| 57 PreviousSearchResult: "previousSearchResult" | 57 PreviousSearchResult: "previousSearchResult" |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 apiPrivate.Events = { | 60 apiPrivate.Events = { |
| 61 AuditStarted: "audit-started-", | 61 AuditStarted: "audit-started-", |
| 62 ButtonClicked: "button-clicked-", | 62 ButtonClicked: "button-clicked-", |
| 63 ConsoleMessageAdded: "console-message-added", | 63 ConsoleMessageAdded: "console-message-added", |
| 64 ElementsPanelObjectSelected: "panel-objectSelected-elements", | 64 PanelObjectSelected: "panel-objectSelected-", |
| 65 NetworkRequestFinished: "network-request-finished", | 65 NetworkRequestFinished: "network-request-finished", |
| 66 OpenResource: "open-resource", | 66 OpenResource: "open-resource", |
| 67 PanelSearch: "panel-search-", | 67 PanelSearch: "panel-search-", |
| 68 ResourceAdded: "resource-added", | 68 ResourceAdded: "resource-added", |
| 69 ResourceContentCommitted: "resource-content-committed", | 69 ResourceContentCommitted: "resource-content-committed", |
| 70 TimelineEventRecorded: "timeline-event-recorded", | 70 TimelineEventRecorded: "timeline-event-recorded", |
| 71 ViewShown: "view-shown-", | 71 ViewShown: "view-shown-", |
| 72 ViewHidden: "view-hidden-" | 72 ViewHidden: "view-hidden-" |
| 73 }; | 73 }; |
| 74 | 74 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 extensionServer.sendRequest({ command: commands.GetRequestContent, id: t
his._id }, callback && callbackWrapper); | 267 extensionServer.sendRequest({ command: commands.GetRequestContent, id: t
his._id }, callback && callbackWrapper); |
| 268 } | 268 } |
| 269 } | 269 } |
| 270 | 270 |
| 271 /** | 271 /** |
| 272 * @constructor | 272 * @constructor |
| 273 */ | 273 */ |
| 274 function Panels() | 274 function Panels() |
| 275 { | 275 { |
| 276 var panels = { | 276 var panels = { |
| 277 elements: new ElementsPanel() | 277 elements: new ElementsPanel(), |
| 278 sources: new SourcesPanel(), |
| 278 }; | 279 }; |
| 279 | 280 |
| 280 function panelGetter(name) | 281 function panelGetter(name) |
| 281 { | 282 { |
| 282 return panels[name]; | 283 return panels[name]; |
| 283 } | 284 } |
| 284 for (var panel in panels) | 285 for (var panel in panels) |
| 285 this.__defineGetter__(panel, panelGetter.bind(null, panel)); | 286 this.__defineGetter__(panel, panelGetter.bind(null, panel)); |
| 286 } | 287 } |
| 287 | 288 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 /** | 338 /** |
| 338 * @constructor | 339 * @constructor |
| 339 */ | 340 */ |
| 340 function ExtensionViewImpl(id) | 341 function ExtensionViewImpl(id) |
| 341 { | 342 { |
| 342 this._id = id; | 343 this._id = id; |
| 343 | 344 |
| 344 function dispatchShowEvent(message) | 345 function dispatchShowEvent(message) |
| 345 { | 346 { |
| 346 var frameIndex = message.arguments[0]; | 347 var frameIndex = message.arguments[0]; |
| 347 this._fire(window.parent.frames[frameIndex]); | 348 if (typeof frameIndex === "number") |
| 349 this._fire(window.parent.frames[frameIndex]); |
| 350 else |
| 351 this._fire(); |
| 348 } | 352 } |
| 349 this.onShown = new EventSink(events.ViewShown + id, dispatchShowEvent); | 353 this.onShown = new EventSink(events.ViewShown + id, dispatchShowEvent); |
| 350 this.onHidden = new EventSink(events.ViewHidden + id); | 354 this.onHidden = new EventSink(events.ViewHidden + id); |
| 351 } | 355 } |
| 352 | 356 |
| 353 /** | 357 /** |
| 354 * @constructor | 358 * @constructor |
| 355 */ | 359 */ |
| 356 function PanelWithSidebarImpl(id) | 360 function PanelWithSidebarImpl(hostPanelName) |
| 357 { | 361 { |
| 358 this._id = id; | 362 this._hostPanelName = hostPanelName; |
| 363 this.onSelectionChanged = new EventSink(events.PanelObjectSelected + hostPan
elName); |
| 359 } | 364 } |
| 360 | 365 |
| 361 PanelWithSidebarImpl.prototype = { | 366 PanelWithSidebarImpl.prototype = { |
| 362 createSidebarPane: function(title, callback) | 367 createSidebarPane: function(title, callback) |
| 363 { | 368 { |
| 364 var id = "extension-sidebar-" + extensionServer.nextObjectId(); | 369 var id = "extension-sidebar-" + extensionServer.nextObjectId(); |
| 365 var request = { | 370 var request = { |
| 366 command: commands.CreateSidebarPane, | 371 command: commands.CreateSidebarPane, |
| 367 panel: this._id, | 372 panel: this._hostPanelName, |
| 368 id: id, | 373 id: id, |
| 369 title: title | 374 title: title |
| 370 }; | 375 }; |
| 371 function callbackWrapper() | 376 function callbackWrapper() |
| 372 { | 377 { |
| 373 callback(new ExtensionSidebarPane(id)); | 378 callback(new ExtensionSidebarPane(id)); |
| 374 } | 379 } |
| 375 extensionServer.sendRequest(request, callback && callbackWrapper); | 380 extensionServer.sendRequest(request, callback && callbackWrapper); |
| 376 }, | 381 }, |
| 377 | 382 |
| 378 __proto__: ExtensionViewImpl.prototype | 383 __proto__: ExtensionViewImpl.prototype |
| 379 } | 384 } |
| 380 | 385 |
| 381 /** | 386 /** |
| 382 * @constructor | 387 * @constructor |
| 383 * @extends {PanelWithSidebar} | 388 * @extends {PanelWithSidebar} |
| 384 */ | 389 */ |
| 385 function ElementsPanel() | 390 function ElementsPanel() |
| 386 { | 391 { |
| 387 var id = "elements"; | 392 PanelWithSidebar.call(this, "elements"); |
| 388 PanelWithSidebar.call(this, id); | 393 } |
| 389 this.onSelectionChanged = new EventSink(events.ElementsPanelObjectSelected); | 394 |
| 395 /** |
| 396 * @constructor |
| 397 * @extends {PanelWithSidebar} |
| 398 */ |
| 399 function SourcesPanel() |
| 400 { |
| 401 PanelWithSidebar.call(this, "sources"); |
| 390 } | 402 } |
| 391 | 403 |
| 392 /** | 404 /** |
| 393 * @constructor | 405 * @constructor |
| 394 * @extends {ExtensionViewImpl} | 406 * @extends {ExtensionViewImpl} |
| 395 */ | 407 */ |
| 396 function ExtensionPanelImpl(id) | 408 function ExtensionPanelImpl(id) |
| 397 { | 409 { |
| 398 ExtensionViewImpl.call(this, id); | 410 ExtensionViewImpl.call(this, id); |
| 399 this.onSearch = new EventSink(events.PanelSearch + id); | 411 this.onSearch = new EventSink(events.PanelSearch + id); |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 } | 982 } |
| 971 if (extensionInfo.exposeWebInspectorNamespace) | 983 if (extensionInfo.exposeWebInspectorNamespace) |
| 972 window.webInspector = coreAPI; | 984 window.webInspector = coreAPI; |
| 973 } | 985 } |
| 974 | 986 |
| 975 var tabId; | 987 var tabId; |
| 976 var extensionInfo = {}; | 988 var extensionInfo = {}; |
| 977 var extensionServer; | 989 var extensionServer; |
| 978 platformExtensionAPI(injectedExtensionAPI("remote-" + window.parent.fram
es.length)); | 990 platformExtensionAPI(injectedExtensionAPI("remote-" + window.parent.fram
es.length)); |
| 979 })(); | 991 })(); |
| OLD | NEW |