Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: chrome/renderer/resources/extension_process_bindings.js

Issue 173263: Change the way json_schema.js is loaded. This is required so (Closed)
Patch Set: New approach using chromeHidden Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/renderer/renderer_resources.grd ('k') | chrome/renderer/resources/json_schema.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 })();
OLDNEW
« no previous file with comments | « chrome/renderer/renderer_resources.grd ('k') | chrome/renderer/resources/json_schema.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698