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 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 }, | 659 }, |
660 | 660 |
661 _dispatchCallback: function(requestId, port, result) | 661 _dispatchCallback: function(requestId, port, result) |
662 { | 662 { |
663 if (requestId) | 663 if (requestId) |
664 port.postMessage({ command: "callback", requestId: requestId, result
: result }); | 664 port.postMessage({ command: "callback", requestId: requestId, result
: result }); |
665 }, | 665 }, |
666 | 666 |
667 _initExtensions: function() | 667 _initExtensions: function() |
668 { | 668 { |
669 this._registerAutosubscriptionHandler(WebInspector.extensionAPI.Events.C
onsoleMessageAdded, | 669 this._registerAutosubscriptionTargetManagerHandler(WebInspector.extensio
nAPI.Events.ConsoleMessageAdded, |
670 WebInspector.multitargetConsoleModel, WebInspector.ConsoleModel.Even
ts.MessageAdded, this._notifyConsoleMessageAdded); | 670 WebInspector.ConsoleModel, WebInspector.ConsoleModel.Events.MessageA
dded, this._notifyConsoleMessageAdded); |
671 this._registerAutosubscriptionHandler(WebInspector.extensionAPI.Events.N
etworkRequestFinished, | |
672 WebInspector.networkManager, WebInspector.NetworkManager.EventTypes.
RequestFinished, this._notifyRequestFinished); | |
673 this._registerAutosubscriptionHandler(WebInspector.extensionAPI.Events.R
esourceAdded, | 671 this._registerAutosubscriptionHandler(WebInspector.extensionAPI.Events.R
esourceAdded, |
674 WebInspector.workspace, | 672 WebInspector.workspace, WebInspector.Workspace.Events.UISourceCodeAd
ded, this._notifyResourceAdded); |
675 WebInspector.Workspace.Events.UISourceCodeAdded, | 673 this._registerAutosubscriptionTargetManagerHandler(WebInspector.extensio
nAPI.Events.NetworkRequestFinished, |
676 this._notifyResourceAdded); | 674 WebInspector.NetworkManager, WebInspector.NetworkManager.EventTypes.
RequestFinished, this._notifyRequestFinished); |
677 | 675 |
678 /** | 676 /** |
679 * @this {WebInspector.ExtensionServer} | 677 * @this {WebInspector.ExtensionServer} |
680 */ | 678 */ |
681 function onElementsSubscriptionStarted() | 679 function onElementsSubscriptionStarted() |
682 { | 680 { |
683 WebInspector.notifications.addEventListener(WebInspector.Notificatio
nService.Events.SelectedNodeChanged, this._notifyElementsSelectionChanged, this)
; | 681 WebInspector.notifications.addEventListener(WebInspector.Notificatio
nService.Events.SelectedNodeChanged, this._notifyElementsSelectionChanged, this)
; |
684 } | 682 } |
685 | 683 |
686 /** | 684 /** |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 console.assert(command); | 862 console.assert(command); |
865 this._handlers[command] = callback; | 863 this._handlers[command] = callback; |
866 }, | 864 }, |
867 | 865 |
868 _registerSubscriptionHandler: function(eventTopic, onSubscribeFirst, onUnsub
scribeLast) | 866 _registerSubscriptionHandler: function(eventTopic, onSubscribeFirst, onUnsub
scribeLast) |
869 { | 867 { |
870 this._subscriptionStartHandlers[eventTopic] = onSubscribeFirst; | 868 this._subscriptionStartHandlers[eventTopic] = onSubscribeFirst; |
871 this._subscriptionStopHandlers[eventTopic] = onUnsubscribeLast; | 869 this._subscriptionStopHandlers[eventTopic] = onUnsubscribeLast; |
872 }, | 870 }, |
873 | 871 |
| 872 /** |
| 873 * @param {string} eventTopic |
| 874 * @param {!Object} eventTarget |
| 875 * @param {string} frontendEventType |
| 876 * @param {function(!WebInspector.Event)} handler |
| 877 */ |
874 _registerAutosubscriptionHandler: function(eventTopic, eventTarget, frontend
EventType, handler) | 878 _registerAutosubscriptionHandler: function(eventTopic, eventTarget, frontend
EventType, handler) |
875 { | 879 { |
876 this._registerSubscriptionHandler(eventTopic, | 880 this._registerSubscriptionHandler(eventTopic, |
877 eventTarget.addEventListener.bind(eventTarget, frontendEventType, ha
ndler, this), | 881 eventTarget.addEventListener.bind(eventTarget, frontendEventType, ha
ndler, this), |
878 eventTarget.removeEventListener.bind(eventTarget, frontendEventType,
handler, this)); | 882 eventTarget.removeEventListener.bind(eventTarget, frontendEventType,
handler, this)); |
879 }, | 883 }, |
880 | 884 |
| 885 /** |
| 886 * @param {string} eventTopic |
| 887 * @param {!Function} modelClass |
| 888 * @param {string} frontendEventType |
| 889 * @param {function(!WebInspector.Event)} handler |
| 890 */ |
| 891 _registerAutosubscriptionTargetManagerHandler: function(eventTopic, modelCla
ss, frontendEventType, handler) |
| 892 { |
| 893 this._registerSubscriptionHandler(eventTopic, |
| 894 WebInspector.targetManager.addModelListener.bind(WebInspector.target
Manager, modelClass, frontendEventType, handler, this), |
| 895 WebInspector.targetManager.removeModelListener.bind(WebInspector.tar
getManager, modelClass, frontendEventType, handler, this)); |
| 896 }, |
| 897 |
881 _registerResourceContentCommittedHandler: function(handler) | 898 _registerResourceContentCommittedHandler: function(handler) |
882 { | 899 { |
883 /** | 900 /** |
884 * @this {WebInspector.ExtensionServer} | 901 * @this {WebInspector.ExtensionServer} |
885 */ | 902 */ |
886 function addFirstEventListener() | 903 function addFirstEventListener() |
887 { | 904 { |
888 WebInspector.workspace.addEventListener(WebInspector.Workspace.Event
s.UISourceCodeContentCommitted, handler, this); | 905 WebInspector.workspace.addEventListener(WebInspector.Workspace.Event
s.UISourceCodeContentCommitted, handler, this); |
889 WebInspector.workspace.setHasResourceContentTrackingExtensions(true)
; | 906 WebInspector.workspace.setHasResourceContentTrackingExtensions(true)
; |
890 } | 907 } |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 /** | 1095 /** |
1079 * @typedef {{code: string, description: string, details: !Array.<*>}} | 1096 * @typedef {{code: string, description: string, details: !Array.<*>}} |
1080 */ | 1097 */ |
1081 WebInspector.ExtensionStatus.Record; | 1098 WebInspector.ExtensionStatus.Record; |
1082 | 1099 |
1083 WebInspector.extensionAPI = {}; | 1100 WebInspector.extensionAPI = {}; |
1084 defineCommonExtensionSymbols(WebInspector.extensionAPI); | 1101 defineCommonExtensionSymbols(WebInspector.extensionAPI); |
1085 | 1102 |
1086 importScript("ExtensionPanel.js"); | 1103 importScript("ExtensionPanel.js"); |
1087 importScript("ExtensionView.js"); | 1104 importScript("ExtensionView.js"); |
OLD | NEW |