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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 GetPageResources: "getPageResources", | 74 GetPageResources: "getPageResources", |
75 GetRequestContent: "getRequestContent", | 75 GetRequestContent: "getRequestContent", |
76 GetResourceContent: "getResourceContent", | 76 GetResourceContent: "getResourceContent", |
77 InspectedURLChanged: "inspectedURLChanged", | 77 InspectedURLChanged: "inspectedURLChanged", |
78 OpenResource: "openResource", | 78 OpenResource: "openResource", |
79 Reload: "Reload", | 79 Reload: "Reload", |
80 Subscribe: "subscribe", | 80 Subscribe: "subscribe", |
81 SetOpenResourceHandler: "setOpenResourceHandler", | 81 SetOpenResourceHandler: "setOpenResourceHandler", |
82 SetResourceContent: "setResourceContent", | 82 SetResourceContent: "setResourceContent", |
83 SetSidebarContent: "setSidebarContent", | 83 SetSidebarContent: "setSidebarContent", |
84 SetSidebarHeight: "setSidebarHeight", | |
85 SetSidebarPage: "setSidebarPage", | 84 SetSidebarPage: "setSidebarPage", |
86 ShowPanel: "showPanel", | 85 ShowPanel: "showPanel", |
87 StopAuditCategoryRun: "stopAuditCategoryRun", | 86 StopAuditCategoryRun: "stopAuditCategoryRun", |
88 Unsubscribe: "unsubscribe", | 87 Unsubscribe: "unsubscribe", |
89 UpdateAuditProgress: "updateAuditProgress", | 88 UpdateAuditProgress: "updateAuditProgress", |
90 UpdateButton: "updateButton" | 89 UpdateButton: "updateButton" |
91 }; | 90 }; |
92 } | 91 } |
93 | 92 |
94 /** | 93 /** |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
381 { | 380 { |
382 if (!warningGiven) { | 381 if (!warningGiven) { |
383 console.warn(className + "." + oldName + " is deprecated. Use " + cl assName + "." + newName + " instead"); | 382 console.warn(className + "." + oldName + " is deprecated. Use " + cl assName + "." + newName + " instead"); |
384 warningGiven = true; | 383 warningGiven = true; |
385 } | 384 } |
386 return object[newName]; | 385 return object[newName]; |
387 } | 386 } |
388 object.__defineGetter__(oldName, getter); | 387 object.__defineGetter__(oldName, getter); |
389 } | 388 } |
390 | 389 |
390 function defineDeprecatedMethod(object, className, oldName) | |
391 { | |
392 var warningGiven = false; | |
393 function noop() | |
394 { | |
395 if (!warningGiven) { | |
caseq
2016/04/20 18:17:12
nit:
if (warningGiven)
return;
(we prefer ear
| |
396 console.warn(className + "." + oldName + " is deprecated, please don 't use it. It is a no-op."); | |
397 warningGiven = true; | |
398 } | |
399 return null; | |
caseq
2016/04/20 18:17:12
drop return altogether?
| |
400 } | |
401 object.oldName = noop.bind(null); | |
caseq
2016/04/20 18:17:12
Hmm... Does this work?
| |
402 } | |
403 | |
391 function extractCallbackArgument(args) | 404 function extractCallbackArgument(args) |
392 { | 405 { |
393 var lastArgument = args[args.length - 1]; | 406 var lastArgument = args[args.length - 1]; |
394 return typeof lastArgument === "function" ? lastArgument : undefined; | 407 return typeof lastArgument === "function" ? lastArgument : undefined; |
395 } | 408 } |
396 | 409 |
397 var AuditCategory = declareInterfaceClass(AuditCategoryImpl); | 410 var AuditCategory = declareInterfaceClass(AuditCategoryImpl); |
398 var AuditResult = declareInterfaceClass(AuditResultImpl); | 411 var AuditResult = declareInterfaceClass(AuditResultImpl); |
399 var Button = declareInterfaceClass(ButtonImpl); | 412 var Button = declareInterfaceClass(ButtonImpl); |
400 var EventSink = declareInterfaceClass(EventSinkImpl); | 413 var EventSink = declareInterfaceClass(EventSinkImpl); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
474 __proto__: ExtensionViewImpl.prototype | 487 __proto__: ExtensionViewImpl.prototype |
475 } | 488 } |
476 | 489 |
477 /** | 490 /** |
478 * @constructor | 491 * @constructor |
479 * @extends {ExtensionViewImpl} | 492 * @extends {ExtensionViewImpl} |
480 */ | 493 */ |
481 function ExtensionSidebarPaneImpl(id) | 494 function ExtensionSidebarPaneImpl(id) |
482 { | 495 { |
483 ExtensionViewImpl.call(this, id); | 496 ExtensionViewImpl.call(this, id); |
497 defineDeprecatedMethod(this, "ExtensionSidebarPane", "setHeight"); | |
484 } | 498 } |
485 | 499 |
486 ExtensionSidebarPaneImpl.prototype = { | 500 ExtensionSidebarPaneImpl.prototype = { |
487 setHeight: function(height) | |
488 { | |
489 extensionServer.sendRequest({ command: commands.SetSidebarHeight, id: th is._id, height: height }); | |
490 }, | |
491 | |
492 setExpression: function(expression, rootTitle, evaluateOptions) | 501 setExpression: function(expression, rootTitle, evaluateOptions) |
493 { | 502 { |
494 var request = { | 503 var request = { |
495 command: commands.SetSidebarContent, | 504 command: commands.SetSidebarContent, |
496 id: this._id, | 505 id: this._id, |
497 expression: expression, | 506 expression: expression, |
498 rootTitle: rootTitle, | 507 rootTitle: rootTitle, |
499 evaluateOnPage: true, | 508 evaluateOnPage: true, |
500 }; | 509 }; |
501 if (typeof evaluateOptions === "object") | 510 if (typeof evaluateOptions === "object") |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1004 { | 1013 { |
1005 return "(function(injectedScriptId){ " + | 1014 return "(function(injectedScriptId){ " + |
1006 "var extensionServer;" + | 1015 "var extensionServer;" + |
1007 defineCommonExtensionSymbols.toString() + ";" + | 1016 defineCommonExtensionSymbols.toString() + ";" + |
1008 injectedExtensionAPI.toString() + ";" + | 1017 injectedExtensionAPI.toString() + ";" + |
1009 buildPlatformExtensionAPI(extensionInfo, inspectedTabId) + ";" + | 1018 buildPlatformExtensionAPI(extensionInfo, inspectedTabId) + ";" + |
1010 "platformExtensionAPI(injectedExtensionAPI(injectedScriptId));" + | 1019 "platformExtensionAPI(injectedExtensionAPI(injectedScriptId));" + |
1011 "return {};" + | 1020 "return {};" + |
1012 "})"; | 1021 "})"; |
1013 } | 1022 } |
OLD | NEW |