| 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 * * 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 var commands = WebInspector.extensionAPI.Commands; | 47 var commands = WebInspector.extensionAPI.Commands; |
| 48 | 48 |
| 49 this._registerHandler(commands.AddAuditCategory, this._onAddAuditCategory.bi
nd(this)); | 49 this._registerHandler(commands.AddAuditCategory, this._onAddAuditCategory.bi
nd(this)); |
| 50 this._registerHandler(commands.AddAuditResult, this._onAddAuditResult.bind(t
his)); | 50 this._registerHandler(commands.AddAuditResult, this._onAddAuditResult.bind(t
his)); |
| 51 this._registerHandler(commands.AddConsoleMessage, this._onAddConsoleMessage.
bind(this)); | 51 this._registerHandler(commands.AddConsoleMessage, this._onAddConsoleMessage.
bind(this)); |
| 52 this._registerHandler(commands.AddRequestHeaders, this._onAddRequestHeaders.
bind(this)); | 52 this._registerHandler(commands.AddRequestHeaders, this._onAddRequestHeaders.
bind(this)); |
| 53 this._registerHandler(commands.CreatePanel, this._onCreatePanel.bind(this)); | 53 this._registerHandler(commands.CreatePanel, this._onCreatePanel.bind(this)); |
| 54 this._registerHandler(commands.CreateSidebarPane, this._onCreateSidebarPane.
bind(this)); | 54 this._registerHandler(commands.CreateSidebarPane, this._onCreateSidebarPane.
bind(this)); |
| 55 this._registerHandler(commands.CreateStatusBarButton, this._onCreateStatusBa
rButton.bind(this)); | 55 this._registerHandler(commands.CreateStatusBarButton, this._onCreateStatusBa
rButton.bind(this)); |
| 56 this._registerHandler(commands.EvaluateOnInspectedPage, this._onEvaluateOnIn
spectedPage.bind(this)); | 56 this._registerHandler(commands.EvaluateOnInspectedPage, this._onEvaluateOnIn
spectedPage.bind(this)); |
| 57 this._registerHandler(commands.ForwardKeyboardEvent, this._onForwardKeyboard
Event.bind(this)); |
| 57 this._registerHandler(commands.GetHAR, this._onGetHAR.bind(this)); | 58 this._registerHandler(commands.GetHAR, this._onGetHAR.bind(this)); |
| 58 this._registerHandler(commands.GetConsoleMessages, this._onGetConsoleMessage
s.bind(this)); | 59 this._registerHandler(commands.GetConsoleMessages, this._onGetConsoleMessage
s.bind(this)); |
| 59 this._registerHandler(commands.GetPageResources, this._onGetPageResources.bi
nd(this)); | 60 this._registerHandler(commands.GetPageResources, this._onGetPageResources.bi
nd(this)); |
| 60 this._registerHandler(commands.GetRequestContent, this._onGetRequestContent.
bind(this)); | 61 this._registerHandler(commands.GetRequestContent, this._onGetRequestContent.
bind(this)); |
| 61 this._registerHandler(commands.GetResourceContent, this._onGetResourceConten
t.bind(this)); | 62 this._registerHandler(commands.GetResourceContent, this._onGetResourceConten
t.bind(this)); |
| 62 this._registerHandler(commands.Reload, this._onReload.bind(this)); | 63 this._registerHandler(commands.Reload, this._onReload.bind(this)); |
| 63 this._registerHandler(commands.SetOpenResourceHandler, this._onSetOpenResour
ceHandler.bind(this)); | 64 this._registerHandler(commands.SetOpenResourceHandler, this._onSetOpenResour
ceHandler.bind(this)); |
| 64 this._registerHandler(commands.SetResourceContent, this._onSetResourceConten
t.bind(this)); | 65 this._registerHandler(commands.SetResourceContent, this._onSetResourceConten
t.bind(this)); |
| 65 this._registerHandler(commands.SetSidebarHeight, this._onSetSidebarHeight.bi
nd(this)); | 66 this._registerHandler(commands.SetSidebarHeight, this._onSetSidebarHeight.bi
nd(this)); |
| 66 this._registerHandler(commands.SetSidebarContent, this._onSetSidebarContent.
bind(this)); | 67 this._registerHandler(commands.SetSidebarContent, this._onSetSidebarContent.
bind(this)); |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 }, | 560 }, |
| 560 | 561 |
| 561 _onStopAuditCategoryRun: function(message) | 562 _onStopAuditCategoryRun: function(message) |
| 562 { | 563 { |
| 563 var auditRun = this._clientObjects[message.resultId]; | 564 var auditRun = this._clientObjects[message.resultId]; |
| 564 if (!auditRun) | 565 if (!auditRun) |
| 565 return this._status.E_NOTFOUND(message.resultId); | 566 return this._status.E_NOTFOUND(message.resultId); |
| 566 auditRun.done(); | 567 auditRun.done(); |
| 567 }, | 568 }, |
| 568 | 569 |
| 570 _onForwardKeyboardEvent: function(message) |
| 571 { |
| 572 const Esc = "U+001B"; |
| 573 |
| 574 if (!message.ctrlKey && !message.altKey && !message.metaKey && !/^F\d+$/
.test(message.keyIdentifier) && message.keyIdentifier !== Esc) |
| 575 return; |
| 576 // Fool around closure compiler -- it has its own notion of both Keyboar
dEvent constructor |
| 577 // and initKeyboardEvent methods and overriding these in externs.js does
not have effect. |
| 578 var event = new window.KeyboardEvent(message.eventType, { |
| 579 keyIdentifier: message.keyIdentifier, |
| 580 keyLocation: message.keyLocation, |
| 581 ctrlKey: message.ctrlKey, |
| 582 altKey: message.altKey, |
| 583 shiftKey: message.shiftKey, |
| 584 metaKey: message.metaKey |
| 585 }); |
| 586 document.dispatchEvent(event); |
| 587 }, |
| 588 |
| 569 _dispatchCallback: function(requestId, port, result) | 589 _dispatchCallback: function(requestId, port, result) |
| 570 { | 590 { |
| 571 if (requestId) | 591 if (requestId) |
| 572 port.postMessage({ command: "callback", requestId: requestId, result
: result }); | 592 port.postMessage({ command: "callback", requestId: requestId, result
: result }); |
| 573 }, | 593 }, |
| 574 | 594 |
| 575 initExtensions: function() | 595 initExtensions: function() |
| 576 { | 596 { |
| 577 this._registerAutosubscriptionHandler(WebInspector.extensionAPI.Events.C
onsoleMessageAdded, | 597 this._registerAutosubscriptionHandler(WebInspector.extensionAPI.Events.C
onsoleMessageAdded, |
| 578 WebInspector.console, WebInspector.ConsoleModel.Events.MessageAdded,
this._notifyConsoleMessageAdded); | 598 WebInspector.console, WebInspector.ConsoleModel.Events.MessageAdded,
this._notifyConsoleMessageAdded); |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 | 898 |
| 879 WebInspector.extensionServer = new WebInspector.ExtensionServer(); | 899 WebInspector.extensionServer = new WebInspector.ExtensionServer(); |
| 880 | 900 |
| 881 window.addExtension = function(page, name) | 901 window.addExtension = function(page, name) |
| 882 { | 902 { |
| 883 WebInspector.extensionServer._addExtension({ | 903 WebInspector.extensionServer._addExtension({ |
| 884 startPage: page, | 904 startPage: page, |
| 885 name: name, | 905 name: name, |
| 886 }); | 906 }); |
| 887 } | 907 } |
| OLD | NEW |