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