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 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 { | 806 { |
807 extensionServer.sendRequest({ command: commands.SetResourceContent, url:
this._url, content: content, commit: commit }, callback); | 807 extensionServer.sendRequest({ command: commands.SetResourceContent, url:
this._url, content: content, commit: commit }, callback); |
808 } | 808 } |
809 } | 809 } |
810 | 810 |
811 var keyboardEventRequestQueue = []; | 811 var keyboardEventRequestQueue = []; |
812 var forwardTimer = null; | 812 var forwardTimer = null; |
813 | 813 |
814 function forwardKeyboardEvent(event) | 814 function forwardKeyboardEvent(event) |
815 { | 815 { |
816 const Esc = "U+001B"; | |
817 // We only care about global hotkeys, not about random text | 816 // We only care about global hotkeys, not about random text |
818 if (!event.ctrlKey && !event.altKey && !event.metaKey && !/^F\d+$/.test(even
t.keyIdentifier) && event.keyIdentifier !== Esc) | 817 if (!event.ctrlKey && !event.altKey && !event.metaKey && !/^F\d+$/.test(even
t.key) && event.key !== "Escape") |
819 return; | 818 return; |
820 var requestPayload = { | 819 var requestPayload = { |
821 eventType: event.type, | 820 eventType: event.type, |
822 ctrlKey: event.ctrlKey, | 821 ctrlKey: event.ctrlKey, |
823 altKey: event.altKey, | 822 altKey: event.altKey, |
824 metaKey: event.metaKey, | 823 metaKey: event.metaKey, |
825 keyIdentifier: event.keyIdentifier, | 824 keyIdentifier: event.keyIdentifier, |
| 825 key: event.key, |
| 826 code: event.code, |
826 location: event.location, | 827 location: event.location, |
827 keyCode: event.keyCode | 828 keyCode: event.keyCode |
828 }; | 829 }; |
829 keyboardEventRequestQueue.push(requestPayload); | 830 keyboardEventRequestQueue.push(requestPayload); |
830 if (!forwardTimer) | 831 if (!forwardTimer) |
831 forwardTimer = setTimeout(forwardEventQueue, 0); | 832 forwardTimer = setTimeout(forwardEventQueue, 0); |
832 } | 833 } |
833 | 834 |
834 function forwardEventQueue() | 835 function forwardEventQueue() |
835 { | 836 { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 { | 1016 { |
1016 return "(function(injectedScriptId){ " + | 1017 return "(function(injectedScriptId){ " + |
1017 "var extensionServer;" + | 1018 "var extensionServer;" + |
1018 defineCommonExtensionSymbols.toString() + ";" + | 1019 defineCommonExtensionSymbols.toString() + ";" + |
1019 injectedExtensionAPI.toString() + ";" + | 1020 injectedExtensionAPI.toString() + ";" + |
1020 buildPlatformExtensionAPI(extensionInfo, inspectedTabId) + ";" + | 1021 buildPlatformExtensionAPI(extensionInfo, inspectedTabId) + ";" + |
1021 "platformExtensionAPI(injectedExtensionAPI(injectedScriptId));" + | 1022 "platformExtensionAPI(injectedExtensionAPI(injectedScriptId));" + |
1022 "return {};" + | 1023 "return {};" + |
1023 "})"; | 1024 "})"; |
1024 } | 1025 } |
OLD | NEW |