| OLD | NEW |
| 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 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 /** @enum {string} */ | 52 /** @enum {string} */ |
| 53 apiPrivate.Events = { | 53 apiPrivate.Events = { |
| 54 AuditStarted: "audit-started-", | 54 AuditStarted: "audit-started-", |
| 55 ButtonClicked: "button-clicked-", | 55 ButtonClicked: "button-clicked-", |
| 56 PanelObjectSelected: "panel-objectSelected-", | 56 PanelObjectSelected: "panel-objectSelected-", |
| 57 NetworkRequestFinished: "network-request-finished", | 57 NetworkRequestFinished: "network-request-finished", |
| 58 OpenResource: "open-resource", | 58 OpenResource: "open-resource", |
| 59 PanelSearch: "panel-search-", | 59 PanelSearch: "panel-search-", |
| 60 RecordingStarted: "trace-recording-started-", |
| 61 RecordingStopped: "trace-recording-stopped-", |
| 60 ResourceAdded: "resource-added", | 62 ResourceAdded: "resource-added", |
| 61 ResourceContentCommitted: "resource-content-committed", | 63 ResourceContentCommitted: "resource-content-committed", |
| 62 ViewShown: "view-shown-", | 64 ViewShown: "view-shown-", |
| 63 ViewHidden: "view-hidden-" | 65 ViewHidden: "view-hidden-" |
| 64 }; | 66 }; |
| 65 | 67 |
| 66 /** @enum {string} */ | 68 /** @enum {string} */ |
| 67 apiPrivate.Commands = { | 69 apiPrivate.Commands = { |
| 68 AddAuditCategory: "addAuditCategory", | 70 AddAuditCategory: "addAuditCategory", |
| 69 AddAuditResult: "addAuditResult", | 71 AddAuditResult: "addAuditResult", |
| 70 AddRequestHeaders: "addRequestHeaders", | 72 AddRequestHeaders: "addRequestHeaders", |
| 73 AddTraceProvider: "addTraceProvider", |
| 71 ApplyStyleSheet: "applyStyleSheet", | 74 ApplyStyleSheet: "applyStyleSheet", |
| 72 CreatePanel: "createPanel", | 75 CreatePanel: "createPanel", |
| 73 CreateSidebarPane: "createSidebarPane", | 76 CreateSidebarPane: "createSidebarPane", |
| 74 CreateToolbarButton: "createToolbarButton", | 77 CreateToolbarButton: "createToolbarButton", |
| 75 EvaluateOnInspectedPage: "evaluateOnInspectedPage", | 78 EvaluateOnInspectedPage: "evaluateOnInspectedPage", |
| 76 ForwardKeyboardEvent: "_forwardKeyboardEvent", | 79 ForwardKeyboardEvent: "_forwardKeyboardEvent", |
| 77 GetHAR: "getHAR", | 80 GetHAR: "getHAR", |
| 78 GetPageResources: "getPageResources", | 81 GetPageResources: "getPageResources", |
| 79 GetRequestContent: "getRequestContent", | 82 GetRequestContent: "getRequestContent", |
| 80 GetResourceContent: "getResourceContent", | 83 GetResourceContent: "getResourceContent", |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 179 |
| 177 /** | 180 /** |
| 178 * @constructor | 181 * @constructor |
| 179 */ | 182 */ |
| 180 function InspectorExtensionAPI() | 183 function InspectorExtensionAPI() |
| 181 { | 184 { |
| 182 this.audits = new Audits(); | 185 this.audits = new Audits(); |
| 183 this.inspectedWindow = new InspectedWindow(); | 186 this.inspectedWindow = new InspectedWindow(); |
| 184 this.panels = new Panels(); | 187 this.panels = new Panels(); |
| 185 this.network = new Network(); | 188 this.network = new Network(); |
| 189 this.timeline = new Timeline(); |
| 186 defineDeprecatedProperty(this, "webInspector", "resources", "network"); | 190 defineDeprecatedProperty(this, "webInspector", "resources", "network"); |
| 187 } | 191 } |
| 188 | 192 |
| 189 /** | 193 /** |
| 190 * @constructor | 194 * @constructor |
| 191 */ | 195 */ |
| 192 function Network() | 196 function Network() |
| 193 { | 197 { |
| 194 /** | 198 /** |
| 195 * @this {EventSinkImpl} | 199 * @this {EventSinkImpl} |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 tooltip: tooltipText, | 546 tooltip: tooltipText, |
| 543 disabled: !!disabled | 547 disabled: !!disabled |
| 544 }; | 548 }; |
| 545 extensionServer.sendRequest(request); | 549 extensionServer.sendRequest(request); |
| 546 } | 550 } |
| 547 }; | 551 }; |
| 548 | 552 |
| 549 /** | 553 /** |
| 550 * @constructor | 554 * @constructor |
| 551 */ | 555 */ |
| 556 function Timeline() |
| 557 { |
| 558 } |
| 559 |
| 560 Timeline.prototype = { |
| 561 /** |
| 562 * @param {string} categoryName |
| 563 * @param {string} categoryTooltip |
| 564 * @return {!TraceProvider} |
| 565 */ |
| 566 addTraceProvider: function(categoryName, categoryTooltip) |
| 567 { |
| 568 var id = "extension-trace-provider-" + extensionServer.nextObjectId(); |
| 569 extensionServer.sendRequest({ command: commands.AddTraceProvider, id: id
, categoryName: categoryName, categoryTooltip: categoryTooltip}); |
| 570 return new TraceProvider(id); |
| 571 } |
| 572 } |
| 573 |
| 574 /** |
| 575 * @constructor |
| 576 * @param {string} id |
| 577 */ |
| 578 function TraceProvider(id) |
| 579 { |
| 580 this.onRecordingStarted = new EventSink(events.RecordingStarted + id); |
| 581 this.onRecordingStopped = new EventSink(events.RecordingStopped + id); |
| 582 } |
| 583 |
| 584 /** |
| 585 * @constructor |
| 586 */ |
| 552 function Audits() | 587 function Audits() |
| 553 { | 588 { |
| 554 } | 589 } |
| 555 | 590 |
| 556 Audits.prototype = { | 591 Audits.prototype = { |
| 557 /** | 592 /** |
| 558 * @return {!AuditCategory} | 593 * @return {!AuditCategory} |
| 559 */ | 594 */ |
| 560 addCategory: function(displayName, resultCount) | 595 addCategory: function(displayName, resultCount) |
| 561 { | 596 { |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 function buildExtensionAPIInjectedScript(extensionInfo, inspectedTabId, themeNam
e, testHook) | 1033 function buildExtensionAPIInjectedScript(extensionInfo, inspectedTabId, themeNam
e, testHook) |
| 999 { | 1034 { |
| 1000 var argumentsJSON = [extensionInfo, inspectedTabId || null, themeName].map(_
=> JSON.stringify(_)).join(","); | 1035 var argumentsJSON = [extensionInfo, inspectedTabId || null, themeName].map(_
=> JSON.stringify(_)).join(","); |
| 1001 if (!testHook) | 1036 if (!testHook) |
| 1002 testHook = () => {}; | 1037 testHook = () => {}; |
| 1003 return "(function(injectedScriptId){ " + | 1038 return "(function(injectedScriptId){ " + |
| 1004 defineCommonExtensionSymbols.toString() + ";" + | 1039 defineCommonExtensionSymbols.toString() + ";" + |
| 1005 "(" + injectedExtensionAPI.toString() + ")(" + argumentsJSON + "," + tes
tHook + ", injectedScriptId);" + | 1040 "(" + injectedExtensionAPI.toString() + ")(" + argumentsJSON + "," + tes
tHook + ", injectedScriptId);" + |
| 1006 "})"; | 1041 "})"; |
| 1007 } | 1042 } |
| OLD | NEW |