Chromium Code Reviews| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 372 implConstructor.apply(impl, arguments); | 371 implConstructor.apply(impl, arguments); |
| 373 populateInterfaceClass(this, impl); | 372 populateInterfaceClass(this, impl); |
| 374 }; | 373 }; |
| 375 } | 374 } |
| 376 | 375 |
| 377 function defineDeprecatedProperty(object, className, oldName, newName) | 376 function defineDeprecatedProperty(object, className, oldName, newName) |
| 378 { | 377 { |
| 379 var warningGiven = false; | 378 var warningGiven = false; |
| 380 function getter() | 379 function getter() |
| 381 { | 380 { |
| 382 if (!warningGiven) { | 381 if (warningGiven) |
| 383 console.warn(className + "." + oldName + " is deprecated. Use " + cl assName + "." + newName + " instead"); | 382 return; |
|
caseq
2016/04/20 23:00:47
please revert this -- this is a different case, we
| |
| 384 warningGiven = true; | 383 |
| 385 } | 384 console.warn(className + "." + oldName + " is deprecated. Use " + classN ame + "." + newName + " instead"); |
| 385 warningGiven = true; | |
| 386 | |
| 386 return object[newName]; | 387 return object[newName]; |
| 387 } | 388 } |
| 388 object.__defineGetter__(oldName, getter); | 389 object.__defineGetter__(oldName, getter); |
| 389 } | 390 } |
| 390 | 391 |
| 392 function defineDeprecatedMethod(object, className, oldName) | |
| 393 { | |
| 394 var warningGiven = false; | |
| 395 function noop() | |
| 396 { | |
| 397 if (warningGiven) | |
| 398 return; | |
|
caseq
2016/04/20 23:00:47
indent 4 spaces, please.
| |
| 399 | |
| 400 console.warn(className + "." + oldName + " is deprecated, please don't u se it. It is a no-op."); | |
| 401 warningGiven = true; | |
| 402 } | |
| 403 object[oldName] = noop.bind(null); | |
|
caseq
2016/04/20 23:00:47
we don't use this in noop, so I guess you can just
| |
| 404 } | |
| 405 | |
| 391 function extractCallbackArgument(args) | 406 function extractCallbackArgument(args) |
| 392 { | 407 { |
| 393 var lastArgument = args[args.length - 1]; | 408 var lastArgument = args[args.length - 1]; |
| 394 return typeof lastArgument === "function" ? lastArgument : undefined; | 409 return typeof lastArgument === "function" ? lastArgument : undefined; |
| 395 } | 410 } |
| 396 | 411 |
| 397 var AuditCategory = declareInterfaceClass(AuditCategoryImpl); | 412 var AuditCategory = declareInterfaceClass(AuditCategoryImpl); |
| 398 var AuditResult = declareInterfaceClass(AuditResultImpl); | 413 var AuditResult = declareInterfaceClass(AuditResultImpl); |
| 399 var Button = declareInterfaceClass(ButtonImpl); | 414 var Button = declareInterfaceClass(ButtonImpl); |
| 400 var EventSink = declareInterfaceClass(EventSinkImpl); | 415 var EventSink = declareInterfaceClass(EventSinkImpl); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 474 __proto__: ExtensionViewImpl.prototype | 489 __proto__: ExtensionViewImpl.prototype |
| 475 } | 490 } |
| 476 | 491 |
| 477 /** | 492 /** |
| 478 * @constructor | 493 * @constructor |
| 479 * @extends {ExtensionViewImpl} | 494 * @extends {ExtensionViewImpl} |
| 480 */ | 495 */ |
| 481 function ExtensionSidebarPaneImpl(id) | 496 function ExtensionSidebarPaneImpl(id) |
| 482 { | 497 { |
| 483 ExtensionViewImpl.call(this, id); | 498 ExtensionViewImpl.call(this, id); |
| 499 defineDeprecatedMethod(this, "ExtensionSidebarPane", "setHeight"); | |
| 484 } | 500 } |
| 485 | 501 |
| 486 ExtensionSidebarPaneImpl.prototype = { | 502 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) | 503 setExpression: function(expression, rootTitle, evaluateOptions) |
| 493 { | 504 { |
| 494 var request = { | 505 var request = { |
| 495 command: commands.SetSidebarContent, | 506 command: commands.SetSidebarContent, |
| 496 id: this._id, | 507 id: this._id, |
| 497 expression: expression, | 508 expression: expression, |
| 498 rootTitle: rootTitle, | 509 rootTitle: rootTitle, |
| 499 evaluateOnPage: true, | 510 evaluateOnPage: true, |
| 500 }; | 511 }; |
| 501 if (typeof evaluateOptions === "object") | 512 if (typeof evaluateOptions === "object") |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1004 { | 1015 { |
| 1005 return "(function(injectedScriptId){ " + | 1016 return "(function(injectedScriptId){ " + |
| 1006 "var extensionServer;" + | 1017 "var extensionServer;" + |
| 1007 defineCommonExtensionSymbols.toString() + ";" + | 1018 defineCommonExtensionSymbols.toString() + ";" + |
| 1008 injectedExtensionAPI.toString() + ";" + | 1019 injectedExtensionAPI.toString() + ";" + |
| 1009 buildPlatformExtensionAPI(extensionInfo, inspectedTabId) + ";" + | 1020 buildPlatformExtensionAPI(extensionInfo, inspectedTabId) + ";" + |
| 1010 "platformExtensionAPI(injectedExtensionAPI(injectedScriptId));" + | 1021 "platformExtensionAPI(injectedExtensionAPI(injectedScriptId));" + |
| 1011 "return {};" + | 1022 "return {};" + |
| 1012 "})"; | 1023 "})"; |
| 1013 } | 1024 } |
| OLD | NEW |