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 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 { | 611 { |
612 var auditRun = this._clientObjects[message.resultId]; | 612 var auditRun = this._clientObjects[message.resultId]; |
613 if (!auditRun) | 613 if (!auditRun) |
614 return this._status.E_NOTFOUND(message.resultId); | 614 return this._status.E_NOTFOUND(message.resultId); |
615 auditRun.done(); | 615 auditRun.done(); |
616 }, | 616 }, |
617 | 617 |
618 _onForwardKeyboardEvent: function(message) | 618 _onForwardKeyboardEvent: function(message) |
619 { | 619 { |
620 const Esc = "U+001B"; | 620 const Esc = "U+001B"; |
| 621 message.entries.forEach(handleEventEntry); |
621 | 622 |
622 if (!message.ctrlKey && !message.altKey && !message.metaKey && !/^F\d+$/
.test(message.keyIdentifier) && message.keyIdentifier !== Esc) | 623 function handleEventEntry(entry) |
623 return; | 624 { |
624 // Fool around closure compiler -- it has its own notion of both Keyboar
dEvent constructor | 625 if (!entry.ctrlKey && !entry.altKey && !entry.metaKey && !/^F\d+$/.t
est(entry.keyIdentifier) && entry.keyIdentifier !== Esc) |
625 // and initKeyboardEvent methods and overriding these in externs.js does
not have effect. | 626 return; |
626 var event = new window.KeyboardEvent(message.eventType, { | 627 // Fool around closure compiler -- it has its own notion of both Key
boardEvent constructor |
627 keyIdentifier: message.keyIdentifier, | 628 // and initKeyboardEvent methods and overriding these in externs.js
does not have effect. |
628 location: message.location, | 629 var event = new window.KeyboardEvent(entry.eventType, { |
629 ctrlKey: message.ctrlKey, | 630 keyIdentifier: entry.keyIdentifier, |
630 altKey: message.altKey, | 631 location: entry.location, |
631 shiftKey: message.shiftKey, | 632 ctrlKey: entry.ctrlKey, |
632 metaKey: message.metaKey | 633 altKey: entry.altKey, |
633 }); | 634 shiftKey: entry.shiftKey, |
634 document.dispatchEvent(event); | 635 metaKey: entry.metaKey |
| 636 }); |
| 637 event.__keyCode = keyCodeForEntry(entry); |
| 638 document.dispatchEvent(event); |
| 639 } |
| 640 |
| 641 function keyCodeForEntry(entry) |
| 642 { |
| 643 var keyCode = entry.keyCode; |
| 644 if (!keyCode) { |
| 645 // This is required only for synthetic events (e.g. dispatched i
n tests). |
| 646 var match = entry.keyIdentifier.match(/^U\+([\dA-Fa-f]+)$/); |
| 647 if (match) |
| 648 keyCode = parseInt(match[1], 16); |
| 649 } |
| 650 return keyCode || 0; |
| 651 } |
635 }, | 652 }, |
636 | 653 |
637 _dispatchCallback: function(requestId, port, result) | 654 _dispatchCallback: function(requestId, port, result) |
638 { | 655 { |
639 if (requestId) | 656 if (requestId) |
640 port.postMessage({ command: "callback", requestId: requestId, result
: result }); | 657 port.postMessage({ command: "callback", requestId: requestId, result
: result }); |
641 }, | 658 }, |
642 | 659 |
643 _initExtensions: function() | 660 _initExtensions: function() |
644 { | 661 { |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1042 /** | 1059 /** |
1043 * @typedef {{code: string, description: string, details: !Array.<*>}} | 1060 * @typedef {{code: string, description: string, details: !Array.<*>}} |
1044 */ | 1061 */ |
1045 WebInspector.ExtensionStatus.Record; | 1062 WebInspector.ExtensionStatus.Record; |
1046 | 1063 |
1047 WebInspector.extensionAPI = {}; | 1064 WebInspector.extensionAPI = {}; |
1048 defineCommonExtensionSymbols(WebInspector.extensionAPI); | 1065 defineCommonExtensionSymbols(WebInspector.extensionAPI); |
1049 | 1066 |
1050 importScript("ExtensionPanel.js"); | 1067 importScript("ExtensionPanel.js"); |
1051 importScript("ExtensionView.js"); | 1068 importScript("ExtensionView.js"); |
OLD | NEW |