| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This script contains privileged chrome extension related javascript APIs. | 5 // This script contains privileged chrome extension related javascript APIs. |
| 6 // It is loaded by pages whose URL has the chrome-extension protocol. | 6 // It is loaded by pages whose URL has the chrome-extension protocol. |
| 7 | 7 |
| 8 // TODO(battre): cleanup the usage of packages everywhere, as described here | 8 // TODO(battre): cleanup the usage of packages everywhere, as described here |
| 9 // http://codereview.chromium.org/10392008/diff/38/chrome/renderer/resources/e
xtensions/schema_generated_bindings.js | 9 // http://codereview.chromium.org/10392008/diff/38/chrome/renderer/resources/e
xtensions/schema_generated_bindings.js |
| 10 | 10 |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 args = this.updateArgumentsPreValidate.apply(this, args); | 304 args = this.updateArgumentsPreValidate.apply(this, args); |
| 305 | 305 |
| 306 args = schemaUtils.normalizeArgumentsAndValidate(args, this); | 306 args = schemaUtils.normalizeArgumentsAndValidate(args, this); |
| 307 if (this.updateArgumentsPostValidate) | 307 if (this.updateArgumentsPostValidate) |
| 308 args = this.updateArgumentsPostValidate.apply(this, args); | 308 args = this.updateArgumentsPostValidate.apply(this, args); |
| 309 | 309 |
| 310 var retval; | 310 var retval; |
| 311 if (this.handleRequest) { | 311 if (this.handleRequest) { |
| 312 retval = this.handleRequest.apply(this, args); | 312 retval = this.handleRequest.apply(this, args); |
| 313 } else { | 313 } else { |
| 314 var optArgs = { |
| 315 customCallback: this.customCallback |
| 316 }; |
| 314 retval = sendRequest(this.name, args, | 317 retval = sendRequest(this.name, args, |
| 315 this.definition.parameters, | 318 this.definition.parameters, |
| 316 {customCallback: this.customCallback}); | 319 optArgs); |
| 317 } | 320 } |
| 318 | 321 |
| 319 // Validate return value if defined - only in debug. | 322 // Validate return value if defined - only in debug. |
| 320 if (chromeHidden.validateCallbacks && | 323 if (chromeHidden.validateCallbacks && |
| 321 this.definition.returns) { | 324 this.definition.returns) { |
| 322 schemaUtils.validate([retval], [this.definition.returns]); | 325 schemaUtils.validate([retval], [this.definition.returns]); |
| 323 } | 326 } |
| 324 return retval; | 327 return retval; |
| 325 }).bind(apiFunction); | 328 }).bind(apiFunction); |
| 326 }); | 329 }); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 // beginInstallWithManifest2. | 441 // beginInstallWithManifest2. |
| 439 // See http://crbug.com/100242 | 442 // See http://crbug.com/100242 |
| 440 if (chrome.webstorePrivate) { | 443 if (chrome.webstorePrivate) { |
| 441 chrome.webstorePrivate.beginInstallWithManifest2 = | 444 chrome.webstorePrivate.beginInstallWithManifest2 = |
| 442 chrome.webstorePrivate.beginInstallWithManifest3; | 445 chrome.webstorePrivate.beginInstallWithManifest3; |
| 443 } | 446 } |
| 444 | 447 |
| 445 if (chrome.test) | 448 if (chrome.test) |
| 446 chrome.test.getApiDefinitions = GetExtensionAPIDefinition; | 449 chrome.test.getApiDefinitions = GetExtensionAPIDefinition; |
| 447 }); | 450 }); |
| OLD | NEW |