| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 TimelineEventRecorded: "timeline-event-recorded", | 69 TimelineEventRecorded: "timeline-event-recorded", |
| 70 ViewShown: "view-shown-", | 70 ViewShown: "view-shown-", |
| 71 ViewHidden: "view-hidden-" | 71 ViewHidden: "view-hidden-" |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 apiPrivate.Commands = { | 74 apiPrivate.Commands = { |
| 75 AddAuditCategory: "addAuditCategory", | 75 AddAuditCategory: "addAuditCategory", |
| 76 AddAuditResult: "addAuditResult", | 76 AddAuditResult: "addAuditResult", |
| 77 AddConsoleMessage: "addConsoleMessage", | 77 AddConsoleMessage: "addConsoleMessage", |
| 78 AddRequestHeaders: "addRequestHeaders", | 78 AddRequestHeaders: "addRequestHeaders", |
| 79 ApplyStyleSheet: "applyStyleSheet", |
| 79 CreatePanel: "createPanel", | 80 CreatePanel: "createPanel", |
| 80 CreateSidebarPane: "createSidebarPane", | 81 CreateSidebarPane: "createSidebarPane", |
| 81 CreateStatusBarButton: "createStatusBarButton", | 82 CreateStatusBarButton: "createStatusBarButton", |
| 82 EvaluateOnInspectedPage: "evaluateOnInspectedPage", | 83 EvaluateOnInspectedPage: "evaluateOnInspectedPage", |
| 83 ForwardKeyboardEvent: "_forwardKeyboardEvent", | 84 ForwardKeyboardEvent: "_forwardKeyboardEvent", |
| 84 GetConsoleMessages: "getConsoleMessages", | 85 GetConsoleMessages: "getConsoleMessages", |
| 85 GetHAR: "getHAR", | 86 GetHAR: "getHAR", |
| 86 GetPageResources: "getPageResources", | 87 GetPageResources: "getPageResources", |
| 87 GetRequestContent: "getRequestContent", | 88 GetRequestContent: "getRequestContent", |
| 88 GetResourceContent: "getResourceContent", | 89 GetResourceContent: "getResourceContent", |
| 90 InspectedURLChanged: "inspectedURLChanged", |
| 91 OpenResource: "openResource", |
| 89 Reload: "Reload", | 92 Reload: "Reload", |
| 90 Subscribe: "subscribe", | 93 Subscribe: "subscribe", |
| 91 SetOpenResourceHandler: "setOpenResourceHandler", | 94 SetOpenResourceHandler: "setOpenResourceHandler", |
| 92 SetResourceContent: "setResourceContent", | 95 SetResourceContent: "setResourceContent", |
| 93 SetSidebarContent: "setSidebarContent", | 96 SetSidebarContent: "setSidebarContent", |
| 94 SetSidebarHeight: "setSidebarHeight", | 97 SetSidebarHeight: "setSidebarHeight", |
| 95 SetSidebarPage: "setSidebarPage", | 98 SetSidebarPage: "setSidebarPage", |
| 96 ShowPanel: "showPanel", | 99 ShowPanel: "showPanel", |
| 97 StopAuditCategoryRun: "stopAuditCategoryRun", | 100 StopAuditCategoryRun: "stopAuditCategoryRun", |
| 98 OpenResource: "openResource", | |
| 99 Unsubscribe: "unsubscribe", | 101 Unsubscribe: "unsubscribe", |
| 100 UpdateAuditProgress: "updateAuditProgress", | 102 UpdateAuditProgress: "updateAuditProgress", |
| 101 UpdateButton: "updateButton", | 103 UpdateButton: "updateButton" |
| 102 InspectedURLChanged: "inspectedURLChanged" | |
| 103 }; | 104 }; |
| 104 } | 105 } |
| 105 | 106 |
| 106 function injectedExtensionAPI(injectedScriptId) | 107 function injectedExtensionAPI(injectedScriptId) |
| 107 { | 108 { |
| 108 | 109 |
| 109 var apiPrivate = {}; | 110 var apiPrivate = {}; |
| 110 | 111 |
| 111 defineCommonExtensionSymbols(apiPrivate); | 112 defineCommonExtensionSymbols(apiPrivate); |
| 112 | 113 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 elements: new ElementsPanel(), | 276 elements: new ElementsPanel(), |
| 276 sources: new SourcesPanel(), | 277 sources: new SourcesPanel(), |
| 277 }; | 278 }; |
| 278 | 279 |
| 279 function panelGetter(name) | 280 function panelGetter(name) |
| 280 { | 281 { |
| 281 return panels[name]; | 282 return panels[name]; |
| 282 } | 283 } |
| 283 for (var panel in panels) | 284 for (var panel in panels) |
| 284 this.__defineGetter__(panel, panelGetter.bind(null, panel)); | 285 this.__defineGetter__(panel, panelGetter.bind(null, panel)); |
| 286 this.applyStyleSheet = function(styleSheet) { extensionServer.sendRequest({
command: commands.ApplyStyleSheet, styleSheet: styleSheet }); }; |
| 285 } | 287 } |
| 286 | 288 |
| 287 Panels.prototype = { | 289 Panels.prototype = { |
| 288 create: function(title, icon, page, callback) | 290 create: function(title, icon, page, callback) |
| 289 { | 291 { |
| 290 var id = "extension-panel-" + extensionServer.nextObjectId(); | 292 var id = "extension-panel-" + extensionServer.nextObjectId(); |
| 291 var request = { | 293 var request = { |
| 292 command: commands.CreatePanel, | 294 command: commands.CreatePanel, |
| 293 id: id, | 295 id: id, |
| 294 title: title, | 296 title: title, |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 { | 911 { |
| 910 return "(function(injectedScriptId){ " + | 912 return "(function(injectedScriptId){ " + |
| 911 "var extensionServer;" + | 913 "var extensionServer;" + |
| 912 defineCommonExtensionSymbols.toString() + ";" + | 914 defineCommonExtensionSymbols.toString() + ";" + |
| 913 injectedExtensionAPI.toString() + ";" + | 915 injectedExtensionAPI.toString() + ";" + |
| 914 buildPlatformExtensionAPI(extensionInfo) + ";" + | 916 buildPlatformExtensionAPI(extensionInfo) + ";" + |
| 915 "platformExtensionAPI(injectedExtensionAPI(injectedScriptId));" + | 917 "platformExtensionAPI(injectedExtensionAPI(injectedScriptId));" + |
| 916 "return {};" + | 918 "return {};" + |
| 917 "})"; | 919 "})"; |
| 918 } | 920 } |
| OLD | NEW |