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

Side by Side Diff: chrome/renderer/resources/extensions/permissions_custom_bindings.js

Issue 11413099: Bluetooth API Permission Dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix memory leak Created 8 years 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // Custom bindings for the Permissions API.
6
7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
8 var sendRequest = require('sendRequest').sendRequest;
9 var lastError = require('lastError');
10
11 chromeHidden.registerCustomHook('permissions', function(api) {
12 var apiFunctions = api.apiFunctions;
13
14 apiFunctions.setUpdateArgumentsPreValidate('request',
15 function() {
16 if (arguments.length < 1)
17 return arguments;
18
19 var args = arguments[0].permissions;
20 if (!args)
21 return arguments;
22
23 for (var i = 0; i < args.length; i += 1) {
24 if (typeof(args[i]) == 'object') {
25 var a = args[i];
26 var keys = Object.keys(a);
27 if (keys.length != 1) {
28 throw new Error("Too many keys in object-style permission.");
29 }
30 arguments[0].permissions[i] = keys[0] + '|' + a[keys[0]];
31 }
32 }
33
34 return arguments;
35 });
36 });
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/dispatcher.cc ('k') | chrome/renderer/resources/renderer_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698