| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 ViewHidden: 'view-hidden-' | 60 ViewHidden: 'view-hidden-' |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 /** @enum {string} */ | 63 /** @enum {string} */ |
| 64 apiPrivate.Commands = { | 64 apiPrivate.Commands = { |
| 65 AddAuditCategory: 'addAuditCategory', | 65 AddAuditCategory: 'addAuditCategory', |
| 66 AddAuditResult: 'addAuditResult', | 66 AddAuditResult: 'addAuditResult', |
| 67 AddRequestHeaders: 'addRequestHeaders', | 67 AddRequestHeaders: 'addRequestHeaders', |
| 68 AddTraceProvider: 'addTraceProvider', | 68 AddTraceProvider: 'addTraceProvider', |
| 69 ApplyStyleSheet: 'applyStyleSheet', | 69 ApplyStyleSheet: 'applyStyleSheet', |
| 70 CompleteTraceSession: 'completeTraceSession', |
| 70 CreatePanel: 'createPanel', | 71 CreatePanel: 'createPanel', |
| 71 CreateSidebarPane: 'createSidebarPane', | 72 CreateSidebarPane: 'createSidebarPane', |
| 72 CreateToolbarButton: 'createToolbarButton', | 73 CreateToolbarButton: 'createToolbarButton', |
| 73 EvaluateOnInspectedPage: 'evaluateOnInspectedPage', | 74 EvaluateOnInspectedPage: 'evaluateOnInspectedPage', |
| 74 ForwardKeyboardEvent: '_forwardKeyboardEvent', | 75 ForwardKeyboardEvent: '_forwardKeyboardEvent', |
| 75 GetHAR: 'getHAR', | 76 GetHAR: 'getHAR', |
| 76 GetPageResources: 'getPageResources', | 77 GetPageResources: 'getPageResources', |
| 77 GetRequestContent: 'getRequestContent', | 78 GetRequestContent: 'getRequestContent', |
| 78 GetResourceContent: 'getResourceContent', | 79 GetResourceContent: 'getResourceContent', |
| 79 InspectedURLChanged: 'inspectedURLChanged', | 80 InspectedURLChanged: 'inspectedURLChanged', |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 | 362 |
| 362 var AuditCategory = declareInterfaceClass(AuditCategoryImpl); | 363 var AuditCategory = declareInterfaceClass(AuditCategoryImpl); |
| 363 var AuditResult = declareInterfaceClass(AuditResultImpl); | 364 var AuditResult = declareInterfaceClass(AuditResultImpl); |
| 364 var Button = declareInterfaceClass(ButtonImpl); | 365 var Button = declareInterfaceClass(ButtonImpl); |
| 365 var EventSink = declareInterfaceClass(EventSinkImpl); | 366 var EventSink = declareInterfaceClass(EventSinkImpl); |
| 366 var ExtensionPanel = declareInterfaceClass(ExtensionPanelImpl); | 367 var ExtensionPanel = declareInterfaceClass(ExtensionPanelImpl); |
| 367 var ExtensionSidebarPane = declareInterfaceClass(ExtensionSidebarPaneImpl); | 368 var ExtensionSidebarPane = declareInterfaceClass(ExtensionSidebarPaneImpl); |
| 368 var PanelWithSidebar = declareInterfaceClass(PanelWithSidebarImpl); | 369 var PanelWithSidebar = declareInterfaceClass(PanelWithSidebarImpl); |
| 369 var Request = declareInterfaceClass(RequestImpl); | 370 var Request = declareInterfaceClass(RequestImpl); |
| 370 var Resource = declareInterfaceClass(ResourceImpl); | 371 var Resource = declareInterfaceClass(ResourceImpl); |
| 372 var TraceSession = declareInterfaceClass(TraceSessionImpl); |
| 371 | 373 |
| 372 /** | 374 /** |
| 373 * @constructor | 375 * @constructor |
| 374 * @extends {PanelWithSidebar} | 376 * @extends {PanelWithSidebar} |
| 375 */ | 377 */ |
| 376 function ElementsPanel() { | 378 function ElementsPanel() { |
| 377 PanelWithSidebar.call(this, 'elements'); | 379 PanelWithSidebar.call(this, 'elements'); |
| 378 } | 380 } |
| 379 | 381 |
| 380 ElementsPanel.prototype = {__proto__: PanelWithSidebar.prototype}; | 382 ElementsPanel.prototype = {__proto__: PanelWithSidebar.prototype}; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 extensionServer.sendRequest( | 500 extensionServer.sendRequest( |
| 499 {command: commands.AddTraceProvider, id: id, categoryName: categoryNam
e, categoryTooltip: categoryTooltip}); | 501 {command: commands.AddTraceProvider, id: id, categoryName: categoryNam
e, categoryTooltip: categoryTooltip}); |
| 500 return new TraceProvider(id); | 502 return new TraceProvider(id); |
| 501 } | 503 } |
| 502 }; | 504 }; |
| 503 | 505 |
| 504 /** | 506 /** |
| 505 * @constructor | 507 * @constructor |
| 506 * @param {string} id | 508 * @param {string} id |
| 507 */ | 509 */ |
| 510 function TraceSessionImpl(id) { |
| 511 this._id = id; |
| 512 } |
| 513 |
| 514 TraceSessionImpl.prototype = { |
| 515 /** |
| 516 * @param {string=} url |
| 517 * @param {number=} timeOffset |
| 518 */ |
| 519 complete: function(url, timeOffset) { |
| 520 var request = { |
| 521 command: commands.CompleteTraceSession, |
| 522 id: this._id, |
| 523 url: url || '', |
| 524 timeOffset: timeOffset || 0 |
| 525 }; |
| 526 extensionServer.sendRequest(request); |
| 527 } |
| 528 } |
| 529 |
| 530 /** |
| 531 * @constructor |
| 532 * @param {string} id |
| 533 */ |
| 508 function TraceProvider(id) { | 534 function TraceProvider(id) { |
| 509 this.onRecordingStarted = new EventSink(events.RecordingStarted + id); | 535 /** |
| 536 * @this {EventSinkImpl} |
| 537 */ |
| 538 function dispatchRecordingStarted(message) { |
| 539 var sessionId = message.arguments[0]; |
| 540 this._fire(new TraceSession(sessionId)); |
| 541 } |
| 542 |
| 543 this.onRecordingStarted = new EventSink(events.RecordingStarted + id, dispat
chRecordingStarted); |
| 510 this.onRecordingStopped = new EventSink(events.RecordingStopped + id); | 544 this.onRecordingStopped = new EventSink(events.RecordingStopped + id); |
| 511 } | 545 } |
| 512 | 546 |
| 513 /** | 547 /** |
| 514 * @constructor | 548 * @constructor |
| 515 */ | 549 */ |
| 516 function Audits() { | 550 function Audits() { |
| 517 } | 551 } |
| 518 | 552 |
| 519 Audits.prototype = { | 553 Audits.prototype = { |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 * @return {string} | 946 * @return {string} |
| 913 */ | 947 */ |
| 914 function buildExtensionAPIInjectedScript(extensionInfo, inspectedTabId, themeNam
e, testHook) { | 948 function buildExtensionAPIInjectedScript(extensionInfo, inspectedTabId, themeNam
e, testHook) { |
| 915 var argumentsJSON = [extensionInfo, inspectedTabId || null, themeName].map(_ =
> JSON.stringify(_)).join(','); | 949 var argumentsJSON = [extensionInfo, inspectedTabId || null, themeName].map(_ =
> JSON.stringify(_)).join(','); |
| 916 if (!testHook) | 950 if (!testHook) |
| 917 testHook = () => {}; | 951 testHook = () => {}; |
| 918 return '(function(injectedScriptId){ ' + defineCommonExtensionSymbols.toString
() + ';' + | 952 return '(function(injectedScriptId){ ' + defineCommonExtensionSymbols.toString
() + ';' + |
| 919 '(' + injectedExtensionAPI.toString() + ')(' + argumentsJSON + ',' + testH
ook + ', injectedScriptId);' + | 953 '(' + injectedExtensionAPI.toString() + ')(' + argumentsJSON + ',' + testH
ook + ', injectedScriptId);' + |
| 920 '})'; | 954 '})'; |
| 921 } | 955 } |
| OLD | NEW |