| OLD | NEW |
| 1 // Copyright (c) 2009 The chrome Authors. All rights reserved. | 1 // Copyright (c) 2009 The chrome 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 // ----------------------------------------------------------------------------- | 5 // ----------------------------------------------------------------------------- |
| 6 // NOTE: If you change this file you need to touch renderer_resources.grd to | 6 // NOTE: If you change this file you need to touch renderer_resources.grd to |
| 7 // have your change take effect. | 7 // have your change take effect. |
| 8 // ----------------------------------------------------------------------------- | 8 // ----------------------------------------------------------------------------- |
| 9 | 9 |
| 10 // This script contains privileged chrome extension related javascript APIs. | 10 // This script contains privileged chrome extension related javascript APIs. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 var chromeHidden = GetChromeHidden(); | 26 var chromeHidden = GetChromeHidden(); |
| 27 | 27 |
| 28 // Validate arguments. | 28 // Validate arguments. |
| 29 chromeHidden.validationTypes = []; | 29 chromeHidden.validationTypes = []; |
| 30 chromeHidden.validate = function(args, schemas) { | 30 chromeHidden.validate = function(args, schemas) { |
| 31 if (args.length > schemas.length) | 31 if (args.length > schemas.length) |
| 32 throw new Error("Too many arguments."); | 32 throw new Error("Too many arguments."); |
| 33 | 33 |
| 34 for (var i = 0; i < schemas.length; i++) { | 34 for (var i = 0; i < schemas.length; i++) { |
| 35 if (i in args && args[i] !== null && args[i] !== undefined) { | 35 if (i in args && args[i] !== null && args[i] !== undefined) { |
| 36 var validator = new chrome.JSONSchemaValidator(); | 36 var validator = new chromeHidden.JSONSchemaValidator(); |
| 37 validator.addTypes(chromeHidden.validationTypes); | 37 validator.addTypes(chromeHidden.validationTypes); |
| 38 validator.validate(args[i], schemas[i]); | 38 validator.validate(args[i], schemas[i]); |
| 39 if (validator.errors.length == 0) | 39 if (validator.errors.length == 0) |
| 40 continue; | 40 continue; |
| 41 | 41 |
| 42 var message = "Invalid value for argument " + i + ". "; | 42 var message = "Invalid value for argument " + i + ". "; |
| 43 for (var i = 0, err; err = validator.errors[i]; i++) { | 43 for (var i = 0, err; err = validator.errors[i]; i++) { |
| 44 if (err.path) { | 44 if (err.path) { |
| 45 message += "Property '" + err.path + "': "; | 45 message += "Property '" + err.path + "': "; |
| 46 } | 46 } |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 apiFunctions["extension.getTabContentses"].handleRequest = | 277 apiFunctions["extension.getTabContentses"].handleRequest = |
| 278 function(windowId) { | 278 function(windowId) { |
| 279 if (typeof(windowId) == "undefined") | 279 if (typeof(windowId) == "undefined") |
| 280 windowId = -1; | 280 windowId = -1; |
| 281 return GetExtensionViews(windowId, "TAB"); | 281 return GetExtensionViews(windowId, "TAB"); |
| 282 } | 282 } |
| 283 | 283 |
| 284 setupPageActionEvents(extensionId); | 284 setupPageActionEvents(extensionId); |
| 285 }); | 285 }); |
| 286 })(); | 286 })(); |
| OLD | NEW |